From 94f6ddf78b36254388cb2c0a3c15fe83441c7379 Mon Sep 17 00:00:00 2001 From: prabatuty Date: Thu, 4 Nov 2010 10:53:36 +0000 Subject: [PATCH] *** empty log message *** --- test/adapter/Connect/Makefile | 81 ++++++ test/adapter/Connect/common.h | 37 +++ test/adapter/Connect/conntest1.c | 29 ++ test/adapter/Connect/conntest10.c | 106 ++++++++ test/adapter/Connect/conntest11.c | 156 +++++++++++ test/adapter/Connect/conntest12.c | 67 +++++ test/adapter/Connect/conntest13.c | 81 ++++++ test/adapter/Connect/conntest2.c | 31 +++ test/adapter/Connect/conntest3.c | 36 +++ test/adapter/Connect/conntest4.c | 46 ++++ test/adapter/Connect/conntest5.c | 95 +++++++ test/adapter/Connect/conntest7.c | 18 ++ test/adapter/Connect/csql.conf | 158 +++++++++++ test/adapter/Connect/exp.test010 | 9 + test/adapter/Connect/exp.test011 | 6 + test/adapter/Connect/exp.test012 | 5 + test/adapter/Connect/test001na.ksh | 37 +++ test/adapter/Connect/test002na.ksh | 38 +++ test/adapter/Connect/test003na.ksh | 38 +++ test/adapter/Connect/test004na.ksh | 38 +++ test/adapter/Connect/test005na.ksh | 39 +++ test/adapter/Connect/test007na.ksh | 38 +++ test/adapter/Connect/test010na.ksh | 38 +++ test/adapter/Connect/test011na.ksh | 41 +++ test/adapter/Makefile | 18 ++ test/adapter/Parameter/Makefile | 67 +++++ test/adapter/Parameter/common.h | 39 +++ test/adapter/Parameter/csql.conf | 106 ++++++++ test/adapter/Parameter/exp.test001 | 125 +++++++++ test/adapter/Parameter/exp.test001na.ksh | 125 +++++++++ test/adapter/Parameter/exp.test002 | 14 + test/adapter/Parameter/exp.test002na.ksh | 14 + test/adapter/Parameter/exp.test003 | 10 + test/adapter/Parameter/exp.test003na.ksh | 10 + test/adapter/Parameter/exp.test004 | 17 ++ test/adapter/Parameter/exp.test004.psql | 17 ++ test/adapter/Parameter/exp.test004na.ksh | 17 ++ test/adapter/Parameter/exp.test004na.ksh.psql | 17 ++ test/adapter/Parameter/exp.test005 | 24 ++ test/adapter/Parameter/exp.test005na.ksh | 24 ++ test/adapter/Parameter/exp.test006 | 16 ++ test/adapter/Parameter/exp.test006.psql | 16 ++ test/adapter/Parameter/exp.test006na.ksh | 16 ++ test/adapter/Parameter/exp.test006na.ksh.psql | 16 ++ test/adapter/Parameter/paratest1.c | 245 +++++++++++++++++ test/adapter/Parameter/paratest2.c | 235 ++++++++++++++++ test/adapter/Parameter/paratest3.c | 296 ++++++++++++++++++++ test/adapter/Parameter/paratest4.c | 270 +++++++++++++++++++ test/adapter/Parameter/paratest5.c | 214 +++++++++++++++ test/adapter/Parameter/paratest6.c | 220 +++++++++++++++ test/adapter/Parameter/test001na.ksh | 29 ++ test/adapter/Parameter/test002na.ksh | 29 ++ test/adapter/Parameter/test003na.ksh | 29 ++ test/adapter/Parameter/test004na.ksh | 29 ++ test/adapter/Parameter/test005na.ksh | 29 ++ test/adapter/Parameter/test006na.ksh | 30 +++ test/adapter/Select/Makefile | 92 +++++++ test/adapter/Select/common.h | 38 +++ test/adapter/Select/csql.conf | 106 ++++++++ test/adapter/Select/exp.test001 | 11 + test/adapter/Select/exp.test001na.ksh | 11 + test/adapter/Select/exp.test002 | 10 + test/adapter/Select/exp.test002na.ksh | 10 + test/adapter/Select/exp.test010 | 10 + test/adapter/Select/exp.test010na.ksh | 10 + test/adapter/Select/exp.test011 | 33 +++ test/adapter/Select/exp.test011na.ksh | 33 +++ test/adapter/Select/selecttest1.c | 216 +++++++++++++++ test/adapter/Select/selecttest10.c | 214 +++++++++++++++ test/adapter/Select/selecttest2.c | 218 +++++++++++++++ test/adapter/Select/selecttest3.c | 176 ++++++++++++ test/adapter/Select/selecttest4.c | 139 ++++++++++ test/adapter/Select/selecttest5.c | 46 ++++ test/adapter/Select/selecttest6.c | 131 +++++++++ test/adapter/Select/selecttest7.c | 143 ++++++++++ test/adapter/Select/selecttest8.c | 67 +++++ test/adapter/Select/selecttest9.c | 60 +++++ test/adapter/Select/singleconnadapter.c | 193 +++++++++++++ test/adapter/Select/test001na.ksh | 48 ++++ test/adapter/Select/test002na.ksh | 49 ++++ test/adapter/Select/test003na.ksh | 48 ++++ test/adapter/Select/test004na.ksh | 48 ++++ test/adapter/Select/test005na.ksh | 45 ++++ test/adapter/Select/test006na.ksh | 48 ++++ test/adapter/Select/test007na.ksh | 48 ++++ test/adapter/Select/test008na.ksh | 46 ++++ test/adapter/Select/test009na.ksh | 47 ++++ test/adapter/Select/test010na.ksh | 43 +++ test/adapter/Select/test011na.ksh | 48 ++++ test/system/Allocator/Makefile | 76 ++++++ test/system/Allocator/TODO | 2 + test/system/Allocator/common.h | 153 +++++++++++ test/system/Allocator/create.c | 17 ++ test/system/Allocator/createNoIndex.c | 15 ++ test/system/Allocator/dbsizelimit.c | 47 ++++ test/system/Allocator/dbsizelimit1.c | 47 ++++ test/system/Allocator/delete1.c | 15 ++ test/system/Allocator/delete100.c | 15 ++ test/system/Allocator/delete1000.c | 15 ++ test/system/Allocator/deleteAll.c | 15 ++ test/system/Allocator/drop.c | 15 ++ test/system/Allocator/exp.test001.ksh | 63 +++++ test/system/Allocator/exp.test001.ksh.x86_64 | 63 +++++ test/system/Allocator/exp.test002.ksh | 64 +++++ test/system/Allocator/exp.test002.ksh.x86_64 | 64 +++++ test/system/Allocator/exp.test003.ksh | 63 +++++ test/system/Allocator/exp.test003.ksh.x86_64 | 63 +++++ test/system/Allocator/exp.test004.ksh | 63 +++++ test/system/Allocator/exp.test004.ksh.x86_64 | 63 +++++ test/system/Allocator/exp.test005.ksh | 114 ++++++++ test/system/Allocator/exp.test005.ksh.x86_64 | 114 ++++++++ test/system/Allocator/exp.test006.ksh | 115 ++++++++ test/system/Allocator/exp.test006.ksh.x86_64 | 115 ++++++++ test/system/Allocator/exp.test007.ksh | 375 ++++++++++++++++++++++++++ test/system/Allocator/exp.test007.ksh.x86_64 | 375 ++++++++++++++++++++++++++ test/system/Allocator/exp.test021 | 10 + test/system/Allocator/exp.test021.x86_64 | 10 + test/system/Allocator/exp.test022 | 10 + test/system/Allocator/exp.test022.x86_64 | 10 + test/system/Allocator/exp.test023 | 10 + test/system/Allocator/exp.test023.x86_64 | 10 + test/system/Allocator/exp.test024 | 10 + test/system/Allocator/exp.test024.x86_64 | 10 + test/system/Allocator/exp.test025 | 10 + test/system/Allocator/exp.test025.x86_64 | 10 + test/system/Allocator/insert1.c | 15 ++ test/system/Allocator/insert100.c | 15 ++ test/system/Allocator/insert1000.c | 14 + test/system/Allocator/test001.ksh | 114 ++++++++ test/system/Allocator/test002.ksh | 103 +++++++ test/system/Allocator/test003.ksh | 114 ++++++++ test/system/Allocator/test004.ksh | 103 +++++++ test/system/Allocator/test005.ksh | 77 ++++++ test/system/Allocator/test006.ksh | 75 ++++++ test/system/Allocator/test007.ksh | 66 +++++ test/system/Allocator/tuplesize1.c | 31 +++ test/system/Allocator/tuplesize2.c | 33 +++ test/system/Allocator/tuplesize3.c | 34 +++ test/system/Allocator/tuplesize4.c | 35 +++ test/system/Allocator/tuplesize5.c | 36 +++ test/system/Makefile | 18 ++ test/system/config/Makefile | 47 ++++ test/system/config/conftest1.c | 10 + test/system/config/conftest2.c | 20 ++ test/system/config/connect.c | 10 + test/system/config/csql.conf | 50 ++++ test/system/config/exp.test002 | 32 +++ test/system/config/exp.test003.ksh | 3 + test/system/config/exp.test004.ksh | 3 + test/system/config/exp.test006.ksh | 3 + test/system/config/exp.test008.ksh | 3 + test/system/config/exp.test009.ksh | 3 + test/system/config/exp.test010.ksh | 3 + test/system/config/exp.test011.ksh | 3 + test/system/config/exp.test011.ksh.x86_64 | 3 + test/system/config/exp.test012.ksh | 3 + test/system/config/exp.test012.ksh.x86_64 | 3 + test/system/config/exp.test013.ksh | 3 + test/system/config/exp.test014.ksh | 3 + test/system/config/exp.test014.ksh.x86_64 | 3 + test/system/config/exp.test015.ksh | 3 + test/system/config/exp.test016.ksh | 3 + test/system/config/exp.test017.ksh | 3 + test/system/config/exp.test018.ksh | 3 + test/system/config/exp.test019.ksh | 3 + test/system/config/exp.test021.ksh | 3 + test/system/config/exp.test022.ksh | 3 + test/system/config/exp.test023.ksh | 3 + test/system/config/exp.test024.ksh | 3 + test/system/config/exp.test027.ksh | 3 + test/system/config/exp.test028.ksh | 3 + test/system/config/exp.test029.ksh | 3 + test/system/config/exp.test030.ksh | 3 + test/system/config/test003.ksh | 21 ++ test/system/config/test004.ksh | 23 ++ test/system/config/test006.ksh | 23 ++ test/system/config/test008.ksh | 23 ++ test/system/config/test009.ksh | 23 ++ test/system/config/test010.ksh | 23 ++ test/system/config/test011.ksh | 23 ++ test/system/config/test012.ksh | 23 ++ test/system/config/test013.ksh | 23 ++ test/system/config/test014.ksh | 23 ++ test/system/config/test015.ksh | 23 ++ test/system/config/test016.ksh | 23 ++ test/system/config/test017.ksh | 24 ++ test/system/config/test018.ksh | 23 ++ test/system/config/test019.ksh | 23 ++ test/system/config/test020.ksh | 23 ++ test/system/config/test021.ksh | 23 ++ test/system/config/test022.ksh | 23 ++ test/system/config/test023.ksh | 23 ++ test/system/config/test024.ksh | 23 ++ test/system/config/test025.ksh | 23 ++ test/system/config/test026.ksh | 23 ++ test/system/config/test027.ksh | 23 ++ test/system/config/test028.ksh | 23 ++ test/system/config/test029.ksh | 23 ++ test/system/config/test030.ksh | 23 ++ test/system/config/test031.ksh | 23 ++ test/system/config/test032.ksh | 23 ++ test/system/index/TODO | 24 ++ test/system/lock/Makefile | 83 ++++++ test/system/lock/TODO | 2 + test/system/lock/common.h | 153 +++++++++++ test/system/lock/exp.test001 | 0 test/system/lock/exp.test001a | 114 ++++++++ test/system/lock/exp.test001a.x86_64 | 114 ++++++++ test/system/lock/exp.test002 | 113 ++++++++ test/system/lock/exp.test002.x86_64 | 113 ++++++++ test/system/lock/exp.test002a | 114 ++++++++ test/system/lock/exp.test002a.x86_64 | 114 ++++++++ test/system/lock/exp.test003 | 14 + test/system/lock/exp.test003a | 15 ++ test/system/lock/exp.test004 | 114 ++++++++ test/system/lock/exp.test004.x86_64 | 114 ++++++++ test/system/lock/exp.test004a | 115 ++++++++ test/system/lock/exp.test004a.x86_64 | 115 ++++++++ test/system/lock/exp.test005 | 114 ++++++++ test/system/lock/exp.test005.x86_64 | 114 ++++++++ test/system/lock/exp.test005a | 115 ++++++++ test/system/lock/exp.test005a.x86_64 | 115 ++++++++ test/system/lock/exp.test006 | 114 ++++++++ test/system/lock/exp.test006.x86_64 | 114 ++++++++ test/system/lock/exp.test006a | 115 ++++++++ test/system/lock/exp.test006a.x86_64 | 115 ++++++++ test/system/lock/exp.test007 | 114 ++++++++ test/system/lock/exp.test007.x86_64 | 114 ++++++++ test/system/lock/exp.test007a | 115 ++++++++ test/system/lock/exp.test007a.x86_64 | 115 ++++++++ test/system/lock/exp.test008 | 114 ++++++++ test/system/lock/exp.test008.x86_64 | 114 ++++++++ test/system/lock/exp.test008a | 115 ++++++++ test/system/lock/exp.test008a.x86_64 | 115 ++++++++ test/system/lock/exp.test009 | 114 ++++++++ test/system/lock/exp.test009.x86_64 | 114 ++++++++ test/system/lock/exp.test009a | 115 ++++++++ test/system/lock/exp.test009a.x86_64 | 115 ++++++++ test/system/lock/locktest001.c | 36 +++ test/system/lock/locktest002.c | 36 +++ test/system/lock/locktest003.c | 43 +++ test/system/lock/locktest004.c | 43 +++ test/system/lock/locktest005.c | 43 +++ test/system/lock/locktest006.c | 43 +++ test/system/lock/locktest007.c | 43 +++ test/system/lock/locktest008.c | 43 +++ test/system/lock/locktest009.c | 43 +++ test/system/proc/TODO | 25 ++ test/system/proc/exp.test001.ksh | 6 + test/system/proc/test001.ksh | 46 ++++ test/system/trans/Makefile | 87 ++++++ test/system/trans/common.h | 153 +++++++++++ test/system/trans/create.c | 16 ++ test/system/trans/drop.c | 15 ++ test/system/trans/exp.test001.ksh | 20 ++ test/system/trans/exp.test002.ksh | 20 ++ test/system/trans/exp.test003 | 141 ++++++++++ test/system/trans/exp.test003.x86_64 | 141 ++++++++++ test/system/trans/exp.test003a | 192 +++++++++++++ test/system/trans/exp.test003a.x86_64 | 192 +++++++++++++ test/system/trans/exp.test004 | 141 ++++++++++ test/system/trans/exp.test004.x86_64 | 141 ++++++++++ test/system/trans/exp.test004a | 192 +++++++++++++ test/system/trans/exp.test004a.x86_64 | 192 +++++++++++++ test/system/trans/exp.test005 | 32 +++ test/system/trans/exp.test005a | 33 +++ test/system/trans/exp.test006 | 32 +++ test/system/trans/exp.test006a | 33 +++ test/system/trans/exp.test007 | 142 ++++++++++ test/system/trans/exp.test007.x86_64 | 142 ++++++++++ test/system/trans/exp.test007a | 143 ++++++++++ test/system/trans/exp.test007a.x86_64 | 143 ++++++++++ test/system/trans/exp.test008 | 142 ++++++++++ test/system/trans/exp.test008.x86_64 | 142 ++++++++++ test/system/trans/exp.test008a | 143 ++++++++++ test/system/trans/exp.test008a.x86_64 | 143 ++++++++++ test/system/trans/exp.test009 | 142 ++++++++++ test/system/trans/exp.test009.x86_64 | 142 ++++++++++ test/system/trans/exp.test009a | 193 +++++++++++++ test/system/trans/exp.test009a.x86_64 | 193 +++++++++++++ test/system/trans/exp.test010 | 142 ++++++++++ test/system/trans/exp.test010.x86_64 | 142 ++++++++++ test/system/trans/exp.test010a | 193 +++++++++++++ test/system/trans/exp.test010a.x86_64 | 193 +++++++++++++ test/system/trans/insert1andAbort.c | 17 ++ test/system/trans/insert1andCommit.c | 17 ++ test/system/trans/locktest009.c | 44 +++ test/system/trans/test001.ksh | 75 ++++++ test/system/trans/test002.ksh | 74 +++++ test/system/trans/transtest003.c | 36 +++ test/system/trans/transtest004.c | 36 +++ test/system/trans/transtest005.c | 45 ++++ test/system/trans/transtest006.c | 45 ++++ test/system/trans/transtest007.c | 45 ++++ test/system/trans/transtest008.c | 45 ++++ test/system/trans/transtest009.c | 45 ++++ test/system/trans/transtest010.c | 45 ++++ 297 files changed, 19128 insertions(+) create mode 100644 test/adapter/Connect/Makefile create mode 100644 test/adapter/Connect/common.h create mode 100644 test/adapter/Connect/conntest1.c create mode 100644 test/adapter/Connect/conntest10.c create mode 100644 test/adapter/Connect/conntest11.c create mode 100644 test/adapter/Connect/conntest12.c create mode 100644 test/adapter/Connect/conntest13.c create mode 100644 test/adapter/Connect/conntest2.c create mode 100644 test/adapter/Connect/conntest3.c create mode 100644 test/adapter/Connect/conntest4.c create mode 100644 test/adapter/Connect/conntest5.c create mode 100644 test/adapter/Connect/conntest7.c create mode 100644 test/adapter/Connect/csql.conf create mode 100644 test/adapter/Connect/exp.test010 create mode 100644 test/adapter/Connect/exp.test011 create mode 100644 test/adapter/Connect/exp.test012 create mode 100755 test/adapter/Connect/test001na.ksh create mode 100755 test/adapter/Connect/test002na.ksh create mode 100755 test/adapter/Connect/test003na.ksh create mode 100755 test/adapter/Connect/test004na.ksh create mode 100755 test/adapter/Connect/test005na.ksh create mode 100755 test/adapter/Connect/test007na.ksh create mode 100755 test/adapter/Connect/test010na.ksh create mode 100755 test/adapter/Connect/test011na.ksh create mode 100644 test/adapter/Makefile create mode 100644 test/adapter/Parameter/Makefile create mode 100644 test/adapter/Parameter/common.h create mode 100644 test/adapter/Parameter/csql.conf create mode 100644 test/adapter/Parameter/exp.test001 create mode 100644 test/adapter/Parameter/exp.test001na.ksh create mode 100644 test/adapter/Parameter/exp.test002 create mode 100644 test/adapter/Parameter/exp.test002na.ksh create mode 100644 test/adapter/Parameter/exp.test003 create mode 100644 test/adapter/Parameter/exp.test003na.ksh create mode 100644 test/adapter/Parameter/exp.test004 create mode 100644 test/adapter/Parameter/exp.test004.psql create mode 100644 test/adapter/Parameter/exp.test004na.ksh create mode 100644 test/adapter/Parameter/exp.test004na.ksh.psql create mode 100644 test/adapter/Parameter/exp.test005 create mode 100644 test/adapter/Parameter/exp.test005na.ksh create mode 100644 test/adapter/Parameter/exp.test006 create mode 100644 test/adapter/Parameter/exp.test006.psql create mode 100644 test/adapter/Parameter/exp.test006na.ksh create mode 100644 test/adapter/Parameter/exp.test006na.ksh.psql create mode 100644 test/adapter/Parameter/paratest1.c create mode 100644 test/adapter/Parameter/paratest2.c create mode 100644 test/adapter/Parameter/paratest3.c create mode 100644 test/adapter/Parameter/paratest4.c create mode 100644 test/adapter/Parameter/paratest5.c create mode 100644 test/adapter/Parameter/paratest6.c create mode 100755 test/adapter/Parameter/test001na.ksh create mode 100755 test/adapter/Parameter/test002na.ksh create mode 100755 test/adapter/Parameter/test003na.ksh create mode 100755 test/adapter/Parameter/test004na.ksh create mode 100755 test/adapter/Parameter/test005na.ksh create mode 100755 test/adapter/Parameter/test006na.ksh create mode 100644 test/adapter/Select/Makefile create mode 100644 test/adapter/Select/common.h create mode 100644 test/adapter/Select/csql.conf create mode 100644 test/adapter/Select/exp.test001 create mode 100644 test/adapter/Select/exp.test001na.ksh create mode 100644 test/adapter/Select/exp.test002 create mode 100644 test/adapter/Select/exp.test002na.ksh create mode 100644 test/adapter/Select/exp.test010 create mode 100644 test/adapter/Select/exp.test010na.ksh create mode 100644 test/adapter/Select/exp.test011 create mode 100644 test/adapter/Select/exp.test011na.ksh create mode 100644 test/adapter/Select/selecttest1.c create mode 100644 test/adapter/Select/selecttest10.c create mode 100644 test/adapter/Select/selecttest2.c create mode 100644 test/adapter/Select/selecttest3.c create mode 100644 test/adapter/Select/selecttest4.c create mode 100644 test/adapter/Select/selecttest5.c create mode 100644 test/adapter/Select/selecttest6.c create mode 100644 test/adapter/Select/selecttest7.c create mode 100644 test/adapter/Select/selecttest8.c create mode 100644 test/adapter/Select/selecttest9.c create mode 100644 test/adapter/Select/singleconnadapter.c create mode 100755 test/adapter/Select/test001na.ksh create mode 100755 test/adapter/Select/test002na.ksh create mode 100755 test/adapter/Select/test003na.ksh create mode 100755 test/adapter/Select/test004na.ksh create mode 100755 test/adapter/Select/test005na.ksh create mode 100755 test/adapter/Select/test006na.ksh create mode 100755 test/adapter/Select/test007na.ksh create mode 100755 test/adapter/Select/test008na.ksh create mode 100755 test/adapter/Select/test009na.ksh create mode 100755 test/adapter/Select/test010na.ksh create mode 100755 test/adapter/Select/test011na.ksh create mode 100644 test/system/Allocator/Makefile create mode 100644 test/system/Allocator/TODO create mode 100644 test/system/Allocator/common.h create mode 100644 test/system/Allocator/create.c create mode 100644 test/system/Allocator/createNoIndex.c create mode 100644 test/system/Allocator/dbsizelimit.c create mode 100644 test/system/Allocator/dbsizelimit1.c create mode 100644 test/system/Allocator/delete1.c create mode 100644 test/system/Allocator/delete100.c create mode 100644 test/system/Allocator/delete1000.c create mode 100644 test/system/Allocator/deleteAll.c create mode 100644 test/system/Allocator/drop.c create mode 100644 test/system/Allocator/exp.test001.ksh create mode 100644 test/system/Allocator/exp.test001.ksh.x86_64 create mode 100644 test/system/Allocator/exp.test002.ksh create mode 100644 test/system/Allocator/exp.test002.ksh.x86_64 create mode 100644 test/system/Allocator/exp.test003.ksh create mode 100644 test/system/Allocator/exp.test003.ksh.x86_64 create mode 100644 test/system/Allocator/exp.test004.ksh create mode 100644 test/system/Allocator/exp.test004.ksh.x86_64 create mode 100644 test/system/Allocator/exp.test005.ksh create mode 100644 test/system/Allocator/exp.test005.ksh.x86_64 create mode 100644 test/system/Allocator/exp.test006.ksh create mode 100644 test/system/Allocator/exp.test006.ksh.x86_64 create mode 100644 test/system/Allocator/exp.test007.ksh create mode 100644 test/system/Allocator/exp.test007.ksh.x86_64 create mode 100644 test/system/Allocator/exp.test021 create mode 100644 test/system/Allocator/exp.test021.x86_64 create mode 100644 test/system/Allocator/exp.test022 create mode 100644 test/system/Allocator/exp.test022.x86_64 create mode 100644 test/system/Allocator/exp.test023 create mode 100644 test/system/Allocator/exp.test023.x86_64 create mode 100644 test/system/Allocator/exp.test024 create mode 100644 test/system/Allocator/exp.test024.x86_64 create mode 100644 test/system/Allocator/exp.test025 create mode 100644 test/system/Allocator/exp.test025.x86_64 create mode 100644 test/system/Allocator/insert1.c create mode 100644 test/system/Allocator/insert100.c create mode 100644 test/system/Allocator/insert1000.c create mode 100755 test/system/Allocator/test001.ksh create mode 100755 test/system/Allocator/test002.ksh create mode 100755 test/system/Allocator/test003.ksh create mode 100755 test/system/Allocator/test004.ksh create mode 100755 test/system/Allocator/test005.ksh create mode 100755 test/system/Allocator/test006.ksh create mode 100755 test/system/Allocator/test007.ksh create mode 100644 test/system/Allocator/tuplesize1.c create mode 100644 test/system/Allocator/tuplesize2.c create mode 100644 test/system/Allocator/tuplesize3.c create mode 100644 test/system/Allocator/tuplesize4.c create mode 100644 test/system/Allocator/tuplesize5.c create mode 100644 test/system/Makefile create mode 100644 test/system/config/Makefile create mode 100644 test/system/config/conftest1.c create mode 100644 test/system/config/conftest2.c create mode 100644 test/system/config/connect.c create mode 100644 test/system/config/csql.conf create mode 100644 test/system/config/exp.test002 create mode 100644 test/system/config/exp.test003.ksh create mode 100644 test/system/config/exp.test004.ksh create mode 100644 test/system/config/exp.test006.ksh create mode 100644 test/system/config/exp.test008.ksh create mode 100644 test/system/config/exp.test009.ksh create mode 100644 test/system/config/exp.test010.ksh create mode 100644 test/system/config/exp.test011.ksh create mode 100644 test/system/config/exp.test011.ksh.x86_64 create mode 100644 test/system/config/exp.test012.ksh create mode 100644 test/system/config/exp.test012.ksh.x86_64 create mode 100644 test/system/config/exp.test013.ksh create mode 100644 test/system/config/exp.test014.ksh create mode 100644 test/system/config/exp.test014.ksh.x86_64 create mode 100644 test/system/config/exp.test015.ksh create mode 100644 test/system/config/exp.test016.ksh create mode 100644 test/system/config/exp.test017.ksh create mode 100644 test/system/config/exp.test018.ksh create mode 100644 test/system/config/exp.test019.ksh create mode 100644 test/system/config/exp.test021.ksh create mode 100644 test/system/config/exp.test022.ksh create mode 100644 test/system/config/exp.test023.ksh create mode 100644 test/system/config/exp.test024.ksh create mode 100644 test/system/config/exp.test027.ksh create mode 100644 test/system/config/exp.test028.ksh create mode 100644 test/system/config/exp.test029.ksh create mode 100644 test/system/config/exp.test030.ksh create mode 100755 test/system/config/test003.ksh create mode 100755 test/system/config/test004.ksh create mode 100755 test/system/config/test006.ksh create mode 100755 test/system/config/test008.ksh create mode 100755 test/system/config/test009.ksh create mode 100755 test/system/config/test010.ksh create mode 100755 test/system/config/test011.ksh create mode 100755 test/system/config/test012.ksh create mode 100755 test/system/config/test013.ksh create mode 100755 test/system/config/test014.ksh create mode 100755 test/system/config/test015.ksh create mode 100755 test/system/config/test016.ksh create mode 100755 test/system/config/test017.ksh create mode 100755 test/system/config/test018.ksh create mode 100755 test/system/config/test019.ksh create mode 100755 test/system/config/test020.ksh create mode 100755 test/system/config/test021.ksh create mode 100755 test/system/config/test022.ksh create mode 100755 test/system/config/test023.ksh create mode 100755 test/system/config/test024.ksh create mode 100755 test/system/config/test025.ksh create mode 100755 test/system/config/test026.ksh create mode 100755 test/system/config/test027.ksh create mode 100755 test/system/config/test028.ksh create mode 100755 test/system/config/test029.ksh create mode 100755 test/system/config/test030.ksh create mode 100755 test/system/config/test031.ksh create mode 100755 test/system/config/test032.ksh create mode 100644 test/system/index/TODO create mode 100644 test/system/lock/Makefile create mode 100644 test/system/lock/TODO create mode 100644 test/system/lock/common.h create mode 100644 test/system/lock/exp.test001 create mode 100644 test/system/lock/exp.test001a create mode 100644 test/system/lock/exp.test001a.x86_64 create mode 100644 test/system/lock/exp.test002 create mode 100644 test/system/lock/exp.test002.x86_64 create mode 100644 test/system/lock/exp.test002a create mode 100644 test/system/lock/exp.test002a.x86_64 create mode 100644 test/system/lock/exp.test003 create mode 100644 test/system/lock/exp.test003a create mode 100644 test/system/lock/exp.test004 create mode 100644 test/system/lock/exp.test004.x86_64 create mode 100644 test/system/lock/exp.test004a create mode 100644 test/system/lock/exp.test004a.x86_64 create mode 100644 test/system/lock/exp.test005 create mode 100644 test/system/lock/exp.test005.x86_64 create mode 100644 test/system/lock/exp.test005a create mode 100644 test/system/lock/exp.test005a.x86_64 create mode 100644 test/system/lock/exp.test006 create mode 100644 test/system/lock/exp.test006.x86_64 create mode 100644 test/system/lock/exp.test006a create mode 100644 test/system/lock/exp.test006a.x86_64 create mode 100644 test/system/lock/exp.test007 create mode 100644 test/system/lock/exp.test007.x86_64 create mode 100644 test/system/lock/exp.test007a create mode 100644 test/system/lock/exp.test007a.x86_64 create mode 100644 test/system/lock/exp.test008 create mode 100644 test/system/lock/exp.test008.x86_64 create mode 100644 test/system/lock/exp.test008a create mode 100644 test/system/lock/exp.test008a.x86_64 create mode 100644 test/system/lock/exp.test009 create mode 100644 test/system/lock/exp.test009.x86_64 create mode 100644 test/system/lock/exp.test009a create mode 100644 test/system/lock/exp.test009a.x86_64 create mode 100644 test/system/lock/locktest001.c create mode 100644 test/system/lock/locktest002.c create mode 100644 test/system/lock/locktest003.c create mode 100644 test/system/lock/locktest004.c create mode 100644 test/system/lock/locktest005.c create mode 100644 test/system/lock/locktest006.c create mode 100644 test/system/lock/locktest007.c create mode 100644 test/system/lock/locktest008.c create mode 100644 test/system/lock/locktest009.c create mode 100644 test/system/proc/TODO create mode 100644 test/system/proc/exp.test001.ksh create mode 100755 test/system/proc/test001.ksh create mode 100644 test/system/trans/Makefile create mode 100644 test/system/trans/common.h create mode 100644 test/system/trans/create.c create mode 100644 test/system/trans/drop.c create mode 100644 test/system/trans/exp.test001.ksh create mode 100644 test/system/trans/exp.test002.ksh create mode 100644 test/system/trans/exp.test003 create mode 100644 test/system/trans/exp.test003.x86_64 create mode 100644 test/system/trans/exp.test003a create mode 100644 test/system/trans/exp.test003a.x86_64 create mode 100644 test/system/trans/exp.test004 create mode 100644 test/system/trans/exp.test004.x86_64 create mode 100644 test/system/trans/exp.test004a create mode 100644 test/system/trans/exp.test004a.x86_64 create mode 100644 test/system/trans/exp.test005 create mode 100644 test/system/trans/exp.test005a create mode 100644 test/system/trans/exp.test006 create mode 100644 test/system/trans/exp.test006a create mode 100644 test/system/trans/exp.test007 create mode 100644 test/system/trans/exp.test007.x86_64 create mode 100644 test/system/trans/exp.test007a create mode 100644 test/system/trans/exp.test007a.x86_64 create mode 100644 test/system/trans/exp.test008 create mode 100644 test/system/trans/exp.test008.x86_64 create mode 100644 test/system/trans/exp.test008a create mode 100644 test/system/trans/exp.test008a.x86_64 create mode 100644 test/system/trans/exp.test009 create mode 100644 test/system/trans/exp.test009.x86_64 create mode 100644 test/system/trans/exp.test009a create mode 100644 test/system/trans/exp.test009a.x86_64 create mode 100644 test/system/trans/exp.test010 create mode 100644 test/system/trans/exp.test010.x86_64 create mode 100644 test/system/trans/exp.test010a create mode 100644 test/system/trans/exp.test010a.x86_64 create mode 100644 test/system/trans/insert1andAbort.c create mode 100644 test/system/trans/insert1andCommit.c create mode 100644 test/system/trans/locktest009.c create mode 100755 test/system/trans/test001.ksh create mode 100755 test/system/trans/test002.ksh create mode 100644 test/system/trans/transtest003.c create mode 100644 test/system/trans/transtest004.c create mode 100644 test/system/trans/transtest005.c create mode 100644 test/system/trans/transtest006.c create mode 100644 test/system/trans/transtest007.c create mode 100644 test/system/trans/transtest008.c create mode 100644 test/system/trans/transtest009.c create mode 100644 test/system/trans/transtest010.c diff --git a/test/adapter/Connect/Makefile b/test/adapter/Connect/Makefile new file mode 100644 index 00000000..fed24824 --- /dev/null +++ b/test/adapter/Connect/Makefile @@ -0,0 +1,81 @@ +OSNAME = $(shell uname -s) +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + + +INCL= -I$(CSQL_INSTALL_ROOT)/install/include -I../../../include +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcsqlgw -lcsqlnw -lcsqlodbcadapter -lcsqlsqlnw -lcsql -lcsqlsql -lcacheload -lcsqlsqllog + +TARGETS = \ + test001 conntest1na\ + test002 conntest2na\ + test003 conntest3na\ + test004 conntest4na\ + test005 conntest5na\ + test007 conntest7na\ + test010 conntest10na\ + test011 conntest11na test012 test013 + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +test001: conntest1.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +conntest1na: conntest1.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test002:conntest2.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +conntest2na: conntest2.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test003:conntest3.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +conntest3na: conntest3.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004:conntest4.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +conntest4na: conntest4.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005:conntest5.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +conntest5na: conntest5.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test007:conntest7.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +conntest7na: conntest7.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test010:conntest10.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +conntest10na: conntest10.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test011:conntest11.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +conntest11na: conntest11.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test012:conntest12.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test013:conntest13.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) + +clean: + rm -f *.o ${TARGETS} diff --git a/test/adapter/Connect/common.h b/test/adapter/Connect/common.h new file mode 100644 index 00000000..1c84a1bd --- /dev/null +++ b/test/adapter/Connect/common.h @@ -0,0 +1,37 @@ +#include +#include +#include + +AbsSqlConnection *createConnection() +{ +#ifdef NETWORK + AbsSqlConnection *con = SqlFactory::createConnection(CSqlNetwork); + SqlNwConnection *conn = (SqlNwConnection *) con; + conn->setHost("localhost", 5678); +#elif defined NETWORKADAPTER + AbsSqlConnection *con = SqlFactory::createConnection(CSqlNetworkAdapter); + SqlNwConnection *conn = (SqlNwConnection *) con; + conn->setHost("localhost", 5678); +#elif defined NETWORKGATEWAY + AbsSqlConnection *con = SqlFactory::createConnection(CSqlNetworkGateway); + SqlNwConnection *conn = (SqlNwConnection *) con; + conn->setHost("localhost", 5678); +#else + AbsSqlConnection *con = SqlFactory::createConnection(CSqlAdapter); +#endif + return con; +} + +AbsSqlStatement *createStatement() +{ +#ifdef NETWORK + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlNetwork); +#elif defined NETWORKADAPTER + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlNetworkAdapter); +#elif defined NETWORKGATEWAY + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlNetworkGateway); +#else + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlAdapter); +#endif + return stmt; +} diff --git a/test/adapter/Connect/conntest1.c b/test/adapter/Connect/conntest1.c new file mode 100644 index 00000000..3244c3b0 --- /dev/null +++ b/test/adapter/Connect/conntest1.c @@ -0,0 +1,29 @@ +/* connect ,disconnect and again connect ,it should pass. + + * AUTHOR : Jitendra Lenka + */ + +#include "common.h" +int main() +{ + DbRetVal rv =OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + printf("Connection opened\n"); + delete con; + + con = createConnection(); + rv = con->connect("root","manager"); + if(rv !=OK) + { + printf("Test script failed \n"); + return 2; + } + printf("Connection closed\n"); + printf("Test script passed\n"); + delete con; + return 0; +} + + diff --git a/test/adapter/Connect/conntest10.c b/test/adapter/Connect/conntest10.c new file mode 100644 index 00000000..8932da10 --- /dev/null +++ b/test/adapter/Connect/conntest10.c @@ -0,0 +1,106 @@ +// Create table t1, INSERT, UPDATE AND COMMIT. +// FETCH UPDATED RECORDS. + +#include"common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv !=OK)return 1; + printf("Connection opened\n"); + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(9));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT) engine='innodb';"); + + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 2; } + + rv = stmt->execute(rows); + if(rv!=OK) { delete stmt; delete con; return 3; } + stmt->free(); + printf("Table t1 CREATED\n"); + con->commit(); + // insert into statement + strcpy(statement,"INSERT INTO t1 VALUES(1,1);"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(1,1)"); + } + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + + rv = con->beginTrans(); + if(rv!=OK) { delete stmt; delete con; return 5; } + + rv = stmt->execute(rows); if(rv!=OK) return 6; + stmt->free(); + printf("One record inserted\n"); + + // update statement + + printf("update t1 set f2=100\n"); + strcpy(statement,"UPDATE t1 SET f2=100;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"UPDATE t1 SET f2=100"); + } + rv = stmt->prepare(statement); + if(rv !=OK) { delete stmt; delete con; return 7; } + + rv = stmt->execute(rows); + if(strcmp(getenv("DSN"),"db2")!=0){ + if(rv!=OK){ printf ("Hello\n"); return 8; } + } + rv = con->commit(); if(rv!=OK)return 9; + printf("One row updated\n"); + + strcpy(statement,"SELECT f2 FROM t1 ;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"SELECT f2 FROM t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 10; } + + int id=10; + stmt->bindField(1,&id); + rv = con->beginTrans(); + if(rv!=OK)return 11; + stmt->execute(rows); + int count=0; + while(stmt->fetch()!=NULL) + { + printf("f2= %d\n",id); + count++; + } + stmt->close(); + rv = con->commit(); + if(rv!=OK)return 12; + printf("Total reccord fetchec=%d\n",count); + stmt->free(); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"DROP TABLE t1;"); + } + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 13; } + rv = stmt->execute(rows); + if(rv!=OK) { delete stmt; delete con; return 14; } + con->commit(); + printf("TABLE t1 DROPPED SUCCESSFULLY\n"); + stmt->free(); + delete stmt; + delete con; + printf("Connection closed successfully\n"); + return 0; +} diff --git a/test/adapter/Connect/conntest11.c b/test/adapter/Connect/conntest11.c new file mode 100644 index 00000000..b57736d3 --- /dev/null +++ b/test/adapter/Connect/conntest11.c @@ -0,0 +1,156 @@ +// create table t1 , insert and update +// then rollback. All Should Work Fine + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv !=OK)return 1; + printf("Connection opened\n"); + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(9));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT) ;"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT) ;"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT) engine='innodb';"); + + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + con->commit(); + stmt->free(); + printf("Table t1 CREATED\n"); + + strcpy(statement,"INSERT INTO t1 VALUES(1,1);"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(1,1)"); + } + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + + rv = con->beginTrans(); + if(rv!=OK) + { + delete stmt; + delete con; + return 4; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 5; + } + printf("1 Record inserted\n"); + stmt->free(); + + strcpy(statement,"UPDATE t1 SET f2=100;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"UPDATE t1 SET f2=100"); + } + + rv = stmt->prepare(statement); + if(rv !=OK) + { + delete stmt; + delete con; + return 6; + } + + + rv = stmt->execute(rows); + if(rv!=OK && rows !=1)return 7; + printf("1 Record updated\n"); + // ROLLBACK + + rv = con->rollback(); + if(rv!=OK)return 8; + + stmt->free(); + + strcpy(statement,"SELECT f2 FROM t1 ;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"SELECT f2 FROM t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 9; + } + + int id=10; + stmt->bindField(1,&id); + rv = con->beginTrans(); + if(rv!=OK)return 1; + stmt->execute(rows); + int count=0; + while(stmt->fetch()!=NULL) + { + printf("f2= %d\n",id); + count++; + } + stmt->close(); + rv = con->commit(); + if(rv!=OK)return 10; + + printf("Total record fetched =%d ,Because transaction rollbacked\n",count); + stmt->free(); + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"DROP TABLE t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 11; + } + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 12; + } + con->commit(); + printf("Table droped\n"); + stmt->free(); + delete stmt; + delete con; + return 0; +} + diff --git a/test/adapter/Connect/conntest12.c b/test/adapter/Connect/conntest12.c new file mode 100644 index 00000000..15527f63 --- /dev/null +++ b/test/adapter/Connect/conntest12.c @@ -0,0 +1,67 @@ +//Test for primary key in TDB +// + +#include"common.h" +#include +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv !=OK)return 1; + printf("Connection opened\n"); + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(9),primary key(f1));"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT NOT NULL,f2 INT,primary key(f1))"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT,primary key(f1));"); + + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 2; } + + rv = stmt->execute(rows); + if(rv!=OK) { delete stmt; delete con; return 3; } + stmt->free(); + printf("Table t1 CREATED\n"); + con->commit(); + // insert into statement + printf("Primary Key Testing Starts Here\n"); + char pkfield[200]; + SqlOdbcStatement *oStmt= (SqlOdbcStatement *)stmt; + oStmt->getPrimaryKeyFieldName("t1",pkfield); + printf("Primary key in table %s is %s \n","t1",pkfield); + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"DROP TABLE t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 4; + } + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 5; + } + con->commit(); + printf("Table droped\n"); + + delete stmt; + delete con; + return 0; +} + + + diff --git a/test/adapter/Connect/conntest13.c b/test/adapter/Connect/conntest13.c new file mode 100644 index 00000000..b023e505 --- /dev/null +++ b/test/adapter/Connect/conntest13.c @@ -0,0 +1,81 @@ +//Test for table exist in tdb or not +// + +#include"common.h" +#include +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv !=OK)return 1; + printf("Connection opened\n"); + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(9),primary key(f1));"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT NOT NULL,f2 INT,primary key(f1))"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT,primary key(f1));"); + + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 2; } + + rv = stmt->execute(rows); + if(rv!=OK) { delete stmt; delete con; return 3; } + stmt->free(); + printf("Table t1 CREATED\n"); + con->commit(); + // insert into statement + printf("TableExists in Tdb Testing Starts Here\n"); + char pkfield[200]; + SqlOdbcStatement *oStmt= (SqlOdbcStatement *)stmt; + bool tabflag=oStmt->isTableExists("t1"); + if(tabflag) + { + printf("Table t1 exists in TDB\n"); + }else{ + printf("Table t1 does not exists in TDB\n"); + } + + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"DROP TABLE t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 4; + } + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 5; + } + con->commit(); + tabflag=oStmt->isTableExists("t1"); + if(tabflag) + { + printf("Table t1 exists in TDB\n"); + }else{ + printf("Table t1 does not exists in TDB\n"); + } + + printf("Table droped\n"); + + delete stmt; + delete con; + return 0; +} + + + diff --git a/test/adapter/Connect/conntest2.c b/test/adapter/Connect/conntest2.c new file mode 100644 index 00000000..907b6e08 --- /dev/null +++ b/test/adapter/Connect/conntest2.c @@ -0,0 +1,31 @@ +//Close the Connection and call commit, it should fail + +#include"common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + printf("Connection opened\n"); + + rv = con->beginTrans(); + if(rv!=OK)return 2; + + rv = con->disconnect(); + if(rv !=OK)return 3;printf("Connection closed\n"); + + rv = con->commit(); + if(rv==OK) + { + printf("Test script failed\n"); + return 4; + } + printf("After closing the connection, commit failed\n"); + printf("Test script pased\n"); + delete con; + return 0; +} + + + diff --git a/test/adapter/Connect/conntest3.c b/test/adapter/Connect/conntest3.c new file mode 100644 index 00000000..273614ff --- /dev/null +++ b/test/adapter/Connect/conntest3.c @@ -0,0 +1,36 @@ +//Close the connection and call prepare ,it should be failed + +#include"common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv !=OK)return 1; + printf("Connection opened\n"); + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + strcpy(statement,"CREATE TABLE t1(f1 INT);"); + + int rows; + rv = con->disconnect(); + if(rv!=OK)return 2; + printf("Connection closed\n"); + + rv = stmt->prepare(statement); + if(rv==OK) + { + + delete stmt; + delete con; + printf("Test script failed\n"); + return 3; + } + printf("Test script passed\n"); + delete stmt; + delete con; + return 0; +} + diff --git a/test/adapter/Connect/conntest4.c b/test/adapter/Connect/conntest4.c new file mode 100644 index 00000000..095c74aa --- /dev/null +++ b/test/adapter/Connect/conntest4.c @@ -0,0 +1,46 @@ +//Close the connection and call execute,it should be failed. + +#include"common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv !=OK)return 1; + printf("Connection opened\n"); + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20)); "); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20))"); + } + int rows=0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + printf("prepared successfully\n"); + + rv = con->disconnect(); + + if(rv!=OK)return 3; + printf("Disconnect successfully\n"); + + rv = stmt->execute(rows); + if(rv == OK) + { + printf("Test script failed \n"); + delete stmt; + return 4; + } + stmt->free(); + printf("Test script passed\n"); + delete stmt; + delete con; + return 0; +} diff --git a/test/adapter/Connect/conntest5.c b/test/adapter/Connect/conntest5.c new file mode 100644 index 00000000..3445e8a8 --- /dev/null +++ b/test/adapter/Connect/conntest5.c @@ -0,0 +1,95 @@ +// create table t1 ,Insert some records in it. +// Close the connection, Fetch should fail. + +#include"common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv !=OK)return 1; + printf("Connection opened\n"); + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(9));"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT);"); + + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 2; } + + rv = stmt->execute(rows); + if(rv!=OK) { delete stmt; delete con; return 3; } + stmt->free(); + printf("Table t1 CREATED\n"); + con->commit(); + // insert into statement + strcpy(statement,"INSERT INTO t1 VALUES(1,1);"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(1,1)"); + } + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + + rv = con->beginTrans(); + if(rv!=OK) { delete stmt; delete con; return 5; } + + rv = stmt->execute(rows); if(rv!=OK) return 6; + rv = con->commit(); + if(rv!=OK) return 7; + stmt->free(); + printf("One record inserted\n"); + + strcpy(statement,"SELECT f2 FROM t1 ;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"SELECT f2 FROM t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 8; } + + int id=10; + stmt->bindField(1,&id); + rv = con->beginTrans(); + if(rv!=OK)return 9; + stmt->execute(rows); + int count=0; + stmt->close(); + stmt->free(); + rv = con->disconnect(); //close the connection + + void *rettype; + if(rv!=OK)return 10; + rettype = (char*)stmt->fetch(rv); + if(rettype==NULL && rv == ErrNoConnection) { + printf("After closing the connection,fetch failed\n"); + con->connect("root", "manager"); + stmt->setConnection(con); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"DROP TABLE t1"); + } + rv = stmt->prepare(statement); + rv = stmt->execute(rows); + if(rv==OK){printf("Table Dropped successfully\n");} + stmt->free(); + con->commit(); + delete stmt; + delete con; + printf("Test script passed\n"); + return 0; + } + + printf("Test script Failed\n"); + delete stmt; + delete con; + return 11; +} + + + diff --git a/test/adapter/Connect/conntest7.c b/test/adapter/Connect/conntest7.c new file mode 100644 index 00000000..c865ab9c --- /dev/null +++ b/test/adapter/Connect/conntest7.c @@ -0,0 +1,18 @@ +//Connect with correct user name and password, it should pass. + +#include"common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK) + { + printf("Test script failed with error%d\n",rv); + return 1; + } + printf("Connection opened with correct user name and password\n"); + printf("Test script passed\n"); + delete con; + return 0; +} diff --git a/test/adapter/Connect/csql.conf b/test/adapter/Connect/csql.conf new file mode 100644 index 00000000..bf00bd57 --- /dev/null +++ b/test/adapter/Connect/csql.conf @@ -0,0 +1,158 @@ +# CSQL System Configuration File + +#####################################Server Section######################## + +# Site ID for this CSQL server +SITE_ID=1 + +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 100 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=2266 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=3366 + +#Log level 0->no logging 1->Fine 2->Finer 3->Finest +LOG_LEVEL=0 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/csql/log/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +# Whether to enable durability +DURABILITY=false + +#checkpoint server interval in seconds +CHECKPOINT_SECS=600 + +#minimum redo log size for checkpoint to be initiated +CHECKPOINT_LOG_SIZE=10485760 + +# Whether to enable memory map architecture for user database +MMAP=true + +# Specifies the durability mode for redo log generation +# Valid values are +# 1 ->uses standard redo logging with O_APPEND mode +# 2 ->uses standard logging with serialization +# 3 ->uses O_SYNC flag +# 4 ->uses O_DIRECT flag + +DURABLE_MODE=1 + +#Give full path for the database file where table and record information will +#be stored for durability +DATABASE_FILE=/tmp/csql/db + +#Important: For Server section parameters, make sure that the value is same for the server process and all the csql client process which connects to it. otherwise, behavior is undefined + +# Give full path for the std error file to store all the errors during database operations +STDERR_FILE=stderr + +#Restarts auxillary servers (SQL, Cache,etc), if they crash +MONITOR_SERVERS=false + +#####################################Client Section######################## + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=5000 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=5000 +LOCK_TIMEOUT_RETRIES=10 + +#Statement Cache Size +STMT_CACHE_SIZE=10 + +#Enable statement cache for statements with no parameters +#Only SELECT statement with no date, time, timestamp fields will be cached. +STMT_CACHE_NOPARAM=false + +#####################################Cache Section######################## + +#Whether to enable caching of tables from target database +CACHE_TABLE=false + +#DSN Name to connect to the target database. +#This should be present in ~/odbc.ini file +DSN=myodbc3 + +# Whethere to enable bidirectional updates for cached tables. +ENABLE_BIDIRECTIONAL_CACHE=false + +CACHE_RECEIVER_WAIT_SECS=10 + +#Mode of operation SYNC or ASYNC +CACHE_MODE=SYNC + +##########################SqlNetworkServer Section######################## + +# Whether to enable SqlNetwork server +CSQL_SQL_SERVER=true + +#Set port for Network access +PORT=5678 + +# Max number of seconds that the network layer waits to receive a pkt +NETWORK_RESPONSE_TIMEOUT=3 + +# Max number of seconds that the network layer waits to connect to sql server +NETWORK_CONNECT_TIMEOUT=5 + +#Whether to enable Replication across the sites +REPLICATION=false + +#No of sites to replicate +REPLICATION_SITES=16 + +#Give full path for the file where all the table information is stored +TABLE_CONFIG_FILE=/tmp/csql/csqltable.conf + +#Give full path of the file where all the DSN information is stored +DS_CONFIG_FILE=/tmp/csql/csqlds.conf + +#Give full path for the file where all the peer site information is stored +NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf + +# Give full path for conflict Resolution file +CONFL_RESOL_FILE=/tmp/csql/conflResoFile.txt + +# MSGKEY for creating msg queue for MsgQueue Server +MSG_KEY=2525 + +# Maximum message that the message queue server is able to handle for +# asynchronous updates. This value is is default value of 'kernel.msgmax' +# parameter. +ASYNC_MSGMAX=8192 + +# Maximum number of messages that the message queue server will hold for a site +# that is down in the replication group. +MAX_QUEUE_LOGS=100 + +# Shared memory key for id generators +ID_SHM_KEY=1947 + +#####################################End Section######################## diff --git a/test/adapter/Connect/exp.test010 b/test/adapter/Connect/exp.test010 new file mode 100644 index 00000000..77af4878 --- /dev/null +++ b/test/adapter/Connect/exp.test010 @@ -0,0 +1,9 @@ +Connection opened +Table t1 CREATED +One record inserted +update t1 set f2=100 +One row updated +f2= 100 +Total reccord fetchec=1 +TABLE t1 DROPPED SUCCESSFULLY +Connection closed successfully diff --git a/test/adapter/Connect/exp.test011 b/test/adapter/Connect/exp.test011 new file mode 100644 index 00000000..295230e9 --- /dev/null +++ b/test/adapter/Connect/exp.test011 @@ -0,0 +1,6 @@ +Connection opened +Table t1 CREATED +1 Record inserted +1 Record updated +Total record fetched =0 ,Because transaction rollbacked +Table droped diff --git a/test/adapter/Connect/exp.test012 b/test/adapter/Connect/exp.test012 new file mode 100644 index 00000000..c36527b4 --- /dev/null +++ b/test/adapter/Connect/exp.test012 @@ -0,0 +1,5 @@ +Connection opened +Table t1 CREATED +Primary Key Testing Starts Here +Primary key in table t1 is f1 +Table droped diff --git a/test/adapter/Connect/test001na.ksh b/test/adapter/Connect/test001na.ksh new file mode 100755 index 00000000..22fb44eb --- /dev/null +++ b/test/adapter/Connect/test001na.ksh @@ -0,0 +1,37 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Connect/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Connect +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/conntest1na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Connect/test002na.ksh b/test/adapter/Connect/test002na.ksh new file mode 100755 index 00000000..c5b79c29 --- /dev/null +++ b/test/adapter/Connect/test002na.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Connect/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Connect +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT=6002 >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/conntest2na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi + +kill -9 $pid +exit 0; diff --git a/test/adapter/Connect/test003na.ksh b/test/adapter/Connect/test003na.ksh new file mode 100755 index 00000000..fb9e2ca9 --- /dev/null +++ b/test/adapter/Connect/test003na.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Connect/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Connect +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT=6003 >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/conntest3na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi + +kill -9 $pid +exit 0; diff --git a/test/adapter/Connect/test004na.ksh b/test/adapter/Connect/test004na.ksh new file mode 100755 index 00000000..c4dd9c57 --- /dev/null +++ b/test/adapter/Connect/test004na.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Connect/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Connect +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT=6004 >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/conntest4na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi + +kill -9 $pid +exit 0; diff --git a/test/adapter/Connect/test005na.ksh b/test/adapter/Connect/test005na.ksh new file mode 100755 index 00000000..7a5597fe --- /dev/null +++ b/test/adapter/Connect/test005na.ksh @@ -0,0 +1,39 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Connect/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Connect +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT=6005 >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/conntest5na +echo $? +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi + +kill -9 $pid +exit 0; diff --git a/test/adapter/Connect/test007na.ksh b/test/adapter/Connect/test007na.ksh new file mode 100755 index 00000000..1fb25636 --- /dev/null +++ b/test/adapter/Connect/test007na.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Connect/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Connect +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT=6007 >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +${REL_PATH}/conntest7na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi + +kill -9 $pid +exit 0; diff --git a/test/adapter/Connect/test010na.ksh b/test/adapter/Connect/test010na.ksh new file mode 100755 index 00000000..5a261ea6 --- /dev/null +++ b/test/adapter/Connect/test010na.ksh @@ -0,0 +1,38 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Connect/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Connect +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT=6010 >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/conntest10na +if [ $? -ne 0 ] +then +# kill -9 $pid + exit 1; +fi + +#kill -9 $pid +exit 0; diff --git a/test/adapter/Connect/test011na.ksh b/test/adapter/Connect/test011na.ksh new file mode 100755 index 00000000..feb65ac0 --- /dev/null +++ b/test/adapter/Connect/test011na.ksh @@ -0,0 +1,41 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Connect/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Connect +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT=6011 >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/conntest11na +if [ $? -ne 0 ] +then +# kill -9 $pid +# kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'` + exit 1; +fi +rm -f /tmp/csql.conf +#kill -9 $pid +#ipcrm -M 2266 -M 3366 +#kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'` +exit 0; diff --git a/test/adapter/Makefile b/test/adapter/Makefile new file mode 100644 index 00000000..612f66ae --- /dev/null +++ b/test/adapter/Makefile @@ -0,0 +1,18 @@ +OSNAME = $(shell uname -s) +MAKE=gmake + +buildall: + @for i in *; \ + do \ + if [ -d $$i ];\ + then cd $$i; $(MAKE); cd ..;\ + fi;\ + done + +clean: + @for i in *; \ + do \ + if [ -d $$i ];\ + then cd $$i; $(MAKE) clean; cd ..;\ + fi;\ + done diff --git a/test/adapter/Parameter/Makefile b/test/adapter/Parameter/Makefile new file mode 100644 index 00000000..f72b2138 --- /dev/null +++ b/test/adapter/Parameter/Makefile @@ -0,0 +1,67 @@ +OSNAME = $(shell uname -s) +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + + +INCL= -I$(CSQL_INSTALL_ROOT)/install/include -I../../../include +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcsqlgw -lcsqlnw -lcsqlodbcadapter -lcsqlsqlnw -lcacheload -lcsql -lcsqlsql -lcsqlsqllog + +TARGETS = \ + test001 paratest1na\ + test002 paratest2na\ + test003 paratest3na\ + test004 paratest4na\ + test005 paratest5na\ + test006 paratest6na + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +test001:paratest1.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +paratest1na:paratest1.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test002:paratest2.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +paratest2na:paratest2.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test003:paratest3.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +paratest3na:paratest3.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004:paratest4.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +paratest4na:paratest4.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005:paratest5.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +paratest5na:paratest5.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test006:paratest6.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +paratest6na:paratest6.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) + +clean: + rm -f *.o ${TARGETS} diff --git a/test/adapter/Parameter/common.h b/test/adapter/Parameter/common.h new file mode 100644 index 00000000..b4f0c640 --- /dev/null +++ b/test/adapter/Parameter/common.h @@ -0,0 +1,39 @@ +#include +#include +#include +#include +#include + +AbsSqlConnection *createConnection() +{ +#ifdef NETWORK + AbsSqlConnection *con = SqlFactory::createConnection(CSqlNetwork); + SqlNwConnection *conn = (SqlNwConnection *) con; + conn->setHost("localhost", 5678); +#elif defined NETWORKADAPTER + AbsSqlConnection *con = SqlFactory::createConnection(CSqlNetworkAdapter); + SqlNwConnection *conn = (SqlNwConnection *) con; + conn->setHost("localhost", 5678); +#elif defined NETWORKGATEWAY + AbsSqlConnection *con = SqlFactory::createConnection(CSqlNetworkGateway); + SqlNwConnection *conn = (SqlNwConnection *) con; + conn->setHost("localhost", 5678); +#else + AbsSqlConnection *con = SqlFactory::createConnection(CSqlAdapter); +#endif + return con; +} + +AbsSqlStatement *createStatement() +{ +#ifdef NETWORK + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlNetwork); +#elif defined NETWORKADAPTER + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlNetworkAdapter); +#elif defined NETWORKGATEWAY + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlNetworkGateway); +#else + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlAdapter); +#endif + return stmt; +} diff --git a/test/adapter/Parameter/csql.conf b/test/adapter/Parameter/csql.conf new file mode 100644 index 00000000..cc17eb3c --- /dev/null +++ b/test/adapter/Parameter/csql.conf @@ -0,0 +1,106 @@ +# CSQL System Configuration File + +#####################################Server Section######################## +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 100 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=2244 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=3344 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/csql/log/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +# Whether to enable durability +DURABILITY=false + +#Give full path for the database file where table and record information will +#be stored for durability +DATABASE_FILE=/tmp/csql/db + +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined +#####################################Client Section######################## + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=5000 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=5000 +LOCK_TIMEOUT_RETRIES=10 + +#####################################Cache Section######################## + +#Whether to enable caching of tables from target database +CACHE_TABLE=false + +#Set cache id for multiple bidirectional cache node for single data source +SITE_ID=1 + +# Name of Target Database (mysql ,postgres, oracle etc...) +TARGET_DATABASE=mysql +#DSN Name to connect to the target database. +#This should be present in ~/odbc.ini file +DSN=myodbc3 + +DBUSER= + +PASSWORD= + +ENABLE_BIDIRECTIONAL_CACHE=false + +CACHE_RECEIVER_WAIT_SECS=10 + +#Give full path for the file where all the cached table information is stored +TABLE_CONFIG_FILE=/tmp/csql/csqltable.conf + +#Mode of operation SYNC or ASYNC +CACHE_MODE=SYNC + +##########################SqlNetworkServer Section######################## + +# Whether to enable SqlNetwork server +CSQL_SQL_SERVER=true + +#Set port for Network access +PORT=5678 + +#Whether to enable Replication across the sites +REPLICATION=false + +#No of sites to replicate +REPLICATION_SITES=16 + +#Give full path for the file where all the peer site information is stored +NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf + +# MSGKEY for creating msg queue for MsgQueue Server +MSG_KEY=2525 + +ID_SHM_KEY=1947 +#####################################End Section######################## diff --git a/test/adapter/Parameter/exp.test001 b/test/adapter/Parameter/exp.test001 new file mode 100644 index 00000000..b8fcf8f7 --- /dev/null +++ b/test/adapter/Parameter/exp.test001 @@ -0,0 +1,125 @@ +Table created +noOfParamField Returns=10 + +*********************************************** +0 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +1 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +2 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +3 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +4 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +5 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +6 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +7 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +8 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +9 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** +Total rows inserted 10 +f1=0 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=1 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=2 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=3 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=4 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=5 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=6 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=7 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=8 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=9 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +Total row fetched=10 +Table dropped diff --git a/test/adapter/Parameter/exp.test001na.ksh b/test/adapter/Parameter/exp.test001na.ksh new file mode 100644 index 00000000..b8fcf8f7 --- /dev/null +++ b/test/adapter/Parameter/exp.test001na.ksh @@ -0,0 +1,125 @@ +Table created +noOfParamField Returns=10 + +*********************************************** +0 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +1 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +2 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +3 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +4 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +5 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +6 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +7 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +8 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** + +*********************************************** +9 FIELD INFORMATION :: +Field Name : +Data type of the field :30 +length of the field :512 +Offset :0 +Default value : +Null field :0 +Default value :0 +*********************************************** +Total rows inserted 10 +f1=0 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=1 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=2 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=3 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=4 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=5 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=6 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=7 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=8 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +f1=9 | f2=10 | f3=jitendra | f4=5.500000 | f5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | f9=20 | f10=12000 +Total row fetched=10 +Table dropped diff --git a/test/adapter/Parameter/exp.test002 b/test/adapter/Parameter/exp.test002 new file mode 100644 index 00000000..386e896d --- /dev/null +++ b/test/adapter/Parameter/exp.test002 @@ -0,0 +1,14 @@ +Table created +Total rows inserted 10 +F1=101 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=102 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=103 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=104 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=105 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=106 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=107 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=108 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=109 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=110 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +10 Tuples fetched +Table dropped diff --git a/test/adapter/Parameter/exp.test002na.ksh b/test/adapter/Parameter/exp.test002na.ksh new file mode 100644 index 00000000..386e896d --- /dev/null +++ b/test/adapter/Parameter/exp.test002na.ksh @@ -0,0 +1,14 @@ +Table created +Total rows inserted 10 +F1=101 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=102 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=103 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=104 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=105 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=106 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=107 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=108 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=109 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=110 | F2=10 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +10 Tuples fetched +Table dropped diff --git a/test/adapter/Parameter/exp.test003 b/test/adapter/Parameter/exp.test003 new file mode 100644 index 00000000..e19da096 --- /dev/null +++ b/test/adapter/Parameter/exp.test003 @@ -0,0 +1,10 @@ +Table T1 created +Total rows inserted 10 +Total row deleted=5 +F1=0 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=1 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=2 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=3 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=4 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +Total row fetched=5 +Table dropped diff --git a/test/adapter/Parameter/exp.test003na.ksh b/test/adapter/Parameter/exp.test003na.ksh new file mode 100644 index 00000000..e19da096 --- /dev/null +++ b/test/adapter/Parameter/exp.test003na.ksh @@ -0,0 +1,10 @@ +Table T1 created +Total rows inserted 10 +Total row deleted=5 +F1=0 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=1 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=2 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=3 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +F1=4 | F2=1 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2007-1-21 | TIME=12:29:30 | TIMESTAMP=2007-1-21 12:29:30 | F9=20 | F10=12000 +Total row fetched=5 +Table dropped diff --git a/test/adapter/Parameter/exp.test004 b/test/adapter/Parameter/exp.test004 new file mode 100644 index 00000000..53624343 --- /dev/null +++ b/test/adapter/Parameter/exp.test004 @@ -0,0 +1,17 @@ +Table created +10 Rows inserted +noOfParamFields return=7 +5 Rows updated +F1=0 | F2=11 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=1 | F2=12 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=2 | F2=13 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=3 | F2=14 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=4 | F2=15 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 + +F1=5 | F2=16 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=6 | F2=17 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=7 | F2=18 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=8 | F2=19 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=9 | F2=20 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +10 Rows fetched +Table dropped diff --git a/test/adapter/Parameter/exp.test004.psql b/test/adapter/Parameter/exp.test004.psql new file mode 100644 index 00000000..c4c9e899 --- /dev/null +++ b/test/adapter/Parameter/exp.test004.psql @@ -0,0 +1,17 @@ +Table created +10 Rows inserted +noOfParamFields return=7 +5 Rows updated + +F1=5 | F2=16 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=6 | F2=17 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=7 | F2=18 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=8 | F2=19 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=9 | F2=20 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=0 | F2=11 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=1 | F2=12 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=2 | F2=13 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=3 | F2=14 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=4 | F2=15 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +10 Rows fetched +Table dropped diff --git a/test/adapter/Parameter/exp.test004na.ksh b/test/adapter/Parameter/exp.test004na.ksh new file mode 100644 index 00000000..53624343 --- /dev/null +++ b/test/adapter/Parameter/exp.test004na.ksh @@ -0,0 +1,17 @@ +Table created +10 Rows inserted +noOfParamFields return=7 +5 Rows updated +F1=0 | F2=11 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=1 | F2=12 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=2 | F2=13 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=3 | F2=14 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=4 | F2=15 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 + +F1=5 | F2=16 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=6 | F2=17 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=7 | F2=18 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=8 | F2=19 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=9 | F2=20 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +10 Rows fetched +Table dropped diff --git a/test/adapter/Parameter/exp.test004na.ksh.psql b/test/adapter/Parameter/exp.test004na.ksh.psql new file mode 100644 index 00000000..c4c9e899 --- /dev/null +++ b/test/adapter/Parameter/exp.test004na.ksh.psql @@ -0,0 +1,17 @@ +Table created +10 Rows inserted +noOfParamFields return=7 +5 Rows updated + +F1=5 | F2=16 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=6 | F2=17 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=7 | F2=18 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=8 | F2=19 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=9 | F2=20 | F3=jitendra | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=0 | F2=11 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=1 | F2=12 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=2 | F2=13 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=3 | F2=14 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +F1=4 | F2=15 | F3=lakshya | F4=11.220000 | F5=20.250000 | DATE=2007-3-30 | TIME=12:29:30 | TIMESTAMP=2007-3-30 10:25:55 | F9=20 | F10=15000 +10 Rows fetched +Table dropped diff --git a/test/adapter/Parameter/exp.test005 b/test/adapter/Parameter/exp.test005 new file mode 100644 index 00000000..b7c968fa --- /dev/null +++ b/test/adapter/Parameter/exp.test005 @@ -0,0 +1,24 @@ +Table T1 created +Total rows inserted 20 +F1=0 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=1 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=2 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=3 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=4 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=5 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=6 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=7 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=8 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=9 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=0 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=1 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=2 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=3 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=4 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=5 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=6 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=7 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=8 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=9 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +Total row fetched=20 +Table dropped diff --git a/test/adapter/Parameter/exp.test005na.ksh b/test/adapter/Parameter/exp.test005na.ksh new file mode 100644 index 00000000..b7c968fa --- /dev/null +++ b/test/adapter/Parameter/exp.test005na.ksh @@ -0,0 +1,24 @@ +Table T1 created +Total rows inserted 20 +F1=0 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=1 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=2 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=3 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=4 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=5 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=6 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=7 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=8 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=9 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=0 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=1 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=2 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=3 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=4 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=5 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=6 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=7 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=8 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +F1=9 | F2=1 | F3=jitendra | F4=5.500000 | F5=NULL | F6=2007-01-21 | F7=NULL | F8=2007-1-21 12:29:30 | F9=20 | F10=12000 | +Total row fetched=20 +Table dropped diff --git a/test/adapter/Parameter/exp.test006 b/test/adapter/Parameter/exp.test006 new file mode 100644 index 00000000..35f4f1ce --- /dev/null +++ b/test/adapter/Parameter/exp.test006 @@ -0,0 +1,16 @@ +Table created +10 Rows inserted +noOfParamFields return=7 +5 Rows updated +F1=0 | F2=11 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=1 | F2=12 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=2 | F2=13 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=3 | F2=14 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=4 | F2=15 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=5 | F2=16 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=6 | F2=17 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=7 | F2=18 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=8 | F2=19 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=9 | F2=20 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +Rows fetched=10 +Table dropped diff --git a/test/adapter/Parameter/exp.test006.psql b/test/adapter/Parameter/exp.test006.psql new file mode 100644 index 00000000..85095411 --- /dev/null +++ b/test/adapter/Parameter/exp.test006.psql @@ -0,0 +1,16 @@ +Table created +10 Rows inserted +noOfParamFields return=7 +5 Rows updated +F1=5 | F2=16 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=6 | F2=17 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=7 | F2=18 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=8 | F2=19 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=9 | F2=20 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=0 | F2=11 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=1 | F2=12 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=2 | F2=13 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=3 | F2=14 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=4 | F2=15 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +Rows fetched=10 +Table dropped diff --git a/test/adapter/Parameter/exp.test006na.ksh b/test/adapter/Parameter/exp.test006na.ksh new file mode 100644 index 00000000..35f4f1ce --- /dev/null +++ b/test/adapter/Parameter/exp.test006na.ksh @@ -0,0 +1,16 @@ +Table created +10 Rows inserted +noOfParamFields return=7 +5 Rows updated +F1=0 | F2=11 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=1 | F2=12 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=2 | F2=13 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=3 | F2=14 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=4 | F2=15 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=5 | F2=16 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=6 | F2=17 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=7 | F2=18 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=8 | F2=19 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=9 | F2=20 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +Rows fetched=10 +Table dropped diff --git a/test/adapter/Parameter/exp.test006na.ksh.psql b/test/adapter/Parameter/exp.test006na.ksh.psql new file mode 100644 index 00000000..85095411 --- /dev/null +++ b/test/adapter/Parameter/exp.test006na.ksh.psql @@ -0,0 +1,16 @@ +Table created +10 Rows inserted +noOfParamFields return=7 +5 Rows updated +F1=5 | F2=16 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=6 | F2=17 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=7 | F2=18 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=8 | F2=19 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=9 | F2=20 | F3=jitendra | F4=5.500000 | F5=10.500000 | F6=2008-01-21 | F7=12:29:30 | F8=2008-1-21 12:29:30 | F9=20 | F10=12000 | +F1=0 | F2=11 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=1 | F2=12 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=2 | F2=13 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=3 | F2=14 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +F1=4 | F2=15 | F3=NULL | F4=11.220000 | F5=20.250000 | F6=NULL | F7=12:29:30 | F8=2007-3-30 10:25:55 | F9=20 | F10=15000 | +Rows fetched=10 +Table dropped diff --git a/test/adapter/Parameter/paratest1.c b/test/adapter/Parameter/paratest1.c new file mode 100644 index 00000000..a32b27a8 --- /dev/null +++ b/test/adapter/Parameter/paratest1.c @@ -0,0 +1,245 @@ +/* create table t1 with 10 fields. + * insert some records into it. + * noOfParamFields() should return 10. + * getParamFldInfo() for all fields and print the field info. + * select * from t1; + + * Author : Jitendra Lenka. + */ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con= createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(4),f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f8 TIMESTAMP,f9 number(9),f10 number(18));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT4,f5 FLOAT4,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 DATETIME,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + con->commit(); + stmt->free(); + printf("Table created\n"); + + // insert into table + int para=0; + if(strcmp(getenv("DSN"),"oracle")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?);"); + para=8; + } + else if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?)"); + para=9; + } + else{ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?);"); + para=9; + } + int f1var = 100; + short int f2var = 10; + char f3var[32]="jitendra"; + float f4var = 5.5; + float f5var = 10.50; + Date f6var; + f6var.set(2007,01,21); + + Time f7var; + f7var.set(12,29,30); + + TimeStamp f8var; + f8var.setDate(2007,01,21); + f8var.setTime(12,29,30); + + int f9var = 20; + long long f10var = 12000; + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 4; + } +//****************************************************************************** + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + int nop; + nop = stmt->noOfParamFields(); + printf("noOfParamField Returns=%d\n",nop); + + + //getParamFldInfo() + FieldInfo *field = new FieldInfo(); + + + char fldName[20]; + DataType type; + size_t length; + int offset; + char defaultValueBuf[10]; + bool isNull; + bool isDefault; + + for(int i=0;i<=para;i++) + { + printf("\n***********************************************\n"); + printf("%d FIELD INFORMATION ::\n",i);; + rv = stmt->getParamFldInfo(i+1,field); + if(rv!=OK)return 1; + printf("Field Name :%s\n", field->fldName); + printf("Data type of the field :%d\n",field->type); + printf("length of the field :%d\n",field->length); + printf("Offset :%d\n",field->offset); + printf("Default value :%s\n",field->defaultValueBuf); + printf("Null field :%d\n",field->isNull); + printf("Default value :%d\n",field->isDefault); + printf("***********************************************\n"); + } + + int count=0; + + for(int i=0;i<10;i++) + { + rv = con->beginTrans(); + if(rv!=OK) break; + f1var=i; + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + stmt->setStringParam(3,f3var); + stmt->setFloatParam(4,f4var); + stmt->setFloatParam(5,f5var); + stmt->setDateParam(6,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + }else{ + stmt->setTimeParam(7,f7var); + stmt->setTimeStampParam(8,f8var); + stmt->setIntParam(9,f9var); + stmt->setLongLongParam(10,f10var); + } + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("Total rows inserted %d\n",count); + + stmt->free(); + + //********************************************************** + + // SELECT * FROM t1; + + strcpy(statement,"SELECT * FROM t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"SELECT * FROM t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 5; + } + + stmt->bindField(1,&f1var); + stmt->bindField(2,&f2var); + stmt->bindField(3,f3var); + stmt->bindField(4,&f4var); + stmt->bindField(5,&f5var); + stmt->bindField(6,&f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->bindField(7,&f8var); + stmt->bindField(8,&f9var); + stmt->bindField(9,&f10var); + + }else{ + stmt->bindField(7,&f7var); + stmt->bindField(8,&f8var); + stmt->bindField(9,&f9var); + stmt->bindField(10,&f10var); + } + + count=0; + rv = con->beginTrans(); + if(rv!=OK)return 6; + stmt->execute(rows); + while(stmt->fetch() !=NULL) + { + if(strcmp(getenv("DSN"),"oracle")==0) + printf("f1=%d | f2=%hd | f3=%s | f4=%f | f5=%f | DATE=%d-%d-%d | TIMESTAMP=%d-%d-%d %d:%d:%d | f9=%d | f10=%lld\n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + else + printf("f1=%d | f2=%hd | f3=%s | f4=%f | f5=%f | DATE=%d-%d-%d | TIME=%d:%d:%d | TIMESTAMP=%d-%d-%d %d:%d:%d | f9=%d | f10=%lld\n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f7var.hours(),f7var.minutes(),f7var.seconds(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + count++; + } + + stmt->close(); + rv = con->commit(); + if(rv !=OK) + { + delete stmt; + delete con; + return 7; + } + + printf("Total row fetched=%d\n",count); + stmt->free(); + + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"DROP TABLE t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 8; + } + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 9; + } + stmt->free(); + printf("Table dropped\n"); + con->commit(); + delete stmt; + delete con; + return 0; +} diff --git a/test/adapter/Parameter/paratest2.c b/test/adapter/Parameter/paratest2.c new file mode 100644 index 00000000..36dce0d2 --- /dev/null +++ b/test/adapter/Parameter/paratest2.c @@ -0,0 +1,235 @@ +/* create table T1 with 10 fields. + * insert some records into it. + * select * from T1 with where clause; +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con= createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(4),f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f8 TIMESTAMP,f9 number(9),f10 number(18));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT4,f5 FLOAT4,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 DATETIME,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + con->commit(); + stmt->free(); + printf("Table created\n"); + + // insert into table + if(strcmp(getenv("DSN"),"oracle")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?);"); + } + else if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?)"); + } + else{ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?);"); + } + + int f1var = 100; + short int f2var = 10; + char f3var[35]="jitendra"; + float f4var = 5.5; + float f5var = 10.50; + Date f6var; + f6var.set(2007,01,21); + + Time f7var; + f7var.set(12,29,30); + + TimeStamp f8var; + f8var.setDate(2007,01,21); + f8var.setTime(12,29,30); + + int f9var = 20; + long long f10var = 12000; + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + + + int count=0; + + for(int i=0;i<10;i++) + { + rv = con->beginTrans(); + if(rv!=OK) break; + f1var++; + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + stmt->setStringParam(3,f3var); + stmt->setFloatParam(4,f4var); + stmt->setFloatParam(5,f5var); + stmt->setDateParam(6,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + }else{ + stmt->setTimeParam(7,f7var); + stmt->setTimeStampParam(8,f8var); + stmt->setIntParam(9,f9var); + stmt->setLongLongParam(10,f10var); + } + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("Total rows inserted %d\n",count); + + + stmt->free(); + + //********************************************************** + + // SELECT * FROM T1; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"SELECT * FROM t1 WHERE F1=? AND F2=? AND F3=? AND F4=? AND F5=? AND F6=? AND F8=? AND F9=? AND F10=?;"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"SELECT * FROM t1 WHERE f1=? AND f2=? AND f3=? AND f4=? AND f5=? AND f6=? AND f7=? AND f8=? AND f9=? AND f10=?;"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT * FROM t1 WHERE f1=? AND f2=? AND f3=? AND f4=? AND f5=? AND f6=? AND f7=? AND f8=? AND f9=? AND f10=?"); + else + strcpy(statement,"SELECT * FROM t1 WHERE F1=? AND F2=? AND F3=? AND F4=? AND F5=? AND F6=? AND F7=? AND F8=? AND F9=? AND F10=?;"); + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 4; + } + + stmt->bindField(1,&f1var); + stmt->bindField(2,&f2var); + stmt->bindField(3,f3var); + stmt->bindField(4,&f4var); + stmt->bindField(5,&f5var); + stmt->bindField(6,&f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->bindField(7,&f8var); + stmt->bindField(8,&f9var); + stmt->bindField(9,&f10var); + + }else{ + stmt->bindField(7,&f7var); + stmt->bindField(8,&f8var); + stmt->bindField(9,&f9var); + stmt->bindField(10,&f10var); + } + + int f1var1=100; + short int f2var1=10; + char f3var1[35]="jitendra"; + float f4var1=5.5; + float f5var1=10.50; + Date f6var1; + f6var1.set(2007,01,21); + + Time f7var1; + f7var1.set(12,29,30); + + TimeStamp f8var1; + f8var1.setDate(2007,01,21); + f8var1.setTime(12,29,30); + + int f9var1=20; + long long f10var1=12000; + count=0; + for(int i=0;i<10;i++) + { + rv = con->beginTrans(); + if(rv!=OK)break; + + f1var1++; + stmt->setIntParam(1,f1var1); + stmt->setShortParam(2,f2var1); + stmt->setStringParam(3,f3var1); + stmt->setFloatParam(4,f4var1); + stmt->setFloatParam(5,f5var1); + stmt->setDateParam(6,f6var1); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var1); + stmt->setIntParam(8,f9var1); + stmt->setLongLongParam(9,f10var1); + }else{ + stmt->setTimeParam(7,f7var1); + stmt->setTimeStampParam(8,f8var1); + stmt->setIntParam(9,f9var1); + stmt->setLongLongParam(10,f10var1); + } + + + stmt->execute(rows); + + while(stmt->fetch()!=NULL) + { + if(strcmp(getenv("DSN"),"oracle")==0) + printf("F1=%d | F2=%hd | F3=%s | F4=%f | F5=%f | DATE=%d-%d-%d | TIMESTAMP=%d-%d-%d %d:%d:%d | F9=%d | F10=%lld \n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + else + printf("F1=%d | F2=%hd | F3=%s | F4=%f | F5=%f | DATE=%d-%d-%d | TIME=%d:%d:%d | TIMESTAMP=%d-%d-%d %d:%d:%d | F9=%d | F10=%lld \n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f7var.hours(),f7var.minutes(),f7var.seconds(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + + count++; + } + stmt->close(); + rv = con->commit(); + if(rv!=OK)return 5; + } + stmt->free(); + + printf("%d Tuples fetched\n",count); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"DROP TABLE t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK){delete stmt; delete con; return -1;} + + rv = stmt->execute(rows); + if(rv!=OK){delete stmt;delete con;return -1;} + stmt->free(); + con->commit(); + printf("Table dropped\n"); + + delete stmt; + delete con; + return 0; +} diff --git a/test/adapter/Parameter/paratest3.c b/test/adapter/Parameter/paratest3.c new file mode 100644 index 00000000..33e71d67 --- /dev/null +++ b/test/adapter/Parameter/paratest3.c @@ -0,0 +1,296 @@ +/* create table T1 with 10 fields. + * insert some records into it. + * delete records from T1 with where clause + * select * from T1; +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(4),f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f8 TIMESTAMP,f9 number(9),f10 number(18));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT4,f5 FLOAT4,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 DATETIME,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + con->commit(); + + stmt->free(); + printf("Table T1 created\n"); + + // insert into table + + if(strcmp(getenv("DSN"),"oracle")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?);"); + } + else if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?)"); + } + else{ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?);"); + } + + int f1var = 0; + short int f2var = 1; + char f3var[35]="jitendra"; + float f4var = 5.5; + float f5var = 10.50; + Date f6var; + f6var.set(2007,01,21); + + Time f7var; + f7var.set(12,29,30); + + TimeStamp f8var; + f8var.setDate(2007,01,21); + f8var.setTime(12,29,30); + + int f9var = 20; + long long f10var = 12000; + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 4; + } + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + + + int count=0; + + for(int i=0;i<10;i++) + { + rv = con->beginTrans(); + if(rv!=OK) break; + f1var=i; + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + stmt->setStringParam(3,f3var); + stmt->setFloatParam(4,f4var); + stmt->setFloatParam(5,f5var); + stmt->setDateParam(6,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + }else{ + stmt->setTimeParam(7,f7var); + stmt->setTimeStampParam(8,f8var); + stmt->setIntParam(9,f9var); + stmt->setLongLongParam(10,f10var); + } + + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("Total rows inserted %d\n",count); + + + stmt->free(); + //********************************************************* + + // delete records from the T1 + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"DELETE FROM t1 WHERE F10=? AND F9=? AND F8=? AND F6=? AND F5=? AND F4=? AND F3=? AND F2=? AND F1=?;"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"DELETE FROM t1 WHERE f10=? AND f9=? AND f8=? AND f7=? AND f6=? AND f5=? AND f4=? AND f3=? AND f2=? AND f1=?;"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DELETE FROM t1 WHERE f10=? AND f9=? AND f8=? AND f7=? AND f6=? AND f5=? AND f4=? AND f3=? AND f2=? AND f1=?"); + else + strcpy(statement,"DELETE FROM t1 WHERE F10=? AND F9=? AND F8=? AND F7=? AND F6=? AND F5=? AND F4=? AND F3=? AND F2=? AND F1=?;"); + + rv = stmt->prepare(statement); + if(rv!=OK){delete stmt;delete con;return -1;} + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + + + /* stmt->bindField(1,&f10var); + stmt->bindField(2,&f9var); + stmt->bindField(3,&f8var); + stmt->bindField(4,&f7var); + stmt->bindField(5,&f6var); + stmt->bindField(6,&f5var); + stmt->bindField(7,&f4var); + stmt->bindField(8,f3var); + stmt->bindField(9,&f2var); + stmt->bindField(10,&f1var);*/ + + short int f2var1=1; + char f3var1[20] ="jitendra"; + float f4var1 = 5.5; + float f5var1 = 10.50; + Date f6var1; + f6var1.set(2007,1,21); + + Time f7var1; + f7var1.set(12,29,30); + + TimeStamp f8var1; + f8var1.setDate(2007,1,21); + f8var1.setTime(12,29,30); + + int f9var1=20; + long long f10var1=12000; + count=0; + + for(int i=5;i<10;i++) + { + rv = con->beginTrans(); + if(rv!=OK)break; + + stmt->setLongLongParam(1,f10var1); + stmt->setIntParam(2,f9var1); + stmt->setTimeStampParam(3,f8var1); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setDateParam(4,f6var1); + stmt->setFloatParam(5,f5var1); + stmt->setFloatParam(6,f4var1); + stmt->setStringParam(7,f3var1); + stmt->setShortParam(8,f2var1); + stmt->setIntParam(9,i); + }else{ + stmt->setTimeParam(4,f7var1); + stmt->setDateParam(5,f6var1); + stmt->setFloatParam(6,f5var1); + stmt->setFloatParam(7,f4var1); + stmt->setStringParam(8,f3var1); + stmt->setShortParam(9,f2var1); + stmt->setIntParam(10,i); + + } + + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + stmt->free(); + printf("Total row deleted=%d\n",count); + + + + + //********************************************************** + + // SELECT * FROM T1; + strcpy(statement,"SELECT * FROM t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"SELECT * FROM t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 5; + } + + stmt->bindField(1,&f1var); + stmt->bindField(2,&f2var); + stmt->bindField(3,f3var); + stmt->bindField(4,&f4var); + stmt->bindField(5,&f5var); + stmt->bindField(6,&f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->bindField(7,&f8var); + stmt->bindField(8,&f9var); + stmt->bindField(9,&f10var); + + }else{ + stmt->bindField(7,&f7var); + stmt->bindField(8,&f8var); + stmt->bindField(9,&f9var); + stmt->bindField(10,&f10var); + } + count=0; + rv = con->beginTrans(); + if(rv!=OK)return 6; + stmt->execute(rows); + while(stmt->fetch() !=NULL) + { + if(strcmp(getenv("DSN"),"oracle")==0) + printf("F1=%d | F2=%hd | F3=%s | F4=%f | F5=%f | DATE=%d-%d-%d | TIMESTAMP=%d-%d-%d %d:%d:%d | F9=%d | F10=%lld \n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + else + printf("F1=%d | F2=%hd | F3=%s | F4=%f | F5=%f | DATE=%d-%d-%d | TIME=%d:%d:%d | TIMESTAMP=%d-%d-%d %d:%d:%d | F9=%d | F10=%lld \n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f7var.hours(),f7var.minutes(),f7var.seconds(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + + count++; + } + + stmt->close(); + rv = con->commit(); + if(rv !=OK) + { + delete stmt; + delete con; + return 7; + } + + printf("Total row fetched=%d\n",count); + stmt->free(); + + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0){ + strcpy(statement,"DROP TABLE t1"); + } + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 8; + } + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 9; + } + stmt->free(); + printf("Table dropped\n"); + con->commit(); + + delete stmt; + delete con; + return 0; +} diff --git a/test/adapter/Parameter/paratest4.c b/test/adapter/Parameter/paratest4.c new file mode 100644 index 00000000..2406071a --- /dev/null +++ b/test/adapter/Parameter/paratest4.c @@ -0,0 +1,270 @@ +/* create table T1 with 10 fields. + * insert some records into it. + * update T1 WITH ALL 7 PARAMETERS. + noOfParamFields() should return 7. + * select * from T1; +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(4),f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f8 TIMESTAMP,f9 number(9),f10 number(18));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT4,f5 FLOAT4,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 DATETIME,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + con->commit(); + stmt->free(); + printf("Table created\n"); + + // insert into table + if(strcmp(getenv("DSN"),"oracle")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?);"); + } + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?)"); + else{ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?);"); + } + + int f1var = 0; + short int f2var = 10; + char f3var[35]="jitendra"; + float f4var = 5.5; + float f5var = 10.50; + Date f6var; + f6var.set(2008,01,21); + + Time f7var; + f7var.set(12,29,30); + + TimeStamp f8var; + f8var.setDate(2008,01,21); + f8var.setTime(12,29,30); + + int f9var = 20; + long long f10var = 12000; + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + + + int count=0; + + for(int i=0;i<10;i++) + { + rv = con->beginTrans(); + if(rv!=OK) break; + f1var=i; + f2var++; + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + stmt->setStringParam(3,f3var); + stmt->setFloatParam(4,f4var); + stmt->setFloatParam(5,f5var); + stmt->setDateParam(6,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + }else{ + stmt->setTimeParam(7,f7var); + stmt->setTimeStampParam(8,f8var); + stmt->setIntParam(9,f9var); + stmt->setLongLongParam(10,f10var); + } + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("%d Rows inserted \n",count); + + + stmt->free(); + + //********************************************************** + // UPDATE TABLE + if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"UPDATE t1 SET f10=?,f8=?,f6=?,f5=?,f4=?,f3=? WHERE f1=?;"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"UPDATE t1 SET f10=?,f8=?,f6=?,f5=?,f4=?,f3=? WHERE f1=?"); + else + strcpy(statement,"UPDATE t1 SET F10=?,F8=?,F6=?,F5=?,F4=?,F3=? WHERE F1=?;"); + rv = stmt->prepare(statement); + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + + + int nop; + nop = stmt->noOfParamFields(); + printf("noOfParamFields return=%d\n",nop); + if(nop!=7)return 4; + + long long f10var1=15000; + TimeStamp f8var1; + f8var1.setDate(2007,3,30); + f8var1.setTime(10,25,55); + + Date f6var1; + f6var1.set(2007,3,30); + + float f5var1=20.25; + float f4var1=11.22; + char f3var1[10]="lakshya"; + + int f1var1; + count=0; + + for(int i=0;i<5;i++) + { + + rv = con->beginTrans(); + if(rv!=OK)break; + + f1var1=i; + stmt->setIntParam(7,f1var1); + stmt->setLongLongParam(1,f10var1); + stmt->setTimeStampParam(2,f8var1); + stmt->setDateParam(3,f6var1); + stmt->setFloatParam(4,f5var1); + stmt->setFloatParam(5,f4var1); + stmt->setStringParam(6,f3var1); + + //stmt->setShortParam(7,f2var1); + + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + + stmt->free(); + + printf("%d Rows updated\n",count); + + //********************************************************** + // SELECT * FROM T1; + + strcpy(statement,"SELECT * FROM t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT * FROM t1"); + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 5; + } + + stmt->bindField(1,&f1var); + stmt->bindField(2,&f2var); + stmt->bindField(3,f3var); + stmt->bindField(4,&f4var); + stmt->bindField(5,&f5var); + stmt->bindField(6,&f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->bindField(7,&f8var); + stmt->bindField(8,&f9var); + stmt->bindField(9,&f10var); + + }else{ + stmt->bindField(7,&f7var); + stmt->bindField(8,&f8var); + stmt->bindField(9,&f9var); + stmt->bindField(10,&f10var); + } + + count=0; + rv = con->beginTrans(); + if(rv!=OK)return 6; + stmt->execute(rows); + while(stmt->fetch() !=NULL) + { + if(f1var==5)printf("\n"); + if(strcmp(getenv("DSN"),"oracle")==0) + printf("f1=%d | f2=%hd | f3=%s | f4=%f | f5=%f | DATE=%d-%d-%d | TIMESTAMP=%d-%d-%d %d:%d:%d | f9=%d | f10=%lld\n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + else + printf("F1=%d | F2=%hd | F3=%s | F4=%f | F5=%f | DATE=%d-%d-%d | TIME=%d:%d:%d | TIMESTAMP=%d-%d-%d %d:%d:%d | F9=%d | F10=%lld \n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f7var.hours(),f7var.minutes(),f7var.seconds(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + + + count++; + } + + stmt->close(); + rv = con->commit(); + if(rv !=OK) + { + delete stmt; + delete con; + return 7; + } + + printf("%d Rows fetched\n",count); + stmt->free(); + + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 8; + } + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 9; + } + stmt->free(); + printf("Table dropped\n"); + con->commit(); + delete stmt; + delete con; + return 0; +} diff --git a/test/adapter/Parameter/paratest5.c b/test/adapter/Parameter/paratest5.c new file mode 100644 index 00000000..5984e623 --- /dev/null +++ b/test/adapter/Parameter/paratest5.c @@ -0,0 +1,214 @@ +/* create table T1 with 10 fields. + * insert some records into it with null values + * delete records from T1 with where clause + * + * select * from T1; +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(4),f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f8 TIMESTAMP,f9 number(9),f10 number(18));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT4,f5 FLOAT4,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT NULL,f2 SMALLINT NULL,f3 CHAR(30) NULL,f4 REAL NULL,f5 REAL NULL,f6 DATE NULL,f7 TIME NULL,f8 DATETIME NULL,f9 INT NULL, f10 BIGINT NULL);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT ,f2 SMALLINT ,f3 CHAR(30) ,f4 REAL ,f5 REAL ,f6 DATE,f7 TIME, f8 TIMESTAMP ,f9 INT , f10 BIGINT )"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 2; } + rv = stmt->execute(rows); + if(rv!=OK) { delete stmt; delete con; return 3; } + stmt->free(); + con->commit(); + printf("Table T1 created\n"); + // insert into table + if(strcmp(getenv("DSN"),"oracle")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?);"); + } + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?)"); + else{ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?);"); + } + + int f1var = 0; + short int f2var = 1; + char f3var[32]="jitendra"; + float f4var = 5.5; + float f5var = 10.50; + Date f6var; + f6var.set(2007,01,21); + Time f7var; + f7var.set(12,29,30); + TimeStamp f8var; + f8var.setDate(2007,01,21); + f8var.setTime(12,29,30); + int f9var = 20; + long long f10var = 12000; + char f11var[12]="23fe"; + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + + int count=0; + for(int i=0;i<10;i++) { + rv = con->beginTrans(); + if(rv!=OK) break; + f1var=i; + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + stmt->setStringParam(3,f3var); + stmt->setFloatParam(4,f4var); + stmt->setNull(5); + stmt->setDateParam(6,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + }else{ + stmt->setNull(7); + stmt->setTimeStampParam(8,f8var); + stmt->setIntParam(9,f9var); + stmt->setLongLongParam(10,f10var); + //stmt->setBinaryParam(11,f11var, 12); + } + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + stmt->free(); + //********************************************************* + // Insert with value list records from the T1 + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"INSERT INTO t1(F1,F2,F3,F4,F5,F6,F8,F9,F10) VALUES(?,?,?,?,?,?,?,?,?);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"INSERT INTO t1(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10) VALUES(?,?,?,?,?,?,?,?,?,?);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10) VALUES(?,?,?,?,?,?,?,?,?,?)"); + else + strcpy(statement,"INSERT INTO t1(F1,F2,F3,F4,F5,F6,F7,F8,F9,F10) VALUES(?,?,?,?,?,?,?,?,?,?);"); + + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + + for(int i=0;i<10;i++) { + rv = con->beginTrans(); + if(rv!=OK) break; + f1var=i; + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + stmt->setStringParam(3,f3var); + stmt->setFloatParam(4,f4var); + stmt->setNull(5); + stmt->setDateParam(6,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + }else{ + stmt->setNull(7); + stmt->setTimeStampParam(8,f8var); + stmt->setIntParam(9,f9var); + stmt->setLongLongParam(10,f10var); + } + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("Total rows inserted %d\n",count); + stmt->free(); + + //********************************************************** + // SELECT * FROM T1; + strcpy(statement,"SELECT * FROM t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT * FROM t1"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 5; } + stmt->bindField(1,&f1var); + stmt->bindField(2,&f2var); + stmt->bindField(3,f3var); + stmt->bindField(4,&f4var); + stmt->bindField(5,&f5var); + stmt->bindField(6,&f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->bindField(7,&f8var); + stmt->bindField(8,&f9var); + stmt->bindField(9,&f10var); + + }else{ + stmt->bindField(7,&f7var); + stmt->bindField(8,&f8var); + stmt->bindField(9,&f9var); + stmt->bindField(10,&f10var); + } + //stmt->bindField(11,f11var); + count=0; + rv = con->beginTrans(); + if(rv!=OK)return 6; + stmt->execute(rows); + while(stmt->fetch() !=NULL) { + if(stmt->isFldNull(1)) printf("F1=NULL | "); + else printf("F1=%d | ", f1var); + if(stmt->isFldNull(2)) printf("F2=NULL | "); + else printf("F2=%hd | ", f2var); + if(stmt->isFldNull(3)) printf("F3=NULL | "); + else printf("F3=%s | ", f3var); + if(stmt->isFldNull(4)) printf("F4=NULL | "); + else printf("F4=%f | ", f4var); + if(stmt->isFldNull(5)) printf("F5=NULL | "); + else printf("F5=%f | ", f5var); + if(stmt->isFldNull(6)) printf("F6=NULL | "); + else printf("F6=%02d-%02d-%02d | ",f6var.year(), f6var.month(), f6var.dayOfMonth()); + if(strcmp(getenv("DSN"),"oracle") != 0){ + if(stmt->isFldNull(7)) printf("F7=NULL | "); + else printf("F7=%02d:%02d:%02d | ", f7var.hours(),f7var.minutes(),f7var.seconds()); + } + if(stmt->isFldNull(8)) printf("F8=NULL | "); + else printf("F8=%d-%d-%d %d:%d:%d | ", f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds()); + if(stmt->isFldNull(9)) printf("F9=NULL | "); + else printf("F9=%d | ", f9var); + if(stmt->isFldNull(10)) printf("F10=NULL | "); + else printf("F10=%lld | ", f10var); + printf("\n"); + count++; + } + stmt->close(); + rv = con->commit(); + if(rv !=OK) { delete stmt; delete con; return 7; } + printf("Total row fetched=%d\n",count); + stmt->free(); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 8; } + rv = stmt->execute(rows); + if(rv!=OK) { delete stmt; delete con; return 9; } + con->commit(); + printf("Table dropped\n"); + stmt->free(); delete stmt; delete con; + return 0; +} diff --git a/test/adapter/Parameter/paratest6.c b/test/adapter/Parameter/paratest6.c new file mode 100644 index 00000000..4f029655 --- /dev/null +++ b/test/adapter/Parameter/paratest6.c @@ -0,0 +1,220 @@ +/* create table T1 with 10 fields. + * insert some records into it. + * update T1 with some Null values in the parameter. + noOfParamFields() should return 8. + * select * from T1; +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(4),f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f8 TIMESTAMP,f9 number(9),f10 number(18));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT4,f5 FLOAT4,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT NULL,f2 SMALLINT NULL,f3 CHAR(30) NULL,f4 REAL NULL,f5 REAL NULL,f6 DATE NULL,f7 TIME NULL,f8 DATETIME NULL,f9 INT NULL,f10 BIGINT NULL);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT ,f2 SMALLINT ,f3 CHAR(30) ,f4 REAL ,f5 REAL ,f6 DATE ,f7 TIME ,f8 TIMESTAMP ,f9 INT ,f10 BIGINT )"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + int rows = 0; + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 2; } + rv = stmt->execute(rows); + if(rv!=OK) { delete stmt; delete con; return 3; } + con->commit(); + stmt->free(); + printf("Table created\n"); + // insert into table + if(strcmp(getenv("DSN"),"oracle")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?);"); + } + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?)"); + else{ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?);"); + } + + int f1var = 0; + short int f2var = 10; + char f3var[32]="jitendra"; + float f4var = 5.5; + float f5var = 10.50; + Date f6var; + f6var.set(2008,01,21); + Time f7var; + f7var.set(12,29,30); + TimeStamp f8var; + f8var.setDate(2008,01,21); + f8var.setTime(12,29,30); + int f9var = 20; + long long f10var = 12000; + char f11var[8]="23fe"; + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 4; } + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + + int count=0; + for(int i=0;i<10;i++) { + rv = con->beginTrans(); + if(rv!=OK) break; + f1var=i; + f2var++; + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + stmt->setStringParam(3,f3var); + stmt->setFloatParam(4,f4var); + stmt->setFloatParam(5,f5var); + stmt->setDateParam(6,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + }else{ + stmt->setTimeParam(7,f7var); + stmt->setTimeStampParam(8,f8var); + stmt->setIntParam(9,f9var); + stmt->setLongLongParam(10,f10var); + } + // stmt->setBinaryParam(11,f11var,8); + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("%d Rows inserted \n",count); + stmt->free(); + //********************************************************** + // UPDATE TABLE + if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"UPDATE t1 SET f10=?,f8=?,f6=?,f5=?,f4=?,f3=? WHERE f2=?;"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"UPDATE t1 SET f10=?,f8=?,f6=?,f5=?,f4=?,f3=? WHERE f2=?"); + else + strcpy(statement,"UPDATE t1 SET F10=?,F8=?,F6=?,F5=?,F4=?,F3=? WHERE F2=?;"); + rv = stmt->prepare(statement); + if(strcmp(getenv("DSN"),"psql")==0){ + con->rollback(); + } + + int nop; + nop = stmt->noOfParamFields(); + printf("noOfParamFields return=%d\n",nop); + if(nop!=7)return 5; + long long f10var1=15000; + TimeStamp f8var1; + f8var1.setDate(2007,3,30); + f8var1.setTime(10,25,55); + Date f6var1; + f6var1.set(2007,3,30); + float f5var1=20.25; + float f4var1=11.22; + char f3var1[10]="lakshya"; + char f11var1[8]="ab12"; + short int f2var1=10; + count=0; + for(int i=0;i<5;i++) { + rv = con->beginTrans(); + if(rv!=OK)break; + f2var1++; + stmt->setShortParam(7,f2var1); + stmt->setLongLongParam(1,f10var1); + stmt->setTimeStampParam(2,f8var1); + stmt->setNull(3); + stmt->setFloatParam(4,f5var1); + stmt->setFloatParam(5,f4var1); + stmt->setNull(6); + //stmt->setBinaryParam(7,f11var1, 8); + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + stmt->free(); + printf("%d Rows updated\n",count); + //********************************************************** + // SELECT * FROM T1; + strcpy(statement,"SELECT * FROM t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT * FROM t1"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 6; } + stmt->bindField(1,&f1var); + stmt->bindField(2,&f2var); + stmt->bindField(3,f3var); + stmt->bindField(4,&f4var); + stmt->bindField(5,&f5var); + stmt->bindField(6,&f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->bindField(7,&f8var); + stmt->bindField(8,&f9var); + stmt->bindField(9,&f10var); + + }else{ + stmt->bindField(7,&f7var); + stmt->bindField(8,&f8var); + stmt->bindField(9,&f9var); + stmt->bindField(10,&f10var); + } + //stmt->bindField(11,f11var); + count=0; + rv = con->beginTrans(); + if(rv!=OK)return 7; + stmt->execute(rows); + while(stmt->fetch() !=NULL) { + if(stmt->isFldNull(1)) printf("F1=NULL | "); + else printf("F1=%d | ", f1var); + if(stmt->isFldNull(2)) printf("F2=NULL | "); + else printf("F2=%hd | ", f2var); + if(stmt->isFldNull(3)) printf("F3=NULL | "); + else printf("F3=%s | ", f3var); + if(stmt->isFldNull(4)) printf("F4=NULL | "); + else printf("F4=%f | ", f4var); + if(stmt->isFldNull(5)) printf("F5=NULL | "); + else printf("F5=%f | ", f5var); + if(stmt->isFldNull(6)) printf("F6=NULL | "); + else printf("F6=%02d-%02d-%02d | ",f6var.year(), f6var.month(), f6var.dayOfMonth()); + if(strcmp(getenv("DSN"),"oracle")!=0){ + if(stmt->isFldNull(7)) printf("F7=NULL | "); + else printf("F7=%02d:%02d:%02d | ", f7var.hours(),f7var.minutes(),f7var.seconds()); + } + if(stmt->isFldNull(8)) printf("F8=NULL | "); + else printf("F8=%d-%d-%d %d:%d:%d | ", f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds()); + if(stmt->isFldNull(9)) printf("F9=NULL | "); + else printf("F9=%d | ", f9var); + if(stmt->isFldNull(10)) printf("F10=NULL | "); + else printf("F10=%lld | ", f10var); + printf("\n"); + count++; + } + stmt->close(); + rv = con->commit(); + if(rv !=OK) { delete stmt; delete con; return 8; } + printf("Rows fetched=%d\n",count); + stmt->free(); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + if(rv!=OK) { delete stmt; delete con; return 9; } + rv = stmt->execute(rows); + if(rv!=OK) { delete stmt; delete con; return 10; } + con->commit(); + printf("Table dropped\n"); + stmt->free(); delete stmt; delete con; + return 0; +} diff --git a/test/adapter/Parameter/test001na.ksh b/test/adapter/Parameter/test001na.ksh new file mode 100755 index 00000000..9469062c --- /dev/null +++ b/test/adapter/Parameter/test001na.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Parameter/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Parameter +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +echo DSN=$DSN >>$CSQL_CONFIG_FILE +DS="$DSN $DBUSER $PASSWORD" +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +${REL_PATH}/paratest1na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Parameter/test002na.ksh b/test/adapter/Parameter/test002na.ksh new file mode 100755 index 00000000..7647d11b --- /dev/null +++ b/test/adapter/Parameter/test002na.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Parameter/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Parameter +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +echo DSN=$DSN >>$CSQL_CONFIG_FILE +DS="$DSN $DBUSER $PASSWORD" + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +${REL_PATH}/paratest2na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Parameter/test003na.ksh b/test/adapter/Parameter/test003na.ksh new file mode 100755 index 00000000..6fafbac3 --- /dev/null +++ b/test/adapter/Parameter/test003na.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Parameter/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Parameter +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf + +echo DSN=$DSN >>$CSQL_CONFIG_FILE +DS="$DSN $DBUSER $PASSWORD" +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +${REL_PATH}/paratest3na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Parameter/test004na.ksh b/test/adapter/Parameter/test004na.ksh new file mode 100755 index 00000000..d86231f5 --- /dev/null +++ b/test/adapter/Parameter/test004na.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Parameter/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Parameter +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +echo DSN=$DSN >>$CSQL_CONFIG_FILE +DS="$DSN $DBUSER $PASSWORD" + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +${REL_PATH}/paratest4na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Parameter/test005na.ksh b/test/adapter/Parameter/test005na.ksh new file mode 100755 index 00000000..1b943e00 --- /dev/null +++ b/test/adapter/Parameter/test005na.ksh @@ -0,0 +1,29 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Parameter/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Parameter +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +echo DSN=$DSN >>$CSQL_CONFIG_FILE +DS="$DSN $DBUSER $PASSWORD" + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +${REL_PATH}/paratest5na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Parameter/test006na.ksh b/test/adapter/Parameter/test006na.ksh new file mode 100755 index 00000000..b52a0078 --- /dev/null +++ b/test/adapter/Parameter/test006na.ksh @@ -0,0 +1,30 @@ +#!/bin/ksh + +CSQL_CONF=${PWD}/adapter/Parameter/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Parameter +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +echo DSN=$DSN >>$CSQL_CONFIG_FILE +DS="$DSN $DBUSER $PASSWORD" + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +${REL_PATH}/paratest6na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +#kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'` +exit 0; diff --git a/test/adapter/Select/Makefile b/test/adapter/Select/Makefile new file mode 100644 index 00000000..0fc12a15 --- /dev/null +++ b/test/adapter/Select/Makefile @@ -0,0 +1,92 @@ +OSNAME = $(shell uname -s) +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + +INCL= -I$(CSQL_INSTALL_ROOT)/install/include -I../../../include +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcsqlgw -lcsqlnw -lcsqlodbcadapter -lcsqlsqlnw -lcacheload -lcsql -lcsqlsql -lcsqlsqllog + + +TARGETS = \ + test001 selecttest1na\ + test002 selecttest2na\ + test003 selecttest3na\ + test004 selecttest4na\ + test005 selecttest5na\ + test006 selecttest6na\ + test007 selecttest7na\ + test008 selecttest8na\ + test009 selecttest9na\ + test010 selecttest10na\ + test011 singleconnadapterna + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +test001: selecttest1.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest1na: selecttest1.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test002:selecttest2.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest2na: selecttest2.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test003:selecttest3.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest3na: selecttest3.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004:selecttest4.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest4na: selecttest4.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005:selecttest5.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest5na: selecttest5.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test006:selecttest6.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest6na: selecttest6.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test007:selecttest7.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest7na: selecttest7.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test008:selecttest8.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest8na: selecttest8.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test009:selecttest9.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest9na: selecttest9.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test010:selecttest10.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +selecttest10na: selecttest10.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test011:singleconnadapter.c common.h + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +singleconnadapterna: singleconnadapter.c common.h + $(CPlus) -DNETWORKADAPTER $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) + +clean: + rm -f *.o ${TARGETS} diff --git a/test/adapter/Select/common.h b/test/adapter/Select/common.h new file mode 100644 index 00000000..568ee1e4 --- /dev/null +++ b/test/adapter/Select/common.h @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include +AbsSqlConnection *createConnection() +{ +#ifdef NETWORK + AbsSqlConnection *con = SqlFactory::createConnection(CSqlNetwork); + SqlNwConnection *conn = (SqlNwConnection *) con; + conn->setHost("localhost", 5678); +#elif defined NETWORKADAPTER + AbsSqlConnection *con = SqlFactory::createConnection(CSqlNetworkAdapter); + SqlNwConnection *conn = (SqlNwConnection *) con; + conn->setHost("localhost", 5678); +#elif defined NETWORKGATEWAY + AbsSqlConnection *con = SqlFactory::createConnection(CSqlNetworkGateway); + SqlNwConnection *conn = (SqlNwConnection *) con; + conn->setHost("localhost", 5678); +#else + AbsSqlConnection *con = SqlFactory::createConnection(CSqlAdapter); +#endif + return con; +} + +AbsSqlStatement *createStatement() +{ +#ifdef NETWORK + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlNetwork); +#elif defined NETWORKADAPTER + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlNetworkAdapter); +#elif defined NETWORKGATEWAY + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlNetworkGateway); +#else + AbsSqlStatement *stmt = SqlFactory::createStatement(CSqlAdapter); +#endif + return stmt; +} diff --git a/test/adapter/Select/csql.conf b/test/adapter/Select/csql.conf new file mode 100644 index 00000000..d9491041 --- /dev/null +++ b/test/adapter/Select/csql.conf @@ -0,0 +1,106 @@ +# CSQL System Configuration File + +#####################################Server Section######################## +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 100 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=2255 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=3355 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/csql/log/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +# Whether to enable durability +DURABILITY=false + +#Give full path for the database file where table and record information will +#be stored for durability +DATABASE_FILE=/tmp/csql/db + +#Important: For Server section parameters, make sure that the value is same for the +# server process and all the csql client process which connects to it. otherwise, +# behavior is undefined +#####################################Client Section######################## + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=5000 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=5000 +LOCK_TIMEOUT_RETRIES=10 + +#####################################Cache Section######################## + +#Whether to enable caching of tables from target database +CACHE_TABLE=false + +#Set cache id for multiple bidirectional cache node for single data source +SITE_ID=1 + +# Name of Target Database (mysql ,postgres, oracle etc...) +TARGET_DATABASE=mysql +#DSN Name to connect to the target database. +#This should be present in ~/odbc.ini file +DSN=myodbc3 + +DBUSER= + +PASSWORD= + +ENABLE_BIDIRECTIONAL_CACHE=false + +CACHE_RECEIVER_WAIT_SECS=10 + +#Give full path for the file where all the cached table information is stored +TABLE_CONFIG_FILE=/tmp/csql/csqltable.conf + +#Mode of operation SYNC or ASYNC +CACHE_MODE=SYNC + +##########################SqlNetworkServer Section######################## + +# Whether to enable SqlNetwork server +CSQL_SQL_SERVER=true + +#Set port for Network access +PORT=5678 + +#Whether to enable Replication across the sites +REPLICATION=false + +#No of sites to replicate +REPLICATION_SITES=16 + +#Give full path for the file where all the peer site information is stored +NETWORK_CONFIG_FILE=/tmp/csql/csqlnw.conf + +# MSGKEY for creating msg queue for MsgQueue Server +MSG_KEY=2525 + +ID_SHM_KEY=1947 +#####################################End Section######################## diff --git a/test/adapter/Select/exp.test001 b/test/adapter/Select/exp.test001 new file mode 100644 index 00000000..01d6bb5f --- /dev/null +++ b/test/adapter/Select/exp.test001 @@ -0,0 +1,11 @@ +'T1' table created +10 Rows Inserted +noOfProjFields returns=10 +Fetching starts on table 'T1' : +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +5 Rows fetched +'T1' table dropped diff --git a/test/adapter/Select/exp.test001na.ksh b/test/adapter/Select/exp.test001na.ksh new file mode 100644 index 00000000..01d6bb5f --- /dev/null +++ b/test/adapter/Select/exp.test001na.ksh @@ -0,0 +1,11 @@ +'T1' table created +10 Rows Inserted +noOfProjFields returns=10 +Fetching starts on table 'T1' : +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +5 Rows fetched +'T1' table dropped diff --git a/test/adapter/Select/exp.test002 b/test/adapter/Select/exp.test002 new file mode 100644 index 00000000..75140b3e --- /dev/null +++ b/test/adapter/Select/exp.test002 @@ -0,0 +1,10 @@ +'T1' Table created +10 Rows Inserted +Total number of projection fields in the select statement=5 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +Total row fetched=5 +Table dropped diff --git a/test/adapter/Select/exp.test002na.ksh b/test/adapter/Select/exp.test002na.ksh new file mode 100644 index 00000000..75140b3e --- /dev/null +++ b/test/adapter/Select/exp.test002na.ksh @@ -0,0 +1,10 @@ +'T1' Table created +10 Rows Inserted +Total number of projection fields in the select statement=5 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +F1=100 | F2=1 | F3=lakshya | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | F9=20 | F10=12000 +Total row fetched=5 +Table dropped diff --git a/test/adapter/Select/exp.test010 b/test/adapter/Select/exp.test010 new file mode 100644 index 00000000..97721ad0 --- /dev/null +++ b/test/adapter/Select/exp.test010 @@ -0,0 +1,10 @@ +'t1' Table created +10 Rows Inserted +Total number of projection fields in the select statement=5 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +Total row fetched=5 +Table dropped diff --git a/test/adapter/Select/exp.test010na.ksh b/test/adapter/Select/exp.test010na.ksh new file mode 100644 index 00000000..97721ad0 --- /dev/null +++ b/test/adapter/Select/exp.test010na.ksh @@ -0,0 +1,10 @@ +'t1' Table created +10 Rows Inserted +Total number of projection fields in the select statement=5 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +F1=100 | F2=1 | F3=LAKSHYA | F4=5.500000 | F5=10.500000 | DATE=2008-1-21 | TIME=12:29:30 | TIMESTAMP=2008-1-21 12:29:30 | f9=20 | f10=12000 +Total row fetched=5 +Table dropped diff --git a/test/adapter/Select/exp.test011 b/test/adapter/Select/exp.test011 new file mode 100644 index 00000000..bd52dfe0 --- /dev/null +++ b/test/adapter/Select/exp.test011 @@ -0,0 +1,33 @@ +Table created +Table created +Table created +Inserting records into table T1 +5 rows inserted into table T1 +Inserting records into table T2 +5 rows inserted into table T2 +Inserting records into table T3 +5 rows inserted into table T3 +SELECT * FROM T1; +T1.f1 T1.f2 +0 lakshya +1 lakshya +2 lakshya +3 lakshya +4 lakshya +SELECT * FROM T2; +T2.f1 T2.f2 +5 lakshya +6 lakshya +7 lakshya +8 lakshya +9 lakshya +SELECT * FROM T3; +T3.f1 T3.f2 +10 lakshya +11 lakshya +12 lakshya +13 lakshya +14 lakshya +Table T1 dropped successfully +Table T2 dropped successfully +Table T3 dropped successfully diff --git a/test/adapter/Select/exp.test011na.ksh b/test/adapter/Select/exp.test011na.ksh new file mode 100644 index 00000000..bd52dfe0 --- /dev/null +++ b/test/adapter/Select/exp.test011na.ksh @@ -0,0 +1,33 @@ +Table created +Table created +Table created +Inserting records into table T1 +5 rows inserted into table T1 +Inserting records into table T2 +5 rows inserted into table T2 +Inserting records into table T3 +5 rows inserted into table T3 +SELECT * FROM T1; +T1.f1 T1.f2 +0 lakshya +1 lakshya +2 lakshya +3 lakshya +4 lakshya +SELECT * FROM T2; +T2.f1 T2.f2 +5 lakshya +6 lakshya +7 lakshya +8 lakshya +9 lakshya +SELECT * FROM T3; +T3.f1 T3.f2 +10 lakshya +11 lakshya +12 lakshya +13 lakshya +14 lakshya +Table T1 dropped successfully +Table T2 dropped successfully +Table T3 dropped successfully diff --git a/test/adapter/Select/selecttest1.c b/test/adapter/Select/selecttest1.c new file mode 100644 index 00000000..f685eeac --- /dev/null +++ b/test/adapter/Select/selecttest1.c @@ -0,0 +1,216 @@ +/* create table T1 with 10 fields, + * insert 10 rows into the table , + * noofprojFields shoul dreturn 10. + * call fetch and count the record. +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(4),f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f8 TIMESTAMP,f9 number(9),f10 number(18));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT4,f5 FLOAT4,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 DATETIME,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + + int rows=0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + stmt->free(); + con->commit(); + printf("'T1' table created\n"); + + // insert records + + if(strcmp(getenv("DSN"),"oracle")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?);"); + } + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?)"); + else{ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?);"); + } + + + int f1var = 99; + short int f2var = 1; + char f3var[32] = "lakshya"; + float f4var = 5.5; + float f5var = 10.50; + Date f6var; + f6var.set(2008,1,21); + + Time f7var; + f7var.set(12,29,30); + + TimeStamp f8var; + f8var.setDate(2008,1,21); + f8var.setTime(12,29,30); + + int f9var = 20; + long long f10var = 12000; + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 4; + } + + + int count=0; + + for(int i=0;i<2;i++) + { + f1var = f1var+i; + for(int j=0;j<5;j++) + { + rv = con->beginTrans(); + if(rv!=OK)break; + + + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + stmt->setStringParam(3,f3var); + stmt->setFloatParam(4,f4var); + stmt->setFloatParam(5,f5var); + stmt->setDateParam(6,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + }else{ + stmt->setTimeParam(7,f7var); + stmt->setTimeStampParam(8,f8var); + stmt->setIntParam(9,f9var); + stmt->setLongLongParam(10,f10var); + } + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + + } + printf("%d Rows Inserted\n",count); + stmt->free(); + +//******************************************* + + strcpy(statement,"SELECT * FROM t1 WHERE f1=100;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT * FROM t1 WHERE f1=100"); + rv = stmt->prepare(statement); + + int nop; + nop = stmt->noOfProjFields(); + printf("noOfProjFields returns=%d\n",nop); + + if(rv !=OK) + { + delete stmt; + delete con; + return 5; + } + + stmt->bindField(1,&f1var); + stmt->bindField(2,&f2var); + stmt->bindField(3,f3var); + stmt->bindField(4,&f4var); + stmt->bindField(5,&f5var); + stmt->bindField(6,&f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->bindField(7,&f8var); + stmt->bindField(8,&f9var); + stmt->bindField(9,&f10var); + + }else{ + stmt->bindField(7,&f7var); + stmt->bindField(8,&f8var); + stmt->bindField(9,&f9var); + stmt->bindField(10,&f10var); + } + + + + count = 0; + rv = con->beginTrans(); + if(rv!=OK)return 6; + stmt->execute(rows); + printf("Fetching starts on table 'T1' :\n"); + while(stmt->fetch()!=NULL) + { + if(strcmp(getenv("DSN"),"oracle")==0) + printf("f1=%d | f2=%hd | f3=%s | f4=%f | f5=%f | DATE=%d-%d-%d | TIMESTAMP=%d-%d-%d %d:%d:%d | f9=%d | f10=%lld\n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + else + printf("F1=%d | F2=%hd | F3=%s | F4=%f | F5=%f | DATE=%d-%d-%d | TIME=%d:%d:%d | TIMESTAMP=%d-%d-%d %d:%d:%d | F9=%d | F10=%lld \n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f7var.hours(),f7var.minutes(),f7var.seconds(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + + count++; + } + + stmt->close(); + rv = con->commit(); + if(rv!=OK) + { + delete stmt; + delete con; + return 7; + } + + printf("%d Rows fetched\n",count); + + stmt->free(); + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 8; + } + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 9; + } + stmt->free(); + con->commit(); + printf("'T1' table dropped\n"); + + delete stmt; + delete con; + return 0; +} diff --git a/test/adapter/Select/selecttest10.c b/test/adapter/Select/selecttest10.c new file mode 100644 index 00000000..b5eedf35 --- /dev/null +++ b/test/adapter/Select/selecttest10.c @@ -0,0 +1,214 @@ +/* create table t1 with 10 fields,( f2 NOT NULL , f3 CHAR(20) DEFAULT 'LAKSHYA') + * insert 10 rows for 9 Fields except f3 Field into the table + * noofprojFields should return 5. + * getProjFldInfo() for all fields. + * select with 5 parameters withIwhere clause.(WHERE f1=100) +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(4),f3 CHAR(30) DEFAULT 'LAKSHYA',f4 FLOAT,f5 FLOAT,f6 DATE,f8 TIMESTAMP,f9 number(9),f10 number(18));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30) DEFAULT 'LAKSHYA',f4 FLOAT4,f5 FLOAT4,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30) DEFAULT 'LAKSHYA',f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 DATETIME,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30) DEFAULT 'LAKSHYA',f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30) DEFAULT 'LAKSHYA',f4 FLOAT,f5 FLOAT,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + + int rows=0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + stmt->free(); + con->commit(); + printf("'t1' Table created\n"); + + // insert records + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"INSERT INTO t1(f1,f2,f4,f5,f6,f8,f9,f10)VALUES(?,?,?,?,?,?,?,?);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1(f1,f2,f4,f5,f6,f7,f8,f9,f10)VALUES(?,?,?,?,?,?,?,?,?)"); + else + strcpy(statement,"INSERT INTO t1(f1,f2,f4,f5,f6,f7,f8,f9,f10)VALUES(?,?,?,?,?,?,?,?,?);"); + + int f1var = 99; + short int f2var = 1; +// char f3var[20] = "prabakaran"; + float f4var = 5.5; + float f5var = 10.50; + Date f6var; + f6var.set(2008,1,21); + + Time f7var; + f7var.set(12,29,30); + + TimeStamp f8var; + f8var.setDate(2008,1,21); + f8var.setTime(12,29,30); + + int f9var = 20; + long long f10var = 12000; + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 4; + } + + int count=0; + + for(int i=0;i<2;i++) + { + f1var = f1var+i; + for(int j=0;j<5;j++) + { + rv = con->beginTrans(); + if(rv!=OK)break; + + + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + //stmt->setStringParam(3,f3var); + stmt->setFloatParam(3,f4var); + stmt->setFloatParam(4,f5var); + stmt->setDateParam(5,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(6,f8var); + stmt->setIntParam(7,f9var); + stmt->setLongLongParam(8,f10var); + }else{ + stmt->setTimeParam(6,f7var); + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + } + + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + + } + printf("%d Rows Inserted\n",count); + stmt->free(); + +//******************************************* + + strcpy(statement,"SELECT f8,f10,f2,f6,f3 FROM t1 WHERE f1=100;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT f8,f10,f2,f6,f3 FROM t1 WHERE f1=100"); + rv = stmt->prepare(statement); + + int nop; + nop = stmt->noOfProjFields(); + if(nop!=5)return 1; + printf("Total number of projection fields in the select statement=%d\n",nop); + + // getParamFldInfo() + FieldInfo *field = new FieldInfo(); + + char fldName[20]; + DataType type; + size_t length; + int offset; + char defaultValueBuf[10]; + bool isNull; + bool isDefault; + + if(rv !=OK) + { + delete stmt; + delete con; + return 5; + } + + char f3var[32]="jitu"; + + stmt->bindField(1,&f8var); + stmt->bindField(2,&f10var); + stmt->bindField(3,&f2var); + stmt->bindField(4,&f6var); + stmt->bindField(5,f3var); + + + count = 0; + rv = con->beginTrans(); + if(rv!=OK)return 6; + stmt->execute(rows); + while(stmt->fetch()!=NULL) + { + + printf("F1=%d | F2=%hd | F3=%s | F4=%f | F5=%f | DATE=%d-%d-%d | TIME=%d:%d:%d | TIMESTAMP=%d-%d-%d %d:%d:%d | f9=%d | f10=%lld \n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f7var.hours(),f7var.minutes(),f7var.seconds(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + + count++; + } + + stmt->close(); + rv = con->commit(); + if(rv!=OK) + { + delete stmt; + delete con; + return 6; + } + + printf("Total row fetched=%d\n",count); + + stmt->free(); + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 7; + } + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 8; + } + stmt->free(); + con->commit(); + printf("Table dropped\n"); + + delete stmt; + delete con; + return 0; +} + + + diff --git a/test/adapter/Select/selecttest2.c b/test/adapter/Select/selecttest2.c new file mode 100644 index 00000000..dc9767af --- /dev/null +++ b/test/adapter/Select/selecttest2.c @@ -0,0 +1,218 @@ +/* create table T1 with 10 fields, + * insert 10 rows into the table , + * noofprojFields should return 5. + * getProjFldInfo() for all fields. + * select with 5 parameters withIwhere clause.(WHERE F1=100) +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + if(strcmp(getenv("DSN"),"oracle")==0) + strcpy(statement,"CREATE TABLE t1(f1 number(9),f2 number(4),f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f8 TIMESTAMP,f9 number(9),f10 number(18));"); + else if(strcmp(getenv("DSN"),"psql")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT4,f5 FLOAT4,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"sybase")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 DATETIME,f9 INT,f10 BIGINT);"); + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 REAL,f5 REAL,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT)"); + else + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 SMALLINT,f3 CHAR(30),f4 FLOAT,f5 FLOAT,f6 DATE,f7 TIME,f8 TIMESTAMP,f9 INT,f10 BIGINT);"); + + int rows=0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + stmt->free(); + con->commit(); + printf("'T1' Table created\n"); + + // insert records + + if(strcmp(getenv("DSN"),"oracle")==0){ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?);"); + } + else if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?)"); + else{ + strcpy(statement,"INSERT INTO t1 VALUES(?,?,?,?,?,?,?,?,?,?);"); + } + + int f1var = 99; + short int f2var = 1; + char f3var[32] = "lakshya"; + float f4var = 5.5; + float f5var = 10.50; + Date f6var; + f6var.set(2008,1,21); + + Time f7var; + f7var.set(12,29,30); + + TimeStamp f8var; + f8var.setDate(2008,1,21); + f8var.setTime(12,29,30); + + int f9var = 20; + long long f10var = 12000; + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 4; + } + + int count=0; + + for(int i=0;i<2;i++) + { + f1var = f1var+i; + for(int j=0;j<5;j++) + { + rv = con->beginTrans(); + if(rv!=OK)break; + + + stmt->setIntParam(1,f1var); + stmt->setShortParam(2,f2var); + stmt->setStringParam(3,f3var); + stmt->setFloatParam(4,f4var); + stmt->setFloatParam(5,f5var); + stmt->setDateParam(6,f6var); + if(strcmp(getenv("DSN"),"oracle")==0){ + stmt->setTimeStampParam(7,f8var); + stmt->setIntParam(8,f9var); + stmt->setLongLongParam(9,f10var); + }else{ + stmt->setTimeParam(7,f7var); + stmt->setTimeStampParam(8,f8var); + stmt->setIntParam(9,f9var); + stmt->setLongLongParam(10,f10var); + } + + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + + } + printf("%d Rows Inserted\n",count); + stmt->free(); + +//******************************************* + + strcpy(statement,"SELECT f8,f10,f2,f6,f3 FROM t1 WHERE f1=100;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT f8,f10,f2,f6,f3 FROM t1 WHERE f1=100"); + rv = stmt->prepare(statement); + + int nop; + nop = stmt->noOfProjFields(); + if(nop!=5)return 1; + printf("Total number of projection fields in the select statement=%d\n",nop); + + // getParamFldInfo() + FieldInfo *field = new FieldInfo(); + + char fldName[20]; + DataType type; + size_t length; + int offset; + char defaultValueBuf[10]; + bool isNull; + bool isDefault; + + delete field; + + if(rv !=OK) + { + delete stmt; + delete con; + return 5; + } + + stmt->bindField(1,&f8var); + stmt->bindField(2,&f10var); + stmt->bindField(3,&f2var); + stmt->bindField(4,&f6var); + stmt->bindField(5,f3var); + + + count = 0; + rv = con->beginTrans(); + if(rv!=OK)return 6; + stmt->execute(rows); + while(stmt->fetch()!=NULL) + { + if(strcmp(getenv("DSN"),"oracle")==0) + printf("f1=%d | f2=%hd | f3=%s | f4=%f | f5=%f | DATE=%d-%d-%d | TIMESTAMP=%d-%d-%d %d:%d:%d | f9=%d | f10=%lld\n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + else + printf("F1=%d | F2=%hd | F3=%s | F4=%f | F5=%f | DATE=%d-%d-%d | TIME=%d:%d:%d | TIMESTAMP=%d-%d-%d %d:%d:%d | F9=%d | F10=%lld \n",f1var,f2var,f3var,f4var,f5var,f6var.year(),f6var.month(),f6var.dayOfMonth(),f7var.hours(),f7var.minutes(),f7var.seconds(),f8var.year(),f8var.month(),f8var.dayOfMonth(),f8var.hours(),f8var.minutes(),f8var.seconds(),f9var,f10var); + + count++; + } + + stmt->close(); + rv = con->commit(); + if(rv!=OK) + { + delete stmt; + delete con; + return 6; + } + + printf("Total row fetched=%d\n",count); + + stmt->free(); + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 7; + } + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 8; + } + stmt->free(); + printf("Table dropped\n"); + con->commit(); + delete stmt; + delete con; + return 0; +} + + + diff --git a/test/adapter/Select/selecttest3.c b/test/adapter/Select/selecttest3.c new file mode 100644 index 00000000..478891cc --- /dev/null +++ b/test/adapter/Select/selecttest3.c @@ -0,0 +1,176 @@ +/* create table t1 with two fields, + * insert 10 rows into the table , + * select from nonexisting table. +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20));"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20))"); + + int rows=0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + stmt->free(); + printf("Table created\n"); + con->commit(); + // insert records + + strcpy(statement,"INSERT INTO t1 VALUES(?,?);"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1 VALUES(?,?)"); + + int f1var = 1; + char f2var[20] = "lakshya"; + + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + + int count=0; + + for(int i=0;i<2;i++) + { + + for(int j=0;j<5;j++) + { + f1var = j; + rv = con->beginTrans(); + if(rv!=OK)break; + + + stmt->setIntParam(1,f1var); + stmt->setStringParam(2,f2var); + + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("%d rows inserted\n",count); + } + stmt->free(); + +//******************************************* + + strcpy(statement,"SELECT * FROM t11;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT * FROM t11"); + rv = stmt->prepare(statement); + + if(rv !=OK) + { + printf("test script passed\n"); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + rv = stmt->execute(rows); + if(rv==OK){printf("Table dropped\n");} + stmt->free(); + con->commit(); + delete stmt; + delete con; + return 0; + } + + else if(rv==OK) + { + if(strcmp(getenv("DSN"),"oracle")==0 || strcmp(getenv("DSN"),"psql")==0 || strcmp(getenv("DSN"),"sybase")==0) + { + printf("Test script Passed\n"); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + rv = stmt->execute(rows); + if(rv==OK){printf("Table dropped\n");} + stmt->free(); + con->commit(); + delete stmt; + delete con; + return 0; + } + else + { + printf("Test script failed\n"); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + rv = stmt->execute(rows); + if(rv==OK){printf("Table dropped\n");} + stmt->free(); + con->commit(); + delete stmt; + delete con; + return 5; + } + } + else + { + stmt->bindField(1,&f1var); + stmt->bindField(2,f2var); + + + count = 0; + rv = con->beginTrans(); + if(rv!=OK)return 6; + stmt->execute(rows); + while(stmt->fetch()!=NULL) + { + count++; + } + + stmt->close(); + rv = con->commit(); + if(rv!=OK) + { + delete stmt; + delete con; + return 7; + } + + printf("Total row fetched=%d\n",count); + + } + stmt->free(); + con->commit(); + + delete stmt; + delete con; + return 0; +} + + + diff --git a/test/adapter/Select/selecttest4.c b/test/adapter/Select/selecttest4.c new file mode 100644 index 00000000..687eae29 --- /dev/null +++ b/test/adapter/Select/selecttest4.c @@ -0,0 +1,139 @@ +/* create table t1 with two fields, + * insert 10 rows into the table , + * select with nonexisting fields.It Should be failed in Mysql, Passed in postgres and oracle +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT);"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT)"); + + int rows=0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + stmt->free(); + printf("Table created\n"); + con->commit(); + // insert records + + strcpy(statement,"INSERT INTO t1 VALUES(?,?);"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1 VALUES(?,?)"); + + int f1var = 1; + int f2var= 110; + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + + int count=0; + + for(int i=0;i<2;i++) + { + + for(int j=0;j<5;j++) + { + f1var = j; + rv = con->beginTrans(); + if(rv!=OK)break; + + + stmt->setIntParam(1,f1var); + stmt->setIntParam(2,f2var); + + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("%d rows inserted\n",count); + } + stmt->free(); + +//******************************************* + + strcpy(statement,"SELECT F3 ,f2 FROM t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT F3 ,f2 FROM t1"); + rv = stmt->prepare(statement); + + if(rv !=OK) + { + printf("Test script passed\n"); + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + rv = stmt->execute(rows); + if(rv==OK)printf("Table dropped\n"); + con->commit(); + stmt->free(); + delete stmt; + delete con; + return 0; + } + else + { + if(strcmp(getenv("DSN"),"oracle")==0 || strcmp(getenv("DSN"),"psql")==0 || strcmp(getenv("DSN"),"sybase")==0 ) + { + printf("Test script Passed\n"); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + rv = stmt->execute(rows); + if(rv==OK){printf("Table dropped\n");} + stmt->free(); + con->commit(); + delete stmt; + delete con; + return 0; + } + else + { + printf("Test script failed\n"); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + rv = stmt->execute(rows); + if(rv==OK)printf("Table dropped\n"); + con->commit(); + stmt->free(); + delete stmt; + delete con; + return 4; + } + } +} diff --git a/test/adapter/Select/selecttest5.c b/test/adapter/Select/selecttest5.c new file mode 100644 index 00000000..cabbfc85 --- /dev/null +++ b/test/adapter/Select/selecttest5.c @@ -0,0 +1,46 @@ +/* call execute without calling prepare. it should fail. +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT);"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 INT)"); + + int rows=0; + /*rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + }*/ + + rv = stmt->execute(rows); + + if(rv!=OK) + { + delete stmt; + delete con; + printf("Test script passed\n"); + return 0; + } + stmt->free(); + printf("Test script failed\n"); + + + delete stmt; + delete con; + return 1; + } + diff --git a/test/adapter/Select/selecttest6.c b/test/adapter/Select/selecttest6.c new file mode 100644 index 00000000..368e445b --- /dev/null +++ b/test/adapter/Select/selecttest6.c @@ -0,0 +1,131 @@ +/* create table t1 with two fields, + * insert 10 rows into the table , + * fetch without prepare. +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20));"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20))"); + + int rows=0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + stmt->free(); + printf("Table created\n"); + con->commit(); + // insert records + + strcpy(statement,"INSERT INTO t1 VALUES(?,?);"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1 VALUES(?,?)"); + + int f1var = 1; + char f2var[20] = "lakshya"; + + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + + int count=0; + + for(int i=0;i<2;i++) + { + + for(int j=0;j<5;j++) + { + f1var = j; + rv = con->beginTrans(); + if(rv!=OK)break; + + + stmt->setIntParam(1,f1var); + stmt->setStringParam(2,f2var); + + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("%d rows inserted\n",count); + } + stmt->free(); + +//******************************************* + + strcpy(statement,"SELECT * FROM t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT * FROM t1"); + /*rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } */ + stmt->bindField(1,&f1var); + stmt->bindField(2,f2var); + + void *ret; + count = 0; + rv = con->beginTrans(); + if(rv!=OK)return 6; + stmt->execute(rows); + + + + while(1) + { + ret = ((char*)stmt->fetch()); + if(ret ==NULL) + { + + printf("fetch failed without prepare\n"); + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1;"); + rv = stmt->prepare(statement); + rv = stmt->execute(rows); + if(rv==OK){printf("Table dropped successfully\n");} + stmt->free(); + con->commit(); + delete stmt; + delete con; + return 0; + } + printf("Test script failed\n"); + } + delete stmt; + delete con; + return 8; +} diff --git a/test/adapter/Select/selecttest7.c b/test/adapter/Select/selecttest7.c new file mode 100644 index 00000000..ed9bf9bb --- /dev/null +++ b/test/adapter/Select/selecttest7.c @@ -0,0 +1,143 @@ +/* create table t1 with two fields, + * insert 10 rows into the table , + * call fetch without call execute,it returns NULL. +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20));"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20))"); + + int rows=0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + stmt->free(); + con->commit(); + printf("Table created\n"); + + // insert records + + strcpy(statement,"INSERT INTO t1 VALUES(?,?);"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"INSERT INTO t1 VALUES(?,?)"); + + int f1var = 1; + char f2var[20] = "lakshya"; + + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 3; + } + + int count=0; + + for(int i=0;i<2;i++) + { + + for(int j=0;j<5;j++) + { + f1var = j; + rv = con->beginTrans(); + if(rv!=OK)break; + + + stmt->setIntParam(1,f1var); + stmt->setStringParam(2,f2var); + + rv = stmt->execute(rows); + if(rv!=OK)break; + rv = con->commit(); + if(rv!=OK)break; + count++; + } + printf("%d rows inserted\n",count); + } + stmt->free(); + +//******************************************* + + strcpy(statement,"SELECT * FROM t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"SELECT * FROM t1"); + rv = stmt->prepare(statement); + + if(rv !=OK) + { + delete stmt; + delete con; + return 4; + } + + + stmt->bindField(1,&f1var); + stmt->bindField(2,f2var); + + void *ret; + count = 0; + rv = con->beginTrans(); + if(rv!=OK)return 5; + //stmt->execute(rows); + while(1) + { + + ret = ((char*)stmt->fetch()); + if(ret==NULL) + { + printf("Fetch failed without call execute\n"); + if(strcmp(getenv("DSN"),"sybase")==0){ + stmt->free(); + con->commit(); + } + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + rv = stmt->execute(rows); + if(rv==OK){ printf("Table dropped successfully\n"); } + stmt->free(); + con->commit(); + delete stmt; + delete con; + return 0; + } + printf("Test script failed\n"); + + + + } + + stmt->free(); + con->commit(); + delete stmt; + delete con; + return 7; +} + diff --git a/test/adapter/Select/selecttest8.c b/test/adapter/Select/selecttest8.c new file mode 100644 index 00000000..8c2fc355 --- /dev/null +++ b/test/adapter/Select/selecttest8.c @@ -0,0 +1,67 @@ +/* prepare,execute,free,prepare, second prepare should pass. +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20));"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20))"); + int rows=0; + + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } + printf("Prepare the Statement\n"); + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + printf("Execute the Statement\n"); + con->commit(); + stmt->free(); + printf("free all the resources\n"); + + //again prepare + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + if(rv!=OK) + { + printf("Test script failed\n"); + delete stmt; + delete con; + return 3; + } + printf("Again prepare passed\n"); + + //Drop the table + rv = stmt->execute(rows); + if(rv==OK)printf("Table dropped successfully\n"); + con->commit(); + stmt->free(); + delete stmt; + delete con; + return 0; +} + + + + diff --git a/test/adapter/Select/selecttest9.c b/test/adapter/Select/selecttest9.c new file mode 100644 index 00000000..52c6fe7a --- /dev/null +++ b/test/adapter/Select/selecttest9.c @@ -0,0 +1,60 @@ +/* prepare,execute,prepare...., + * second prepare should pass. +*/ + +#include "common.h" +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + + AbsSqlStatement *stmt = createStatement(); + stmt->setConnection(con); + char statement[200]; + + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20));"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"CREATE TABLE t1(f1 INT,f2 CHAR(20))"); + + int rows=0; + rv = stmt->prepare(statement); + if(rv!=OK) + { + delete stmt; + delete con; + return 1; + } + printf("Prepared the statement\n"); + + rv = stmt->execute(rows); + if(rv!=OK) + { + delete stmt; + delete con; + return 2; + } + printf("Execute the statement\n"); + con->commit(); + + //again prepare + + strcpy(statement,"DROP TABLE t1;"); + if(strcmp(getenv("DSN"),"db2")==0) + strcpy(statement,"DROP TABLE t1"); + rv = stmt->prepare(statement); + if(rv!=OK) + { + printf("Test script failed\n"); + return 3; + } + + printf("Test script passed\n"); + stmt->execute(rows); + con->commit(); + stmt->free(); + delete stmt; + delete con; + return 0; +} diff --git a/test/adapter/Select/singleconnadapter.c b/test/adapter/Select/singleconnadapter.c new file mode 100644 index 00000000..c3358b26 --- /dev/null +++ b/test/adapter/Select/singleconnadapter.c @@ -0,0 +1,193 @@ +/*One connection working with multiple statements + *create table T1 with two fields, + *One connection working with multiple statements simultaneously for csql, + *Create conn + *create 3 stmts for inserting into 5 tables and set the same connection + *insert into all 3 tables and commit the transaction + *free all stmts + *select the records from 3 tables in same connection + *free all stmt; + *Author : Nihar Paital + */ + +#include"common.h" + +int main() +{ + DbRetVal rv = OK; + AbsSqlConnection *con = createConnection(); + rv = con->connect("root","manager"); + if(rv!=OK)return 1; + AbsSqlStatement *stmt1 = createStatement(); + AbsSqlStatement *stmt2 = createStatement(); + AbsSqlStatement *stmt3 = createStatement(); + char statement[200]; + + stmt1->setConnection(con); + strcpy(statement,"CREATE TABLE T1(F1 INT,F2 CHAR(20));"); + int rows=0; + rv = stmt1->prepare(statement); + if(rv!=OK) { delete stmt1; delete con; return 1; } + rv = stmt1->execute(rows); + if(rv!=OK) { delete stmt1; delete con; return 2; } + printf("Table created\n"); + + stmt2->setConnection(con); + strcpy(statement,"CREATE TABLE T2(F1 INT,F2 CHAR(20));"); + rows=0; + rv = stmt2->prepare(statement); + if(rv!=OK) { delete stmt2; delete con; return 3; } + rv = stmt2->execute(rows); + if(rv!=OK) { delete stmt2; delete con; return 4; } + printf("Table created\n"); + + stmt3->setConnection(con); + strcpy(statement,"CREATE TABLE T3(F1 INT,F2 CHAR(20));"); + rows=0; + rv = stmt3->prepare(statement); + if(rv!=OK) { delete stmt3; delete con; return 5; } + rv = stmt3->execute(rows); + if(rv!=OK) { delete stmt3; delete con; return 6; } + printf("Table created\n"); + stmt1->free(); + stmt2->free(); + stmt3->free(); + +// insert records into T1 + int f1varT1 = 1; + char f2varT1[24] = "lakshya"; + printf("Inserting records into table T1\n"); + strcpy(statement,"INSERT INTO T1 VALUES(?,?);"); + rv = stmt1->prepare(statement); + if(rv!=OK) { delete stmt1; delete con; return 3; } + int count=0; + rv = con->beginTrans(); + for(int j=0;j<5;j++) { + f1varT1 = j; + if(rv!=OK)break; + stmt1->setIntParam(1,f1varT1); + stmt1->setStringParam(2,f2varT1); + rv = stmt1->execute(rows); + if(rv!=OK)break; + count++; + } + printf("%d rows inserted into table T1\n",count); + +// insert records into T2 + int f1varT2 = 1; + char f2varT2[24] = "lakshya"; + printf("Inserting records into table T2\n"); + strcpy(statement,"INSERT INTO T2 VALUES(?,?);"); + rv = stmt2->prepare(statement); + if(rv!=OK) { delete stmt2; delete con; return 3; } + count=0; + for(int j=5;j<10;j++) { + f1varT2 = j; + if(rv!=OK)break; + stmt2->setIntParam(1,f1varT2); + stmt2->setStringParam(2,f2varT2); + rv = stmt2->execute(rows); + if(rv!=OK)break; + count++; + } + printf("%d rows inserted into table T2\n",count); + +// insert records into T3 + int f1varT3 = 1; + char f2varT3[24] = "lakshya"; + printf("Inserting records into table T3\n"); + strcpy(statement,"INSERT INTO T3 VALUES(?,?);"); + rv = stmt3->prepare(statement); + if(rv!=OK) { delete stmt3; delete con; return 3; } + count=0; + for(int j=10;j<15;j++) { + f1varT3 = j; + if(rv!=OK)break; + stmt3->setIntParam(1,f1varT3); + stmt3->setStringParam(2,f2varT3); + rv = stmt3->execute(rows); + if(rv!=OK)break; + count++; + } + printf("%d rows inserted into table T3\n",count); + rv = con->commit(); + + stmt1->free(); + stmt2->free(); + stmt3->free(); +//******************************************* + printf("SELECT * FROM T1;\n"); + strcpy(statement,"SELECT * FROM T1;"); + rv = stmt1->prepare(statement); + if(rv !=OK) { delete stmt1; delete con; return 4; } + stmt1->bindField(1,&f1varT1); + stmt1->bindField(2,f2varT1); + void *ret; + count = 0; + rv = con->beginTrans(); + if(rv!=OK)return 5; + printf("T1.f1\tT1.f2\n"); + stmt1->execute(rows); + while((char*)stmt1->fetch()) { + printf("%d\t%s\n",f1varT1,f2varT1); + if(ret==NULL) { + break; + } + } + + printf("SELECT * FROM T2;\n"); + strcpy(statement,"SELECT * FROM T2;"); + rv = stmt2->prepare(statement); + if(rv !=OK) { delete stmt2; delete con; return 4; } + stmt2->bindField(1,&f1varT2); + stmt2->bindField(2,f2varT2); + count = 0; + stmt2->execute(rows); + printf("T2.f1\tT2.f2\n"); + while((char*)stmt2->fetch()) { + printf("%d\t%s\n",f1varT2,f2varT2); + if(ret==NULL) { + break; + } + } + + printf("SELECT * FROM T3;\n"); + strcpy(statement,"SELECT * FROM T3;"); + rv = stmt3->prepare(statement); + if(rv !=OK) { delete stmt3; delete con; return 4; } + stmt3->bindField(1,&f1varT3); + stmt3->bindField(2,f2varT3); + count = 0; + stmt3->execute(rows); + printf("T3.f1\tT3.f2\n"); + while((char*)stmt3->fetch()) { + printf("%d\t%s\n",f1varT3,f2varT3); + if(ret==NULL) { + break; + } + } + con->commit(); + + strcpy(statement,"DROP TABLE T1;"); + rv = stmt1->prepare(statement); + rv = stmt1->execute(rows); + if(rv==OK){printf("Table T1 dropped successfully\n");} + + strcpy(statement,"DROP TABLE T2;"); + rv = stmt2->prepare(statement); + rv = stmt2->execute(rows); + if(rv==OK){printf("Table T2 dropped successfully\n");} + + strcpy(statement,"DROP TABLE T3;"); + rv = stmt3->prepare(statement); + rv = stmt3->execute(rows); + if(rv==OK){printf("Table T3 dropped successfully\n");} + + stmt1->free(); delete stmt1; + stmt2->free(); delete stmt2; + stmt3->free(); delete stmt3; + con->commit(); + con->disconnect(); + delete con; + return 0; +} diff --git a/test/adapter/Select/test001na.ksh b/test/adapter/Select/test001na.ksh new file mode 100755 index 00000000..a8152f07 --- /dev/null +++ b/test/adapter/Select/test001na.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#create table T1 with 10 fields, +#insert 10 rows into the table , +#noofprojFields shoul dreturn 10. +#call fetch and count the record. +# +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + if [ $DSN = "psql" ] + then + echo TARGET_DATABASE=postgres >>$CSQL_CONFIG_FILE + else + echo TARGET_DATABASE=mysql >>$CSQL_CONFIG_FILE + fi + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + echo TARGET_DATABASE=oracle >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 4 +${REL_PATH}/selecttest1na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test002na.ksh b/test/adapter/Select/test002na.ksh new file mode 100755 index 00000000..3f3ea014 --- /dev/null +++ b/test/adapter/Select/test002na.ksh @@ -0,0 +1,49 @@ +#!/bin/ksh +#create table T1 with 10 fields, +#insert 10 rows into the table , +#noofprojFields should return 5. +#getProjFldInfo() for all fields. +#select with 5 parameters withIwhere clause.(WHERE F1=100) +# + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + if [ $DSN = "psql" ] + then + echo TARGET_DATABASE=postgres >>$CSQL_CONFIG_FILE + else + echo TARGET_DATABASE=mysql >>$CSQL_CONFIG_FILE + fi + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + echo TARGET_DATABASE=oracle >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/selecttest2na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test003na.ksh b/test/adapter/Select/test003na.ksh new file mode 100755 index 00000000..1e396494 --- /dev/null +++ b/test/adapter/Select/test003na.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#create table t1 with two fields, +#insert 10 rows into the table , +#select from nonexisting table. +# + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + if [ "$DSN" = "psql" ] + then + echo TARGET_DATABASE=postgres >>$CSQL_CONFIG_FILE + else + echo TARGET_DATABASE=mysql >>$CSQL_CONFIG_FILE + fi + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + echo TARGET_DATABASE=oracle >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/selecttest3na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test004na.ksh b/test/adapter/Select/test004na.ksh new file mode 100755 index 00000000..df2f2398 --- /dev/null +++ b/test/adapter/Select/test004na.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#create table t1 with two fields, +#insert 10 rows into the table , +#select with nonexisting fields. +# + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + if [ $DSN = "psql" ] + then + echo TARGET_DATABASE=postgres >>$CSQL_CONFIG_FILE + else + echo TARGET_DATABASE=mysql >>$CSQL_CONFIG_FILE + fi + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + echo TARGET_DATABASE=oracle >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/selecttest4na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test005na.ksh b/test/adapter/Select/test005na.ksh new file mode 100755 index 00000000..9393d87d --- /dev/null +++ b/test/adapter/Select/test005na.ksh @@ -0,0 +1,45 @@ +#!/bin/ksh +#call execute without calling prepare. it should fail. + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + if [ $DSN = "psql" ] + then + echo TARGET_DATABASE=postgres >>$CSQL_CONFIG_FILE + else + echo TARGET_DATABASE=mysql >>$CSQL_CONFIG_FILE + fi + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + echo TARGET_DATABASE=oracle >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/selecttest5na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test006na.ksh b/test/adapter/Select/test006na.ksh new file mode 100755 index 00000000..98f16c22 --- /dev/null +++ b/test/adapter/Select/test006na.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#create table t1 with two fields, +#insert 10 rows into the table , +#fetch without prepare. +# + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + if [ $DSN = "psql" ] + then + echo TARGET_DATABASE=postgres >>$CSQL_CONFIG_FILE + else + echo TARGET_DATABASE=mysql >>$CSQL_CONFIG_FILE + fi + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + echo TARGET_DATABASE=oracle >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/selecttest6na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test007na.ksh b/test/adapter/Select/test007na.ksh new file mode 100755 index 00000000..94ad3140 --- /dev/null +++ b/test/adapter/Select/test007na.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#create table t1 with two fields, +#insert 10 rows into the table , +#call fetch without call execute,it returns NULL. +# + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + if [ $DSN = "psql" ] + then + echo TARGET_DATABASE=postgres >>$CSQL_CONFIG_FILE + else + echo TARGET_DATABASE=mysql >>$CSQL_CONFIG_FILE + fi + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + echo TARGET_DATABASE=oracle >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/selecttest7na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test008na.ksh b/test/adapter/Select/test008na.ksh new file mode 100755 index 00000000..76779e60 --- /dev/null +++ b/test/adapter/Select/test008na.ksh @@ -0,0 +1,46 @@ +#!/bin/ksh +# prepare,execute,free,prepare, second prepare should pass. +# + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + if [ $DSN = "psql" ] + then + echo TARGET_DATABASE=postgres >>$CSQL_CONFIG_FILE + else + echo TARGET_DATABASE=mysql >>$CSQL_CONFIG_FILE + fi + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + echo TARGET_DATABASE=oracle >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/selecttest8na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test009na.ksh b/test/adapter/Select/test009na.ksh new file mode 100755 index 00000000..9eded3b5 --- /dev/null +++ b/test/adapter/Select/test009na.ksh @@ -0,0 +1,47 @@ +#!/bin/ksh +#prepare,execute,prepare...., +#second prepare should pass. +# + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +if [ -z "$DBUSER" ] +then + echo DSN=$DSN >>$CSQL_CONFIG_FILE + if [ $DSN = "psql" ] + then + echo TARGET_DATABASE=postgres >>$CSQL_CONFIG_FILE + else + echo TARGET_DATABASE=mysql >>$CSQL_CONFIG_FILE + fi + DS=$DSN +else + echo DSN=$DSN >>$CSQL_CONFIG_FILE + echo DBUSER=$DBUSER >>$CSQL_CONFIG_FILE + echo PASSWORD=$PASSWORD >>$CSQL_CONFIG_FILE + echo TARGET_DATABASE=oracle >>$CSQL_CONFIG_FILE + DS="$DSN $DBUSER $PASSWORD" +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 3 +${REL_PATH}/selecttest9na +if [ $? -ne 0 ] +then + kill -9 $pid + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test010na.ksh b/test/adapter/Select/test010na.ksh new file mode 100755 index 00000000..4101eec6 --- /dev/null +++ b/test/adapter/Select/test010na.ksh @@ -0,0 +1,43 @@ +#!/bin/ksh +#create table T1 with 10 fields,( F2 NOT NULL , F3 CHAR(20) DEFAULT 'LAKSHYA') +#insert 10 rows for 9 Fields except F3 Field into the table +#noofprojFields should return 5. +#getProjFldInfo() for all fields. +#select with 5 parameters withIwhere clause.(WHERE F1=100) +# + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +echo DSN=$DSN >>$CSQL_CONFIG_FILE +DS="$DSN $DBUSER $PASSWORD" +rm -f /tmp/csql/csqlds.conf +touch /tmp/csql/csqlds.conf +$CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a +if [ $? -ne 0 ] +then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +${REL_PATH}/selecttest10na +if [ $? -ne 0 ] +then + kill -9 $pid + kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'` + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/adapter/Select/test011na.ksh b/test/adapter/Select/test011na.ksh new file mode 100755 index 00000000..6d26bfe5 --- /dev/null +++ b/test/adapter/Select/test011na.ksh @@ -0,0 +1,48 @@ +#!/bin/ksh +#One connection working with multiple statements +#create table T1 with two fields, +#One connection working with multiple statements simultaneously for csql, +#Create conn +#create 3 stmts for inserting into 5 tables and set the same connection +#insert into all 3 tables and commit the transaction +#free all stmts +#select the records from 3 tables in same connection +#free all stmt; +#Author : Nihar Paital +# + +CSQL_CONF=${PWD}/adapter/Select/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=${PWD}/adapter/Select +fi + +rm -f /tmp/csql.conf +cp $REL_PATH/csql.conf /tmp/csql.conf +echo CSQL_SQL_SERVER=true >>/tmp/csql.conf +#echo PORT= >>/tmp/csql.conf +export CSQL_CONFIG_FILE=/tmp/csql.conf +echo DSN=$DSN >>$CSQL_CONFIG_FILE +DS="$DSN $DBUSER $PASSWORD" +rm -f /tmp/csql/csqlds.conf +touch /tmp/csql/csqlds.conf +$CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a +if [ $? -ne 0 ] +then + exit 1; +fi + +$CSQL_INSTALL_ROOT/bin/csqlsqlserver >/dev/null 2>&1 & +pid=$! +sleep 5 +${REL_PATH}/singleconnadapterna +if [ $? -ne 0 ] +then + kill -9 $pid + kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'` + exit 1; +fi +rm -f /tmp/csql.conf +kill -9 $pid +exit 0; diff --git a/test/system/Allocator/Makefile b/test/system/Allocator/Makefile new file mode 100644 index 00000000..061dd14e --- /dev/null +++ b/test/system/Allocator/Makefile @@ -0,0 +1,76 @@ +OSNAME = $(shell uname -s) +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + + +INCL= -I$(CSQL_INSTALL_ROOT)/include -I../../../include +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcsql + +TARGETS = \ + create createNoIndex drop \ + insert1 insert100 insert1000 delete1 delete100 delete1000 deleteAll \ + test010 test011\ + test025 test021 test022 test023 test024 + + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +create: create.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +createNoIndex: createNoIndex.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +drop: drop.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +insert1: insert1.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +insert1000: insert1000.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +insert100: insert100.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +delete1: delete1.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +delete1000: delete1000.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +delete100: delete100.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +deleteAll: deleteAll.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test010: dbsizelimit.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test011: dbsizelimit1.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test021: tuplesize1.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test022: tuplesize2.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test023: tuplesize3.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test024: tuplesize4.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test025: tuplesize5.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +clean: + rm -f $(TARGETS) + diff --git a/test/system/Allocator/TODO b/test/system/Allocator/TODO new file mode 100644 index 00000000..a39f1859 --- /dev/null +++ b/test/system/Allocator/TODO @@ -0,0 +1,2 @@ +test008.ksh - +dbsize to 100 MB, insert 1 million tuples, select 1 million tuples (READ_REPEATED) which generaes lot of lock nodes. check whether that returns proper error diff --git a/test/system/Allocator/common.h b/test/system/Allocator/common.h new file mode 100644 index 00000000..32b61b64 --- /dev/null +++ b/test/system/Allocator/common.h @@ -0,0 +1,153 @@ +#include +DbRetVal createIndex(DatabaseManager *dbMgr, char *tblname, char *fldname, char *indname) +{ + HashIndexInitInfo *idxInfo = new HashIndexInitInfo(); + strcpy(idxInfo->tableName, tblname); + idxInfo->list.append(fldname); + idxInfo->indType = hashIndex; + idxInfo->isUnique = true; + DbRetVal rv = dbMgr->createIndex(indname, idxInfo); + if (rv != OK) { + printf("Index creation failed\n"); + delete idxInfo; + return rv; + } + printf("Index created for %s\n", fldname); + delete idxInfo; + return OK; +} +DbRetVal createTable(DatabaseManager *dbMgr, char *tblname) +{ + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeInt); + DbRetVal rv = dbMgr->createTable(tblname, tabDef); + if (rv != OK) { printf("Table creation failed\n"); return rv; } + printf("Table created\n"); + return OK; +} +DbRetVal dropTable(DatabaseManager *dbMgr, char *tblname) +{ + DbRetVal rv = dbMgr->dropTable(tblname); + if (rv != OK) { printf("Table drop failed\n"); return rv; } + printf("Table Dropped\n"); + return OK; +} +int insertTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + int id1 = 0; + table->bindFld("f1", &id1); + table->bindFld("f2", &id1); + int icount =0; + DbRetVal rv = OK; + rv = conn.startTransaction(); + if (rv != OK) { dbMgr->closeTable(table); return 1; } + for (int i = 0 ; i < count ; i++) + { + id1= i; + rv = table->insertTuple(); + if (rv != OK) break; + icount++; + + } + conn.commit(); + printf("Total Tuples inserted is %d\n", icount); + dbMgr->closeTable(table); + return icount; +} +int deleteTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + DbRetVal rv = OK; + + Condition p1; + int val1 = 0; + p1.setTerm("f1", OpEquals, &val1); + table->setCondition(&p1); + + rv = conn.startTransaction(); + if (rv != OK) { dbMgr->closeTable(table); return 1; } + int i =0; + void *tuple; + for (i = 0 ; i < count ; i++) + { + val1 = i; + table->execute(); + if (rv != OK) break; + tuple = (char*)table->fetch() ; + if (tuple == NULL) break; + rv = table->deleteTuple(); + if (rv != OK) break; + table->closeScan(); + } + conn.commit(); + printf("Total Tuples deleted is %d\n", i); + dbMgr->closeTable(table); + return i; +} +int deleteAllTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + DbRetVal rv = OK; + + table->setCondition(NULL); + + rv = conn.startTransaction(); + if (rv != OK) { dbMgr->closeTable(table); return 1; } + int count =0; + table->execute(); + void *tuple; + while ((tuple = (char*) table->fetch())) { + rv = table->deleteTuple(); + if (rv != OK) break; + count++; + } + table->closeScan(); + + conn.commit(); + printf("Total Tuples deleted is %d\n", count); + dbMgr->closeTable(table); + return count; +} +int totalTuples(DatabaseManager *dbMgr, Connection &conn, char *tblname) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + DbRetVal rv = OK; + + table->setCondition(NULL); + + rv = conn.startTransaction(); + if (rv != OK) { dbMgr->closeTable(table); return 1; } + int count =0; + table->execute(); + void *tuple; + while ((tuple = (char*) table->fetch())) { + count++; + } + table->closeScan(); + + conn.commit(); + dbMgr->closeTable(table); + return count; +} diff --git a/test/system/Allocator/create.c b/test/system/Allocator/create.c new file mode 100644 index 00000000..d6fdc37f --- /dev/null +++ b/test/system/Allocator/create.c @@ -0,0 +1,17 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + if ( createTable(dbMgr, "t1") != 0 ) { ret = 3; } + if ( createIndex(dbMgr, "t1", "f1", "t1idx1") != 0 ) { ret= 3; } + + conn.close(); + return ret; + +} diff --git a/test/system/Allocator/createNoIndex.c b/test/system/Allocator/createNoIndex.c new file mode 100644 index 00000000..e0aea7ec --- /dev/null +++ b/test/system/Allocator/createNoIndex.c @@ -0,0 +1,15 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + if ( createTable(dbMgr, "t1") != 0 ) { ret = 3; } + conn.close(); + return ret; + +} diff --git a/test/system/Allocator/dbsizelimit.c b/test/system/Allocator/dbsizelimit.c new file mode 100644 index 00000000..3ca25b56 --- /dev/null +++ b/test/system/Allocator/dbsizelimit.c @@ -0,0 +1,47 @@ +//Test Case: Insert 10K tuples in one single transaction +//It should fail saying "no space in system db for creating undo logs" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeString, 196); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); conn.close(); return 3; } + printf("Table created\n"); + + Table *table = dbMgr->openTable("t1"); + if (table == NULL) + { + printf("Unable to open table\n"); + dbMgr->dropTable("t1"); + conn.close(); + return -1; + } + int id1 = 0, id2 = 5; + char name[20] = "PRAVEEN"; + table->bindFld("f1", &id1); + table->bindFld("f2", &id2); + int icount =0; + for (int i = 0 ; i < 10 ; i++) + { + conn.startTransaction(); + for (int j = 0 ; j < 10000 ; j++) { + id1= icount++; + rv = table->insertTuple(); + if (rv != OK) break; + } + if (rv != OK) break; + conn.commit(); + } + dbMgr->closeTable(table); + dbMgr->dropTable("t1"); + conn.close(); + if (rv == ErrNoMemory) return 0; else return 1; +} diff --git a/test/system/Allocator/dbsizelimit1.c b/test/system/Allocator/dbsizelimit1.c new file mode 100644 index 00000000..bc98356a --- /dev/null +++ b/test/system/Allocator/dbsizelimit1.c @@ -0,0 +1,47 @@ +//Test Case: Insert 50K tuples such that it execeeds the user db size +//It should fail saying "no space in userdb" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeString, 196); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); conn.close(); return 3; } + printf("Table created\n"); + + Table *table = dbMgr->openTable("t1"); + if (table == NULL) + { + printf("Unable to open table\n"); + dbMgr->dropTable("t1"); + conn.close(); + return -1; + } + int id1 = 0, id2 = 5; + char name[20] = "PRAVEEN"; + table->bindFld("f1", &id1); + table->bindFld("f2", &id2); + int icount =0; + for (int i = 0 ; i < 1000 ; i++) + { + conn.startTransaction(); + for (int j = 0 ; j < 1000 ; j++) { + id1= icount++; + rv = table->insertTuple(); + if (rv != OK) break; + } + if (rv != OK) break; + conn.commit(); + } + dbMgr->closeTable(table); + dbMgr->dropTable("t1"); + conn.close(); + if (rv == ErrNoMemory) return 0; else return 1; +} diff --git a/test/system/Allocator/delete1.c b/test/system/Allocator/delete1.c new file mode 100644 index 00000000..b757f24f --- /dev/null +++ b/test/system/Allocator/delete1.c @@ -0,0 +1,15 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + ret = deleteTuple(dbMgr, conn, "t1", 1); + conn.close(); + return ret; + +} diff --git a/test/system/Allocator/delete100.c b/test/system/Allocator/delete100.c new file mode 100644 index 00000000..a9a1f64e --- /dev/null +++ b/test/system/Allocator/delete100.c @@ -0,0 +1,15 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + ret = deleteTuple(dbMgr, conn, "t1", 1000); + conn.close(); + return ret; + +} diff --git a/test/system/Allocator/delete1000.c b/test/system/Allocator/delete1000.c new file mode 100644 index 00000000..a9a1f64e --- /dev/null +++ b/test/system/Allocator/delete1000.c @@ -0,0 +1,15 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + ret = deleteTuple(dbMgr, conn, "t1", 1000); + conn.close(); + return ret; + +} diff --git a/test/system/Allocator/deleteAll.c b/test/system/Allocator/deleteAll.c new file mode 100644 index 00000000..3e4062a4 --- /dev/null +++ b/test/system/Allocator/deleteAll.c @@ -0,0 +1,15 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + ret = deleteAllTuple(dbMgr, conn, "t1"); + conn.close(); + return ret; + +} diff --git a/test/system/Allocator/drop.c b/test/system/Allocator/drop.c new file mode 100644 index 00000000..88eec578 --- /dev/null +++ b/test/system/Allocator/drop.c @@ -0,0 +1,15 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + if ( dropTable(dbMgr, "t1") != 0 ) { ret = 3; } + conn.close(); + return ret; + +} diff --git a/test/system/Allocator/exp.test001.ksh b/test/system/Allocator/exp.test001.ksh new file mode 100644 index 00000000..d7996884 --- /dev/null +++ b/test/system/Allocator/exp.test001.ksh @@ -0,0 +1,63 @@ +Table created +Index created for f1 +Tables and Indexes are created +Total Tuples inserted is 1 +Tuples inserted into table +Case 1: -T option for t1: with 1 tuple + + t1 + 1 + 1 + 32 + 1 + 12 + 2 + + t1idx1 + +
+Case 2: -I option for idx1 of t1, with 1 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 1 + + +Total Tuples deleted is 1 +Tuples deleted from table +Case 3: -T option for t1: after removing 1 tuple + + t1 + 0 + 1 + 16 + 1 + 12 + 2 + + t1idx1 + +
+Case 4: -I option for idx1 of t1, after removing 1 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 0 + + +Table Dropped +Tables and Indexes are dropped diff --git a/test/system/Allocator/exp.test001.ksh.x86_64 b/test/system/Allocator/exp.test001.ksh.x86_64 new file mode 100644 index 00000000..eb1c3f38 --- /dev/null +++ b/test/system/Allocator/exp.test001.ksh.x86_64 @@ -0,0 +1,63 @@ +Table created +Index created for f1 +Tables and Indexes are created +Total Tuples inserted is 1 +Tuples inserted into table +Case 1: -T option for t1: with 1 tuple + + t1 + 1 + 1 + 48 + 1 + 16 + 2 + + t1idx1 + +
+Case 2: -I option for idx1 of t1, with 1 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 1 + + +Total Tuples deleted is 1 +Tuples deleted from table +Case 3: -T option for t1: after removing 1 tuple + + t1 + 0 + 1 + 24 + 1 + 16 + 2 + + t1idx1 + +
+Case 4: -I option for idx1 of t1, after removing 1 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 0 + + +Table Dropped +Tables and Indexes are dropped diff --git a/test/system/Allocator/exp.test002.ksh b/test/system/Allocator/exp.test002.ksh new file mode 100644 index 00000000..bf4c227f --- /dev/null +++ b/test/system/Allocator/exp.test002.ksh @@ -0,0 +1,64 @@ +Table created +Index created for f1 +Tables and Indexes are created +Total Tuples inserted is 1000 +Tuples inserted into table +Case 1: -T option for t1: with 1000 tuple +Tables and Indexes are created + + t1 + 1000 + 2 + 16032 + 1 + 12 + 2 + + t1idx1 + +
+Case 2: -I option for idx1 of t1, with 1000 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 2 + 1000 + + +Total Tuples deleted is 1000 +Tuples deleted from table +Case 3: -T option for t1: after removing 1000 tuple + + t1 + 0 + 2 + 32 + 1 + 12 + 2 + + t1idx1 + +
+Case 4: -I option for idx1 of t1, after removing 1000 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 2 + 0 + + +Table Dropped +Tables and Indexes are dropped diff --git a/test/system/Allocator/exp.test002.ksh.x86_64 b/test/system/Allocator/exp.test002.ksh.x86_64 new file mode 100644 index 00000000..8f705a41 --- /dev/null +++ b/test/system/Allocator/exp.test002.ksh.x86_64 @@ -0,0 +1,64 @@ +Table created +Index created for f1 +Tables and Indexes are created +Total Tuples inserted is 1000 +Tuples inserted into table +Case 1: -T option for t1: with 1000 tuple +Tables and Indexes are created + + t1 + 1000 + 3 + 24072 + 1 + 16 + 2 + + t1idx1 + +
+Case 2: -I option for idx1 of t1, with 1000 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 4 + 1000 + + +Total Tuples deleted is 1000 +Tuples deleted from table +Case 3: -T option for t1: after removing 1000 tuple + + t1 + 0 + 3 + 72 + 1 + 16 + 2 + + t1idx1 + +
+Case 4: -I option for idx1 of t1, after removing 1000 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 4 + 0 + + +Table Dropped +Tables and Indexes are dropped diff --git a/test/system/Allocator/exp.test003.ksh b/test/system/Allocator/exp.test003.ksh new file mode 100644 index 00000000..e1726c70 --- /dev/null +++ b/test/system/Allocator/exp.test003.ksh @@ -0,0 +1,63 @@ +Table created +Index created for f1 +Tables and Indexes are created +Total Tuples inserted is 100 +Tuples inserted into table +Case 1: -T option for t1: with 100 tuple + + t1 + 100 + 1 + 1616 + 1 + 12 + 2 + + t1idx1 + +
+Case 2: -I option for idx1 of t1, with 100 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 100 + + +Total Tuples deleted is 1 +Tuples deleted from table +Case 3: -T option for t1: after removing 1 tuple + + t1 + 99 + 1 + 1600 + 1 + 12 + 2 + + t1idx1 + +
+Case 4: -I option for idx1 of t1, after removing 1 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 99 + + +Table Dropped +Tables and Indexes are dropped diff --git a/test/system/Allocator/exp.test003.ksh.x86_64 b/test/system/Allocator/exp.test003.ksh.x86_64 new file mode 100644 index 00000000..820ce0ca --- /dev/null +++ b/test/system/Allocator/exp.test003.ksh.x86_64 @@ -0,0 +1,63 @@ +Table created +Index created for f1 +Tables and Indexes are created +Total Tuples inserted is 100 +Tuples inserted into table +Case 1: -T option for t1: with 100 tuple + + t1 + 100 + 1 + 2424 + 1 + 16 + 2 + + t1idx1 + +
+Case 2: -I option for idx1 of t1, with 100 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 100 + + +Total Tuples deleted is 1 +Tuples deleted from table +Case 3: -T option for t1: after removing 1 tuple + + t1 + 99 + 1 + 2400 + 1 + 16 + 2 + + t1idx1 + +
+Case 4: -I option for idx1 of t1, after removing 1 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 99 + + +Table Dropped +Tables and Indexes are dropped diff --git a/test/system/Allocator/exp.test004.ksh b/test/system/Allocator/exp.test004.ksh new file mode 100644 index 00000000..9b1deb08 --- /dev/null +++ b/test/system/Allocator/exp.test004.ksh @@ -0,0 +1,63 @@ +Table created +Index created for f1 +Tables and Indexes are created +Total Tuples inserted is 100 +Tuples inserted into table +Case 1: -T option for t1: with 100 tuple + + t1 + 100 + 1 + 1616 + 1 + 12 + 2 + + t1idx1 + +
+Case 2: -I option for idx1 of t1, with 100 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 100 + + +Total Tuples deleted is 100 +Tuples deleted from table +Case 3: -T option for t1: after removing all tuple + + t1 + 0 + 1 + 16 + 1 + 12 + 2 + + t1idx1 + +
+Case 4: -I option for idx1 of t1, after removing all tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 0 + + +Table Dropped +Tables and Indexes are dropped diff --git a/test/system/Allocator/exp.test004.ksh.x86_64 b/test/system/Allocator/exp.test004.ksh.x86_64 new file mode 100644 index 00000000..f80eb958 --- /dev/null +++ b/test/system/Allocator/exp.test004.ksh.x86_64 @@ -0,0 +1,63 @@ +Table created +Index created for f1 +Tables and Indexes are created +Total Tuples inserted is 100 +Tuples inserted into table +Case 1: -T option for t1: with 100 tuple + + t1 + 100 + 1 + 2424 + 1 + 16 + 2 + + t1idx1 + +
+Case 2: -I option for idx1 of t1, with 100 tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 100 + + +Total Tuples deleted is 100 +Tuples deleted from table +Case 3: -T option for t1: after removing all tuple + + t1 + 0 + 1 + 24 + 1 + 16 + 2 + + t1idx1 + +
+Case 4: -I option for idx1 of t1, after removing all tuple + + t1idx1 + 1 + Hash Index + + 1 + 1009 + + + 1 + 0 + + +Table Dropped +Tables and Indexes are dropped diff --git a/test/system/Allocator/exp.test005.ksh b/test/system/Allocator/exp.test005.ksh new file mode 100644 index 00000000..4e580b23 --- /dev/null +++ b/test/system/Allocator/exp.test005.ksh @@ -0,0 +1,114 @@ +Case 1: -d option with no table + + + SYSTEMDB + 1048576 + 17d7c000 + 113 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + +Table created +Tables and Indexes are created +Case 2: -d option with 1 table + + + SYSTEMDB + 1048576 + 17d7c000 + 113 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 1 + 0 + 1 + + +Table Dropped +Case 3: -d option after removing table + + + SYSTEMDB + 1048576 + 17d7c000 + 113 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + diff --git a/test/system/Allocator/exp.test005.ksh.x86_64 b/test/system/Allocator/exp.test005.ksh.x86_64 new file mode 100644 index 00000000..d248e4fe --- /dev/null +++ b/test/system/Allocator/exp.test005.ksh.x86_64 @@ -0,0 +1,114 @@ +Case 1: -d option with no table + + + SYSTEMDB + 1048576 + 17d7c000 + 112 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + +Table created +Tables and Indexes are created +Case 2: -d option with 1 table + + + SYSTEMDB + 1048576 + 17d7c000 + 112 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 1 + 0 + 1 + + +Table Dropped +Case 3: -d option after removing table + + + SYSTEMDB + 1048576 + 17d7c000 + 112 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + diff --git a/test/system/Allocator/exp.test006.ksh b/test/system/Allocator/exp.test006.ksh new file mode 100644 index 00000000..c49259ac --- /dev/null +++ b/test/system/Allocator/exp.test006.ksh @@ -0,0 +1,115 @@ +Case 1: -d option with no table + + + SYSTEMDB + 1048576 + 17d7c000 + 113 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + +Table created +Index created for f1 +Tables and Indexes are created +Case 2: -d option with 1 table + + + SYSTEMDB + 1048576 + 17d7c000 + 113 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1276 + 2 + 1 + 3 + + +Table Dropped +Case 3: -d option after removing table + + + SYSTEMDB + 1048576 + 17d7c000 + 113 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + diff --git a/test/system/Allocator/exp.test006.ksh.x86_64 b/test/system/Allocator/exp.test006.ksh.x86_64 new file mode 100644 index 00000000..b828a104 --- /dev/null +++ b/test/system/Allocator/exp.test006.ksh.x86_64 @@ -0,0 +1,115 @@ +Case 1: -d option with no table + + + SYSTEMDB + 1048576 + 17d7c000 + 112 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + +Table created +Index created for f1 +Tables and Indexes are created +Case 2: -d option with 1 table + + + SYSTEMDB + 1048576 + 17d7c000 + 112 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1276 + 2 + 1 + 3 + + +Table Dropped +Case 3: -d option after removing table + + + SYSTEMDB + 1048576 + 17d7c000 + 112 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + diff --git a/test/system/Allocator/exp.test007.ksh b/test/system/Allocator/exp.test007.ksh new file mode 100644 index 00000000..d5a7af5e --- /dev/null +++ b/test/system/Allocator/exp.test007.ksh @@ -0,0 +1,375 @@ +Case 1: -d option with no table + + + SYSTEMDB + 1048576 + 17d7c000 + 113 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + +Tables and Indexes are created +Case 2: -d option with 1 table +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped + + + SYSTEMDB + 1048576 + 17d7c000 + 113 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + diff --git a/test/system/Allocator/exp.test007.ksh.x86_64 b/test/system/Allocator/exp.test007.ksh.x86_64 new file mode 100644 index 00000000..4acad1e0 --- /dev/null +++ b/test/system/Allocator/exp.test007.ksh.x86_64 @@ -0,0 +1,375 @@ +Case 1: -d option with no table + + + SYSTEMDB + 1048576 + 17d7c000 + 112 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + +Tables and Indexes are created +Case 2: -d option with 1 table +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped +Table created +Index created for f1 +Table Dropped + + + SYSTEMDB + 1048576 + 17d7c000 + 112 + 13 + 2 + 15 + + + 1 + 99 + + + 0 + 100 + + 0 + + + + 2048 + 0 + 0 + + + userdb + 10485760 + 17e7a000 + 1279 + 0 + 0 + 0 + + diff --git a/test/system/Allocator/exp.test021 b/test/system/Allocator/exp.test021 new file mode 100644 index 00000000..2ee9d5fa --- /dev/null +++ b/test/system/Allocator/exp.test021 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 16 + 0 + 8 + 1 + + diff --git a/test/system/Allocator/exp.test021.x86_64 b/test/system/Allocator/exp.test021.x86_64 new file mode 100644 index 00000000..b5ddbdcd --- /dev/null +++ b/test/system/Allocator/exp.test021.x86_64 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 24 + 0 + 8 + 1 + + diff --git a/test/system/Allocator/exp.test022 b/test/system/Allocator/exp.test022 new file mode 100644 index 00000000..f7fc98ee --- /dev/null +++ b/test/system/Allocator/exp.test022 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 16 + 0 + 12 + 2 + + diff --git a/test/system/Allocator/exp.test022.x86_64 b/test/system/Allocator/exp.test022.x86_64 new file mode 100644 index 00000000..7fa6ad37 --- /dev/null +++ b/test/system/Allocator/exp.test022.x86_64 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 24 + 0 + 16 + 2 + + diff --git a/test/system/Allocator/exp.test023 b/test/system/Allocator/exp.test023 new file mode 100644 index 00000000..1b5cf587 --- /dev/null +++ b/test/system/Allocator/exp.test023 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 16 + 0 + 16 + 3 + + diff --git a/test/system/Allocator/exp.test023.x86_64 b/test/system/Allocator/exp.test023.x86_64 new file mode 100644 index 00000000..b05fe918 --- /dev/null +++ b/test/system/Allocator/exp.test023.x86_64 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 24 + 0 + 16 + 3 + + diff --git a/test/system/Allocator/exp.test024 b/test/system/Allocator/exp.test024 new file mode 100644 index 00000000..48c07c6c --- /dev/null +++ b/test/system/Allocator/exp.test024 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 16 + 0 + 24 + 4 + + diff --git a/test/system/Allocator/exp.test024.x86_64 b/test/system/Allocator/exp.test024.x86_64 new file mode 100644 index 00000000..2835c1ef --- /dev/null +++ b/test/system/Allocator/exp.test024.x86_64 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 24 + 0 + 24 + 4 + + diff --git a/test/system/Allocator/exp.test025 b/test/system/Allocator/exp.test025 new file mode 100644 index 00000000..6d52c88a --- /dev/null +++ b/test/system/Allocator/exp.test025 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 16 + 0 + 28 + 5 + + diff --git a/test/system/Allocator/exp.test025.x86_64 b/test/system/Allocator/exp.test025.x86_64 new file mode 100644 index 00000000..6afba8eb --- /dev/null +++ b/test/system/Allocator/exp.test025.x86_64 @@ -0,0 +1,10 @@ +Table created + t1 + 0 + 1 + 24 + 0 + 32 + 5 + + diff --git a/test/system/Allocator/insert1.c b/test/system/Allocator/insert1.c new file mode 100644 index 00000000..a1ecf244 --- /dev/null +++ b/test/system/Allocator/insert1.c @@ -0,0 +1,15 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + ret = insertTuple(dbMgr, conn, "t1", 1); + conn.close(); + return ret; + +} diff --git a/test/system/Allocator/insert100.c b/test/system/Allocator/insert100.c new file mode 100644 index 00000000..ccca77a0 --- /dev/null +++ b/test/system/Allocator/insert100.c @@ -0,0 +1,15 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + ret = insertTuple(dbMgr, conn, "t1", 100); + conn.close(); + return ret; + +} diff --git a/test/system/Allocator/insert1000.c b/test/system/Allocator/insert1000.c new file mode 100644 index 00000000..015c12ef --- /dev/null +++ b/test/system/Allocator/insert1000.c @@ -0,0 +1,14 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + ret = insertTuple(dbMgr, conn, "t1", 1000); + conn.close(); + return ret; +} diff --git a/test/system/Allocator/test001.ksh b/test/system/Allocator/test001.ksh new file mode 100755 index 00000000..14aabe07 --- /dev/null +++ b/test/system/Allocator/test001.ksh @@ -0,0 +1,114 @@ +#!/bin/ksh +# TestCase: +# create table with two fields and index on first field +# insert 1 tuple +# check number of tuples, totalPagesused +# check pagesUsed for storing hash bucket +# check number of index nodes, pagesUsed for storing index nodes +# delete 1 tuple +# check number of tuples, totalPagesused +# check pagesUsed for storing hash bucket +# check number of index nodes, pagesUsed for storing index nodes + +# Note: spaceused for table = noOfDataNodes * sizeofTuple + noOfPages * sizeofPageInfo +#Note:Thats why we see spaceused as 16 even when no tuple exist + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail +EXECUTABLE=${PWD}/system/Allocator/create +REL_PATH=. +if [ -s "$EXECUTABLE" ] +then + REL_PATH=${PWD}/system/Allocator +fi + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2> $0.valgr +else + ${REL_PATH}/create + if [ $? -ne 0 ] + then + exit 100; + fi +fi + +echo "Tables and Indexes are created" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert1 2>> $0.valgr +else + ${REL_PATH}/insert1 + if [ $? -ne 1 ] + then + exit 100; + fi +fi +echo "Tuples inserted into table" +echo "Case 1: -T option for t1: with 1 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 + if [ $? -ne 0 ] + then + exit 1; + fi +fi +echo "Case 2: -I option for idx1 of t1, with 1 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 + if [ $? -ne 0 ] + then + exit 2; + fi +fi + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/delete1 2>> $0.valgr +else + ${REL_PATH}/delete1 + if [ $? -ne 1 ] + then + exit 100; + fi +fi + +echo "Tuples deleted from table" +echo "Case 3: -T option for t1: after removing 1 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 + if [ $? -ne 0 ] + then + exit 3; + fi +fi + +echo "Case 4: -I option for idx1 of t1, after removing 1 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 + if [ $? -ne 0 ] + then + exit 4; + fi +fi + +${REL_PATH}/drop +if [ $? -ne 0 ] +then + exit 100; +fi +echo "Tables and Indexes are dropped" + +exit 0 diff --git a/test/system/Allocator/test002.ksh b/test/system/Allocator/test002.ksh new file mode 100755 index 00000000..fa98fc2d --- /dev/null +++ b/test/system/Allocator/test002.ksh @@ -0,0 +1,103 @@ +#!/bin/ksh +# TestCase: +# create table with two fields and index on first field +# insert 1000 tuple +# check number of tuples, totalPagesused +# check pagesUsed for storing hash bucket +# check number of index nodes, pagesUsed for storing index nodes +# delete 1000 tuple +# check number of tuples, totalPagesused +# check pagesUsed for storing hash bucket +# check number of index nodes, pagesUsed for storing index nodes + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail +EXECUTABLE=${PWD}/system/Allocator/create +REL_PATH=. +if [ -s "$EXECUTABLE" ] +then + REL_PATH=${PWD}/system/Allocator +fi + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2> $0.valgr +else + ${REL_PATH}/create + if [ $? -ne 0 ] + then + exit 1; + fi +fi +echo "Tables and Indexes are created" + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert1000 2>> $0.valgr +else + ${REL_PATH}/insert1000 + echo "Tuples inserted into table" + echo "Case 1: -T option for t1: with 1000 tuple" +fi + +echo "Tables and Indexes are created" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 + if [ $? -ne 0 ] + then + exit 2; + fi +fi +echo "Case 2: -I option for idx1 of t1, with 1000 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 + if [ $? -ne 0 ] + then + exit 2; + fi +fi + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/delete1000 2>> $0.valgr +else + ${REL_PATH}/delete1000 +fi + +echo "Tuples deleted from table" +echo "Case 3: -T option for t1: after removing 1000 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 + if [ $? -ne 0 ] + then + exit 3; + fi +fi +echo "Case 4: -I option for idx1 of t1, after removing 1000 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 + if [ $? -ne 0 ] + then + exit 4; + fi +fi +${REL_PATH}/drop +if [ $? -ne 0 ] +then + exit 100; +fi +echo "Tables and Indexes are dropped" + +exit 0 diff --git a/test/system/Allocator/test003.ksh b/test/system/Allocator/test003.ksh new file mode 100755 index 00000000..d273783d --- /dev/null +++ b/test/system/Allocator/test003.ksh @@ -0,0 +1,114 @@ +#!/bin/ksh +# TestCase: +# create table with two fields and index on first field +# insert 100 tuple +# check number of tuples, totalPagesused +# check pagesUsed for storing hash bucket +# check number of index nodes, pagesUsed for storing index nodes +# delete 1 tuple +# check number of tuples, totalPagesused +# check pagesUsed for storing hash bucket +# check number of index nodes, pagesUsed for storing index nodes + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail +EXECUTABLE=${PWD}/system/Allocator/create +REL_PATH=. +if [ -s "$EXECUTABLE" ] +then + REL_PATH=${PWD}/system/Allocator +fi + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2>> $0.valgr +else + ${REL_PATH}/create + if [ $? -ne 0 ] + then + exit 100; + fi +fi + +echo "Tables and Indexes are created" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert100 2>> $0.valgr +else + ${REL_PATH}/insert100 + if [ $? -ne 100 ] + then + exit 100; + fi +fi + +echo "Tuples inserted into table" +echo "Case 1: -T option for t1: with 100 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 + if [ $? -ne 0 ] + then + exit 1; + fi +fi + +echo "Case 2: -I option for idx1 of t1, with 100 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 + if [ $? -ne 0 ] + then + exit 2; + fi +fi + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/delete1 2>> $0.valgr +else + ${REL_PATH}/delete1 + if [ $? -ne 1 ] + then + exit 100; + fi +fi + +echo "Tuples deleted from table" +echo "Case 3: -T option for t1: after removing 1 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 + if [ $? -ne 0 ] + then + exit 3; + fi +fi + +echo "Case 4: -I option for idx1 of t1, after removing 1 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 + if [ $? -ne 0 ] + then + exit 4; + fi +fi + +${REL_PATH}/drop +if [ $? -ne 0 ] +then + exit 100; +fi +echo "Tables and Indexes are dropped" + +exit 0 diff --git a/test/system/Allocator/test004.ksh b/test/system/Allocator/test004.ksh new file mode 100755 index 00000000..434d5c82 --- /dev/null +++ b/test/system/Allocator/test004.ksh @@ -0,0 +1,103 @@ +#!/bin/ksh +# TestCase: +# create table with two fields and index on first field +# insert 100 tuple +# check number of tuples, totalPagesused +# check pagesUsed for storing hash bucket +# check number of index nodes, pagesUsed for storing index nodes +# delete all tuples +# check number of tuples, totalPagesused +# check pagesUsed for storing hash bucket +# check number of index nodes, pagesUsed for storing index nodes + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail +EXECUTABLE=${PWD}/system/Allocator/create +REL_PATH=. +if [ -s "$EXECUTABLE" ] +then + REL_PATH=${PWD}/system/Allocator +fi + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2> $0.valgr +else + ${REL_PATH}/create + if [ $? -ne 0 ] + then + exit 100; + fi +fi +echo "Tables and Indexes are created" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert100 2> $0.valgr +else + ${REL_PATH}/insert100 + if [ $? -ne 100 ] + then + exit 100; + fi +fi + +echo "Tuples inserted into table" +echo "Case 1: -T option for t1: with 100 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 + if [ $? -ne 0 ] + then + exit 1; + fi +fi +echo "Case 2: -I option for idx1 of t1, with 100 tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 + if [ $? -ne 0 ] + then + exit 2; + fi +fi +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/deleteAll 2> $0.valgr +else + ${REL_PATH}/deleteAll +fi +echo "Tuples deleted from table" +echo "Case 3: -T option for t1: after removing all tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 + if [ $? -ne 0 ] + then + exit 3; + fi +fi +echo "Case 4: -I option for idx1 of t1, after removing all tuple" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 + if [ $? -ne 0 ] + then + exit 4; + fi +fi +${REL_PATH}/drop +if [ $? -ne 0 ] +then + exit 100; +fi +echo "Tables and Indexes are dropped" + +exit 0 diff --git a/test/system/Allocator/test005.ksh b/test/system/Allocator/test005.ksh new file mode 100755 index 00000000..db265237 --- /dev/null +++ b/test/system/Allocator/test005.ksh @@ -0,0 +1,77 @@ +#!/bin/ksh +# TestCase: +# check pages used(normal and merged) and chunks used for user database +# create table t1 with two fields +# check pages used(normal and merged) and chunks used for user database +# drop table t1 +# check pages used(normal and merged) and chunks used for user database + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail +EXECUTABLE=${PWD}/system/Allocator/create +REL_PATH=. +if [ -s "$EXECUTABLE" ] +then + REL_PATH=${PWD}/system/Allocator +fi + +echo "Case 1: -d option with no table" +if [ "$VALGRIND" = "true" ] +then + valgrind --tool=memcheck --leak-check=full 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d + if [ $? -ne 0 ] + then + exit 1; + fi +fi + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/createNoIndex 2>> $0.valgr +else + ${REL_PATH}/createNoIndex + if [ $? -ne 0 ] + then + exit 100; + fi +fi +echo "Tables and Indexes are created" + +echo "Case 2: -d option with 1 table" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d + if [ $? -ne 0 ] + then + exit 1; + fi +fi + +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/drop 2>> $0.valgr +else + ${REL_PATH}/drop + if [ $? -ne 0 ] + then + exit 100; + fi +fi + +echo "Case 3: -d option after removing table" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d + if [ $? -ne 0 ] + then + exit 3; + fi +fi + +exit 0; diff --git a/test/system/Allocator/test006.ksh b/test/system/Allocator/test006.ksh new file mode 100755 index 00000000..ecc4e346 --- /dev/null +++ b/test/system/Allocator/test006.ksh @@ -0,0 +1,75 @@ +#!/bin/ksh +# TestCase: +# check pages used(normal and merged) and chunks used for user database +# create table t1 with two fields and index on first field +# create index idx1 on t1 (f1) +# check pages used(normal and merged) and chunks used for user database +# drop table t1 +# check pages used(normal and merged) and chunks used for user database + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail +EXECUTABLE=${PWD}/system/Allocator/create +REL_PATH=. +if [ -s "$EXECUTABLE" ] +then + REL_PATH=${PWD}/system/Allocator +fi + +echo "Case 1: -d option with no table" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d + if [ $? -ne 0 ] + then + exit 1; + fi +fi +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2>> $0.valgr +else + ${REL_PATH}/create + if [ $? -ne 0 ] + then + exit 100; + fi +fi + +echo "Tables and Indexes are created" + +echo "Case 2: -d option with 1 table" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d + if [ $? -ne 0 ] + then + exit 1; + fi +fi +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/drop 2>> $0.valgr +else + ${REL_PATH}/drop + if [ $? -ne 0 ] + then + exit 100; + fi +fi +echo "Case 3: -d option after removing table" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d + if [ $? -ne 0 ] + then + exit 3; + fi +fi +exit 0 diff --git a/test/system/Allocator/test007.ksh b/test/system/Allocator/test007.ksh new file mode 100755 index 00000000..e2a4e5e6 --- /dev/null +++ b/test/system/Allocator/test007.ksh @@ -0,0 +1,66 @@ +#!/bin/ksh +# TestCase: +# check pages used(normal and merged) and chunks used for user database +# for i = 1 to 100 +# create table t1 with two fields and index on first field +# create index idx1 on t1 (f1) +# drop table t1 +# end for +# check pages used(normal and merged) and chunks used for user database + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail +EXECUTABLE=${PWD}/system/Allocator/create +REL_PATH=. +if [ -s "$EXECUTABLE" ] +then + REL_PATH=${PWD}/system/Allocator +fi + +echo "Case 1: -d option with no table" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d 2> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d + if [ $? -ne 0 ] + then + exit 1; + fi +fi +echo "Tables and Indexes are created" + +echo "Case 2: -d option with 1 table" +count=100 +while [ ${count} -gt 0 ] +do + count=`expr ${count} - 1` + if [ $VALGRIND = "true" ] + then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2>> $0.valgr + else + ${REL_PATH}/create + if [ $? -ne 0 ] + then + echo "create table failed" + exit 100; + fi + fi + ${REL_PATH}/drop + if [ $? -ne 0 ] + then + echo "drop table failed" + exit 100; + fi +done +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -d + if [ $? -ne 0 ] + then + exit 1; + fi +fi +exit 0 diff --git a/test/system/Allocator/tuplesize1.c b/test/system/Allocator/tuplesize1.c new file mode 100644 index 00000000..f99373ce --- /dev/null +++ b/test/system/Allocator/tuplesize1.c @@ -0,0 +1,31 @@ +/********************************************************** +* Test Case +* create table t1 with int +* create index if specified +* check table information for tuple size +*/ +#include +#include +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); return 1; } + printf("Table created\n"); + + TableImpl *table = (TableImpl*) dbMgr->openTable("t1"); + table->printInfo(); + dbMgr->closeTable((Table*)table); + dbMgr->dropTable("t1"); + conn.close(); + return 0; +} diff --git a/test/system/Allocator/tuplesize2.c b/test/system/Allocator/tuplesize2.c new file mode 100644 index 00000000..8454ee7c --- /dev/null +++ b/test/system/Allocator/tuplesize2.c @@ -0,0 +1,33 @@ +/********************************************************** +* Test Case +* create table t1 with int +* create index if specified +* check table information for tuple size +*/ +#include +#include +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeString, 1); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); return rv; } + printf("Table created\n"); + + if (rv != OK) ret = 5; + TableImpl *table = (TableImpl*) dbMgr->openTable("t1"); + table->printInfo(); + dbMgr->closeTable((Table*)table); + dbMgr->dropTable("t1"); + conn.close(); + return ret; +} diff --git a/test/system/Allocator/tuplesize3.c b/test/system/Allocator/tuplesize3.c new file mode 100644 index 00000000..3d4a4d19 --- /dev/null +++ b/test/system/Allocator/tuplesize3.c @@ -0,0 +1,34 @@ +/********************************************************** +* Test Case +* create table t1 with int +* create index if specified +* check table information for tuple size +*/ +#include +#include +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeString, 1); + tabDef.addField("f3", typeInt); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); return rv; } + printf("Table created\n"); + + if (rv != OK) ret = 5; + TableImpl *table = (TableImpl*) dbMgr->openTable("t1"); + table->printInfo(); + dbMgr->closeTable((Table*)table); + dbMgr->dropTable("t1"); + conn.close(); + return ret; +} diff --git a/test/system/Allocator/tuplesize4.c b/test/system/Allocator/tuplesize4.c new file mode 100644 index 00000000..974cbe8b --- /dev/null +++ b/test/system/Allocator/tuplesize4.c @@ -0,0 +1,35 @@ +/********************************************************** +* Test Case +* create table t1 with int +* create index if specified +* check table information for tuple size +*/ +#include +#include +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeString, 1); + tabDef.addField("f3", typeString, 5); + tabDef.addField("f4", typeInt); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); return rv; } + printf("Table created\n"); + + if (rv != OK) ret = 5; + TableImpl *table = (TableImpl*) dbMgr->openTable("t1"); + table->printInfo(); + dbMgr->closeTable((Table*)table); + dbMgr->dropTable("t1"); + conn.close(); + return ret; +} diff --git a/test/system/Allocator/tuplesize5.c b/test/system/Allocator/tuplesize5.c new file mode 100644 index 00000000..29bb9fda --- /dev/null +++ b/test/system/Allocator/tuplesize5.c @@ -0,0 +1,36 @@ +/********************************************************** +* Test Case +* create table t1 with int +* create index if specified +* check table information for tuple size +*/ +#include +#include +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeString, 1); + tabDef.addField("f3", typeInt); + tabDef.addField("f4", typeString, 5); + tabDef.addField("f5", typeInt); + rv = dbMgr->createTable("t1", tabDef); + if (rv != OK) { printf("Table creation failed\n"); return rv; } + printf("Table created\n"); + + if (rv != OK) ret = 5; + TableImpl *table = (TableImpl*) dbMgr->openTable("t1"); + table->printInfo(); + dbMgr->closeTable((Table*)table); + dbMgr->dropTable("t1"); + conn.close(); + return ret; +} diff --git a/test/system/Makefile b/test/system/Makefile new file mode 100644 index 00000000..8b8aa8e0 --- /dev/null +++ b/test/system/Makefile @@ -0,0 +1,18 @@ +OSNAME = $(shell uname -s) +MAKE=gmake + +all: + @for i in *; \ + do \ + if [ -d $$i ];\ + then cd $$i; $(MAKE); cd ..;\ + fi;\ + done + +clean: + @for i in *; \ + do \ + if [ -d $$i ];\ + then cd $$i; $(MAKE) clean; cd ..;\ + fi;\ + done diff --git a/test/system/config/Makefile b/test/system/config/Makefile new file mode 100644 index 00000000..71a90ded --- /dev/null +++ b/test/system/config/Makefile @@ -0,0 +1,47 @@ +OSNAME = $(shell uname -s) +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + + +INCL= -I$(CSQL_INSTALL_ROOT)/include -I../../../include +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcsql + +TARGETS = \ + connect \ + test001 \ + test002 + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +connect: connect.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test001: conftest1.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test002: conftest2.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) + +clean: + rm -f $(TARGETS) + diff --git a/test/system/config/conftest1.c b/test/system/config/conftest1.c new file mode 100644 index 00000000..7598378d --- /dev/null +++ b/test/system/config/conftest1.c @@ -0,0 +1,10 @@ +#include +int main() +{ + Connection conn; + DbRetVal rv = OK; + os::setenv("CSQL_CONFIG_FILE", "./noexistcsql.conf"); + rv = conn.open("root", "manager"); + if (rv == OK) return 1; + return 0; +} diff --git a/test/system/config/conftest2.c b/test/system/config/conftest2.c new file mode 100644 index 00000000..555872d2 --- /dev/null +++ b/test/system/config/conftest2.c @@ -0,0 +1,20 @@ +//print values of the config file +#include +int main() +{ + Connection conn; + DbRetVal rv = OK; + char *root = os::getenv("PWD"); + char conf[512]; + char *s = root + (strlen(root) - 9); + if (strcmp(s, "csql/test") == 0) + sprintf(conf, "%s/system/config/csql.conf", root); + else + sprintf(conf, "%s/csql.conf", root); + os::setenv("CSQL_CONFIG_FILE", conf); + rv = conn.open("root", "manager"); + if (rv != OK) return 1; + Conf::config.print(); + conn.close(); + return 0; +} diff --git a/test/system/config/connect.c b/test/system/config/connect.c new file mode 100644 index 00000000..2bd12d9f --- /dev/null +++ b/test/system/config/connect.c @@ -0,0 +1,10 @@ +//print values of the config file +#include +int main() +{ + Connection conn; + DbRetVal rv = OK; + rv = conn.open("root", "manager"); + if (rv == OK) return 1; + return 0; +} diff --git a/test/system/config/csql.conf b/test/system/config/csql.conf new file mode 100644 index 00000000..b135ab18 --- /dev/null +++ b/test/system/config/csql.conf @@ -0,0 +1,50 @@ +# CSQL System Configuration File + +# Page size. Each database is logically divided into pages and allocation happens +# in this unit of pages. Increasing this value will reduce frequent allocation of pages. +PAGE_SIZE= 8192 + +#Total number of active transactions that can run concurrently in the system +MAX_TRANS = 10 + +#Total number of client process which can connect and work with the +# database concurrently +MAX_PROCS = 10 + +#Total number of threads in a process which can connect and work with the +# database concurrently +MAX_THREADS = 10 + +# Maximum size of the system database. +MAX_SYS_DB_SIZE=1048576 + +#Maximum size of the user database file. +MAX_DB_SIZE=10485760 + +#Shared memory key to be used by the system to create and locate system database. +SYS_DB_KEY=2222 + +#Shared memory key to be used by the system to create and locate user database. +USER_DB_KEY=3333 + +#Give full path for the log file where important system actions are stored. +LOG_FILE=/tmp/csql/log/log.out + +#The virtual memory start address at which the shared memory segment +# will be created and attached. +MAP_ADDRESS=400000000 + +#Mutex timeout interval seconds +MUTEX_TIMEOUT_SECS=0 +MUTEX_TIMEOUT_USECS=10 +MUTEX_TIMEOUT_RETRIES=10 + +#Lock timeout interval seconds +LOCK_TIMEOUT_SECS=0 +LOCK_TIMEOUT_USECS=10 +LOCK_TIMEOUT_RETRIES=10 + +MSG_KEY=2525 + +ID_SHM_KEY=1947 + diff --git a/test/system/config/exp.test002 b/test/system/config/exp.test002 new file mode 100644 index 00000000..fba7159e --- /dev/null +++ b/test/system/config/exp.test002 @@ -0,0 +1,32 @@ +ConfigValues + getPageSize 8192 + getMaxProcs 10 + getMaxSysDbSize 1048576 + getMaxDbSize 10485760 + getSysDbKey 2222 + getUserDbKey 3333 + getLogFile /tmp/csql/log/log.out + getLogLevel 0 + getDatabaseFile /tmp/csql/db + getMapAddress 400000000 + getMutexSecs 0 + getMutexUSecs 10 + getMutexRetries 10 + getLockSecs 0 + getLockUSecs 10 + getLockRetries 10 + useCache 0 + getDSN myodbc3 + getDsConfigFile /tmp/csql/csqlds.conf + getTableConfigFile /tmp/csql/csqltable.conf + isTwoWayCache 0 + getCacheMode 0 + getCacheWaitSecs 10 + useCsqlSqlServer 0 + getPort 5678 + useReplication 0 + isDurable 0 + getReplConfigFile /tmp/csql/csqlnw.conf + getSiteID 1 + getMsgKey 2525 + getShmIDKey 1947 diff --git a/test/system/config/exp.test003.ksh b/test/system/config/exp.test003.ksh new file mode 100644 index 00000000..05c6ddb5 --- /dev/null +++ b/test/system/config/exp.test003.ksh @@ -0,0 +1,3 @@ +PAGE_SIZE should be >= 8192 and <= 10 MB +Configuration file read failed + diff --git a/test/system/config/exp.test004.ksh b/test/system/config/exp.test004.ksh new file mode 100644 index 00000000..3a4f6b3d --- /dev/null +++ b/test/system/config/exp.test004.ksh @@ -0,0 +1,3 @@ +PAGE_SIZE should be multiples of 1024 +Configuration file read failed + diff --git a/test/system/config/exp.test006.ksh b/test/system/config/exp.test006.ksh new file mode 100644 index 00000000..0ee75bfa --- /dev/null +++ b/test/system/config/exp.test006.ksh @@ -0,0 +1,3 @@ +MAX_PROCS should be >= 10 and <= 8192 +Configuration file read failed + diff --git a/test/system/config/exp.test008.ksh b/test/system/config/exp.test008.ksh new file mode 100644 index 00000000..525b4f90 --- /dev/null +++ b/test/system/config/exp.test008.ksh @@ -0,0 +1,3 @@ +MAX_SYS_DB_SIZE should be >= 1 MB and <= 1 GB +Configuration file read failed + diff --git a/test/system/config/exp.test009.ksh b/test/system/config/exp.test009.ksh new file mode 100644 index 00000000..525b4f90 --- /dev/null +++ b/test/system/config/exp.test009.ksh @@ -0,0 +1,3 @@ +MAX_SYS_DB_SIZE should be >= 1 MB and <= 1 GB +Configuration file read failed + diff --git a/test/system/config/exp.test010.ksh b/test/system/config/exp.test010.ksh new file mode 100644 index 00000000..3c91ea48 --- /dev/null +++ b/test/system/config/exp.test010.ksh @@ -0,0 +1,3 @@ +MAX_SYS_DB_SIZE should be multiples of 8192 +Configuration file read failed + diff --git a/test/system/config/exp.test011.ksh b/test/system/config/exp.test011.ksh new file mode 100644 index 00000000..be8302fd --- /dev/null +++ b/test/system/config/exp.test011.ksh @@ -0,0 +1,3 @@ +MAX_DB_SIZE should be >= 1 MB and <= 2 GB +Configuration file read failed + diff --git a/test/system/config/exp.test011.ksh.x86_64 b/test/system/config/exp.test011.ksh.x86_64 new file mode 100644 index 00000000..35b7d6c3 --- /dev/null +++ b/test/system/config/exp.test011.ksh.x86_64 @@ -0,0 +1,3 @@ +MAX_DB_SIZE should be >= 1 MB and <= 100 GB +Configuration file read failed + diff --git a/test/system/config/exp.test012.ksh b/test/system/config/exp.test012.ksh new file mode 100644 index 00000000..6b882233 --- /dev/null +++ b/test/system/config/exp.test012.ksh @@ -0,0 +1,3 @@ +MAX_DB_SIZE should be multiples of 8192 +Configuration file read failed + diff --git a/test/system/config/exp.test012.ksh.x86_64 b/test/system/config/exp.test012.ksh.x86_64 new file mode 100644 index 00000000..6b882233 --- /dev/null +++ b/test/system/config/exp.test012.ksh.x86_64 @@ -0,0 +1,3 @@ +MAX_DB_SIZE should be multiples of 8192 +Configuration file read failed + diff --git a/test/system/config/exp.test013.ksh b/test/system/config/exp.test013.ksh new file mode 100644 index 00000000..6b882233 --- /dev/null +++ b/test/system/config/exp.test013.ksh @@ -0,0 +1,3 @@ +MAX_DB_SIZE should be multiples of 8192 +Configuration file read failed + diff --git a/test/system/config/exp.test014.ksh b/test/system/config/exp.test014.ksh new file mode 100644 index 00000000..be8302fd --- /dev/null +++ b/test/system/config/exp.test014.ksh @@ -0,0 +1,3 @@ +MAX_DB_SIZE should be >= 1 MB and <= 2 GB +Configuration file read failed + diff --git a/test/system/config/exp.test014.ksh.x86_64 b/test/system/config/exp.test014.ksh.x86_64 new file mode 100644 index 00000000..35b7d6c3 --- /dev/null +++ b/test/system/config/exp.test014.ksh.x86_64 @@ -0,0 +1,3 @@ +MAX_DB_SIZE should be >= 1 MB and <= 100 GB +Configuration file read failed + diff --git a/test/system/config/exp.test015.ksh b/test/system/config/exp.test015.ksh new file mode 100644 index 00000000..9d7e4b5d --- /dev/null +++ b/test/system/config/exp.test015.ksh @@ -0,0 +1,3 @@ +SYS_DB_KEY should be >= 10 and <= 8192 +Configuration file read failed + diff --git a/test/system/config/exp.test016.ksh b/test/system/config/exp.test016.ksh new file mode 100644 index 00000000..a97515ef --- /dev/null +++ b/test/system/config/exp.test016.ksh @@ -0,0 +1,3 @@ +USER_DB_KEY should be >= 10 and <= 8192 +Configuration file read failed + diff --git a/test/system/config/exp.test017.ksh b/test/system/config/exp.test017.ksh new file mode 100644 index 00000000..8765b5e3 --- /dev/null +++ b/test/system/config/exp.test017.ksh @@ -0,0 +1,3 @@ +USER_DB_KEY and SYS_DB_KEY have same value 1000 +Configuration file read failed + diff --git a/test/system/config/exp.test018.ksh b/test/system/config/exp.test018.ksh new file mode 100644 index 00000000..f194d2d1 --- /dev/null +++ b/test/system/config/exp.test018.ksh @@ -0,0 +1,3 @@ +LOG_FILE is set to NULL +Configuration file read failed + diff --git a/test/system/config/exp.test019.ksh b/test/system/config/exp.test019.ksh new file mode 100644 index 00000000..15d2dff4 --- /dev/null +++ b/test/system/config/exp.test019.ksh @@ -0,0 +1,3 @@ +MAP_ADDRESS should be >= 400000000 and <= 2000000000 +Configuration file read failed + diff --git a/test/system/config/exp.test021.ksh b/test/system/config/exp.test021.ksh new file mode 100644 index 00000000..ad58a529 --- /dev/null +++ b/test/system/config/exp.test021.ksh @@ -0,0 +1,3 @@ +MUTEX_TIMEOUT_SECS should be >= 0 and <= 360 +Configuration file read failed + diff --git a/test/system/config/exp.test022.ksh b/test/system/config/exp.test022.ksh new file mode 100644 index 00000000..ad58a529 --- /dev/null +++ b/test/system/config/exp.test022.ksh @@ -0,0 +1,3 @@ +MUTEX_TIMEOUT_SECS should be >= 0 and <= 360 +Configuration file read failed + diff --git a/test/system/config/exp.test023.ksh b/test/system/config/exp.test023.ksh new file mode 100644 index 00000000..092a569b --- /dev/null +++ b/test/system/config/exp.test023.ksh @@ -0,0 +1,3 @@ +MUTEX_TIMEOUT_USECS should be >= 0 and <= 1000000 +Configuration file read failed + diff --git a/test/system/config/exp.test024.ksh b/test/system/config/exp.test024.ksh new file mode 100644 index 00000000..092a569b --- /dev/null +++ b/test/system/config/exp.test024.ksh @@ -0,0 +1,3 @@ +MUTEX_TIMEOUT_USECS should be >= 0 and <= 1000000 +Configuration file read failed + diff --git a/test/system/config/exp.test027.ksh b/test/system/config/exp.test027.ksh new file mode 100644 index 00000000..5ccfd864 --- /dev/null +++ b/test/system/config/exp.test027.ksh @@ -0,0 +1,3 @@ +LOCK_TIMEOUT_SECS should be >= 0 and <= 360 +Configuration file read failed + diff --git a/test/system/config/exp.test028.ksh b/test/system/config/exp.test028.ksh new file mode 100644 index 00000000..5ccfd864 --- /dev/null +++ b/test/system/config/exp.test028.ksh @@ -0,0 +1,3 @@ +LOCK_TIMEOUT_SECS should be >= 0 and <= 360 +Configuration file read failed + diff --git a/test/system/config/exp.test029.ksh b/test/system/config/exp.test029.ksh new file mode 100644 index 00000000..b1b10f10 --- /dev/null +++ b/test/system/config/exp.test029.ksh @@ -0,0 +1,3 @@ +LOCK_TIMEOUT_USECS should be >= 0 and <= 1000000 +Configuration file read failed + diff --git a/test/system/config/exp.test030.ksh b/test/system/config/exp.test030.ksh new file mode 100644 index 00000000..b1b10f10 --- /dev/null +++ b/test/system/config/exp.test030.ksh @@ -0,0 +1,3 @@ +LOCK_TIMEOUT_USECS should be >= 0 and <= 1000000 +Configuration file read failed + diff --git a/test/system/config/test003.ksh b/test/system/config/test003.ksh new file mode 100755 index 00000000..b8e9a847 --- /dev/null +++ b/test/system/config/test003.ksh @@ -0,0 +1,21 @@ +#!/bin/ksh +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "PAGE_SIZE= 512" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +#cat ${REL_PATH}/tmp.out +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test004.ksh b/test/system/config/test004.ksh new file mode 100755 index 00000000..fed35731 --- /dev/null +++ b/test/system/config/test004.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#PAGE_SIZE should not accept value which are not multiples of 1024 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "PAGE_SIZE= 8193" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test006.ksh b/test/system/config/test006.ksh new file mode 100755 index 00000000..f370a014 --- /dev/null +++ b/test/system/config/test006.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAX_PROCS should not accept value >8192 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAX_PROCS=10000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test008.ksh b/test/system/config/test008.ksh new file mode 100755 index 00000000..cd7f06cd --- /dev/null +++ b/test/system/config/test008.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAX_SYS_DB_SIZE should be >1MB + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAX_SYS_DB_SIZE=1000000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test009.ksh b/test/system/config/test009.ksh new file mode 100755 index 00000000..f9b2017a --- /dev/null +++ b/test/system/config/test009.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAX_SYS_DB_SIZE should be <1GB + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAX_SYS_DB_SIZE=2000000000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test010.ksh b/test/system/config/test010.ksh new file mode 100755 index 00000000..8b1f81cf --- /dev/null +++ b/test/system/config/test010.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAX_SYS_DB_SIZE should be multiples of 8192 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAX_SYS_DB_SIZE=8388609" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test011.ksh b/test/system/config/test011.ksh new file mode 100755 index 00000000..7fef0bf5 --- /dev/null +++ b/test/system/config/test011.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAX_DB_SIZE should be >1MB + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAX_DB_SIZE=1000000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test012.ksh b/test/system/config/test012.ksh new file mode 100755 index 00000000..adc469c0 --- /dev/null +++ b/test/system/config/test012.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAX_DB_SIZE should be <2GB + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAX_DB_SIZE=3000000000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test013.ksh b/test/system/config/test013.ksh new file mode 100755 index 00000000..faab71b5 --- /dev/null +++ b/test/system/config/test013.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAX_DB_SIZE should be multiples of 8192 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAX_DB_SIZE=8388609" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test014.ksh b/test/system/config/test014.ksh new file mode 100755 index 00000000..e1271c2a --- /dev/null +++ b/test/system/config/test014.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAX_DB_SIZE should not accept string values + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAX_DB_SIZE=mywrongvalue" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test015.ksh b/test/system/config/test015.ksh new file mode 100755 index 00000000..6be1835e --- /dev/null +++ b/test/system/config/test015.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#SYS_DB_KEY should not accept < 10 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "SYS_DB_KEY=5" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test016.ksh b/test/system/config/test016.ksh new file mode 100755 index 00000000..1b705110 --- /dev/null +++ b/test/system/config/test016.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#USER_DB_KEY should not accept > 8192 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "USER_DB_KEY=10000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test017.ksh b/test/system/config/test017.ksh new file mode 100755 index 00000000..26c03e6d --- /dev/null +++ b/test/system/config/test017.ksh @@ -0,0 +1,24 @@ +#!/bin/ksh +#SYS_DB_KEY and USER_DB_KEY should not have same value + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "USER_DB_KEY=1000" >>${REL_PATH}/csqltmp.conf +echo "SYS_DB_KEY=1000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test018.ksh b/test/system/config/test018.ksh new file mode 100755 index 00000000..9f7a194b --- /dev/null +++ b/test/system/config/test018.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#LOG_FILE should not be empty + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "LOG_FILE=" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test019.ksh b/test/system/config/test019.ksh new file mode 100755 index 00000000..715817ae --- /dev/null +++ b/test/system/config/test019.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAP_ADDRESS should not be <4MB + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAP_ADDRESS=300000000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test020.ksh b/test/system/config/test020.ksh new file mode 100755 index 00000000..d7fdae44 --- /dev/null +++ b/test/system/config/test020.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MAP_ADDRESS should not be >2GB + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MAP_ADDRESS=3000000000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test021.ksh b/test/system/config/test021.ksh new file mode 100755 index 00000000..22315bd6 --- /dev/null +++ b/test/system/config/test021.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MUTEX_TIMEOUT_SECS should not be -ve value + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MUTEX_TIMEOUT_SECS=-1" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test022.ksh b/test/system/config/test022.ksh new file mode 100755 index 00000000..2c8ff09d --- /dev/null +++ b/test/system/config/test022.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MUTEX_TIMEOUT_SECS should not be >360 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MUTEX_TIMEOUT_SECS=380" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test023.ksh b/test/system/config/test023.ksh new file mode 100755 index 00000000..ca41e93e --- /dev/null +++ b/test/system/config/test023.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MUTEX_TIMEOUT_USECS should not be -ve value + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MUTEX_TIMEOUT_USECS=-1" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test024.ksh b/test/system/config/test024.ksh new file mode 100755 index 00000000..94b49016 --- /dev/null +++ b/test/system/config/test024.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MUTEX_TIMEOUT_USECS should not be >1000000 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MUTEX_TIMEOUT_USECS=2000000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test025.ksh b/test/system/config/test025.ksh new file mode 100755 index 00000000..b6765dc9 --- /dev/null +++ b/test/system/config/test025.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MUTEX_TIMEOUT_RETRY should not be -ve value + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MUTEX_TIMEOUT_RETRY=-1" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test026.ksh b/test/system/config/test026.ksh new file mode 100755 index 00000000..4f3b9c5a --- /dev/null +++ b/test/system/config/test026.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#MUTEX_TIMEOUT_RETRY should not be >100 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "MUTEX_TIMEOUT_RETRY=200" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test027.ksh b/test/system/config/test027.ksh new file mode 100755 index 00000000..f1dd812a --- /dev/null +++ b/test/system/config/test027.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#LOCK_TIMEOUT_SECS should not be -ve value + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "LOCK_TIMEOUT_SECS=-1" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test028.ksh b/test/system/config/test028.ksh new file mode 100755 index 00000000..f14d06f5 --- /dev/null +++ b/test/system/config/test028.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#LOCK_TIMEOUT_SECS should not be >360 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "LOCK_TIMEOUT_SECS=380" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test029.ksh b/test/system/config/test029.ksh new file mode 100755 index 00000000..660b10da --- /dev/null +++ b/test/system/config/test029.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#LOCK_TIMEOUT_USECS should not be -ve value + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "LOCK_TIMEOUT_USECS=-1" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test030.ksh b/test/system/config/test030.ksh new file mode 100755 index 00000000..146276b6 --- /dev/null +++ b/test/system/config/test030.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#LOCK_TIMEOUT_USECS should not be >1000000 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "LOCK_TIMEOUT_USECS=2000000" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test031.ksh b/test/system/config/test031.ksh new file mode 100755 index 00000000..2d0c0b4c --- /dev/null +++ b/test/system/config/test031.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#LOCK_TIMEOUT_RETRY should not be -ve value + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "LOCK_TIMEOUT_RETRY=-1" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/config/test032.ksh b/test/system/config/test032.ksh new file mode 100755 index 00000000..f6c72f07 --- /dev/null +++ b/test/system/config/test032.ksh @@ -0,0 +1,23 @@ +#!/bin/ksh +#LOCK_TIMEOUT_RETRY should not be >100 + + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail as CSQL_CONFIG_FILE may not be able to read +CSQL_CONF=${PWD}/system/config/csql.conf +REL_PATH=. +if [ -s "$CSQL_CONF" ] +then + REL_PATH=`pwd`/system/config +fi +cp ${REL_PATH}/csql.conf ${REL_PATH}/csqltmp.conf +export CSQL_CONFIG_FILE=${REL_PATH}/csqltmp.conf +echo "LOCK_TIMEOUT_RETRY=200" >>${REL_PATH}/csqltmp.conf +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/connect 2> $0.valgr +else + ${REL_PATH}/connect 2>${REL_PATH}/tmp.out +fi +cat ${REL_PATH}/tmp.out | awk -F: '{ print $8 }' +rm ${REL_PATH}/tmp.out ${REL_PATH}/csqltmp.conf diff --git a/test/system/index/TODO b/test/system/index/TODO new file mode 100644 index 00000000..546810ef --- /dev/null +++ b/test/system/index/TODO @@ -0,0 +1,24 @@ +1.create table +.insert 10 tuples +.check for 0 index nodes +.create index +.insert 10 tuples +.check for 20 index nodes + +2.create table +.create index +.insert 10 tuples +.drop index +.check for 0 index nodes + +3.create table +.create two index +.insert 10 tuples +.check for 10 index nodes in both indexes + +4.create table +.create two index +.insert 10 tuples +.drop index idx2 +.insert 10 tuples +.check for 20 nodes in idx1 and 0 nodes in idx2 diff --git a/test/system/lock/Makefile b/test/system/lock/Makefile new file mode 100644 index 00000000..4c634490 --- /dev/null +++ b/test/system/lock/Makefile @@ -0,0 +1,83 @@ +OSNAME = $(shell uname -s) +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + + +INCL= -I$(CSQL_INSTALL_ROOT)/include -I../../../include +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcsql + +TARGETS = \ + test001 test001a \ + test003 test003a \ + test004 test004a \ + test005 test005a \ + test006 test006a \ + test007 test007a \ + test008 test008a \ + test009 test009a \ + test002 test002a + + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +test001: locktest001.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test001a: locktest001.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test002: locktest002.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test002a: locktest002.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test003: locktest003.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test003a: locktest003.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004: locktest004.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004a: locktest004.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005: locktest005.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005a: locktest005.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test006: locktest006.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test006a: locktest006.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test007: locktest007.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test007a: locktest007.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test008: locktest008.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test008a: locktest008.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test009: locktest009.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test009a: locktest009.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +clean: + rm -f $(TARGETS) + diff --git a/test/system/lock/TODO b/test/system/lock/TODO new file mode 100644 index 00000000..2bb71a86 --- /dev/null +++ b/test/system/lock/TODO @@ -0,0 +1,2 @@ +1.create two threads, two READ_REPEATABLE trans, select 10 tuples, check noOfReaders +2. diff --git a/test/system/lock/common.h b/test/system/lock/common.h new file mode 100644 index 00000000..a96442a6 --- /dev/null +++ b/test/system/lock/common.h @@ -0,0 +1,153 @@ +#include +DbRetVal createIndex(DatabaseManager *dbMgr, char *tblname, char *fldname, char *indname) +{ + HashIndexInitInfo *idxInfo = new HashIndexInitInfo(); + strcpy(idxInfo->tableName, tblname); + idxInfo->list.append(fldname); + idxInfo->indType = hashIndex; + idxInfo->isUnique = true; + idxInfo->isPrimary = true; + DbRetVal rv = dbMgr->createIndex(indname, idxInfo); + if (rv != OK) { printf("Index creation failed\n"); return rv; } + printf("Index created for %s\n", fldname); + delete idxInfo; + return OK; +} +DbRetVal createTable(DatabaseManager *dbMgr, char *tblname) +{ + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeInt, 0 ,NULL, true); + DbRetVal rv = dbMgr->createTable(tblname, tabDef); + if (rv != OK) { printf("Table creation failed\n"); return rv; } + printf("Table created\n"); + return OK; +} +DbRetVal dropTable(DatabaseManager *dbMgr, char *tblname) +{ + DbRetVal rv = dbMgr->dropTable(tblname); + if (rv != OK) { printf("Table drop failed\n"); return rv; } + printf("Table Dropped\n"); + return OK; +} +int insertTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + int id1 = 0; + table->bindFld("f1", &id1); + table->bindFld("f2", &id1); + int icount =0; + DbRetVal rv = OK; + for (int i = 0 ; i < count ; i++) + { + id1= i; + rv = table->insertTuple(); + if (rv != OK) break; + icount++; + + } + printf("Total Tuples inserted is %d\n", icount); + dbMgr->closeTable(table); + return icount; +} + +int selectTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + DbRetVal rv = OK; + + Condition p1; + int val1 = 0; + p1.setTerm("f1", OpEquals, &val1); + table->setCondition(&p1); + int i =0; + void *tuple; + for (i = 0 ; i < count ; i++) + { + val1 = i; + table->execute(); + if (rv != OK) break; + tuple = (char*)table->fetch() ; + if (tuple == NULL) break; + table->closeScan(); + } + printf("Total Tuples selected is %d\n", i); + dbMgr->closeTable(table); + return i; +} +int updateTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + DbRetVal rv = OK; + + int id1 = 0, id2 =0; + table->bindFld("f1", &id1); + table->bindFld("f2", &id2); + Condition p1; + int val1 = 0; + p1.setTerm("f1", OpEquals, &val1); + table->setCondition(&p1); + int i =0; + void *tuple; + for (i = 0 ; i < count ; i++) + { + val1 = i; + table->execute(); + if (rv != OK) break; + tuple = (char*)table->fetch() ; + if (tuple == NULL) break; + id2 = 1000 + i; + rv = table->updateTuple(); + if (rv != OK) break; + table->closeScan(); + } + printf("Total Tuples updated is %d\n", i); + dbMgr->closeTable(table); + return i; +} +int deleteTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + DbRetVal rv = OK; + + Condition p1; + int val1 = 0; + p1.setTerm("f1", OpEquals, &val1); + table->setCondition(&p1); + int i =0; + void *tuple; + for (i = 0 ; i < count ; i++) + { + val1 = i; + table->execute(); + if (rv != OK) break; + tuple = (char*)table->fetch() ; + if (tuple == NULL) break; + rv = table->deleteTuple(); + if (rv != OK) break; + table->closeScan(); + } + printf("Total Tuples deleted is %d\n", i); + dbMgr->closeTable(table); + return i; +} diff --git a/test/system/lock/exp.test001 b/test/system/lock/exp.test001 new file mode 100644 index 00000000..e69de29b diff --git a/test/system/lock/exp.test001a b/test/system/lock/exp.test001a new file mode 100644 index 00000000..7de3f8cb --- /dev/null +++ b/test/system/lock/exp.test001a @@ -0,0 +1,114 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Before commit + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test001a.x86_64 b/test/system/lock/exp.test001a.x86_64 new file mode 100644 index 00000000..dad83c5e --- /dev/null +++ b/test/system/lock/exp.test001a.x86_64 @@ -0,0 +1,114 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Before commit + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test002 b/test/system/lock/exp.test002 new file mode 100644 index 00000000..8dad7531 --- /dev/null +++ b/test/system/lock/exp.test002 @@ -0,0 +1,113 @@ +Table created +Total Tuples inserted is 10 +Before rollback + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After rollback + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test002.x86_64 b/test/system/lock/exp.test002.x86_64 new file mode 100644 index 00000000..8592a849 --- /dev/null +++ b/test/system/lock/exp.test002.x86_64 @@ -0,0 +1,113 @@ +Table created +Total Tuples inserted is 10 +Before rollback + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After rollback + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test002a b/test/system/lock/exp.test002a new file mode 100644 index 00000000..52323113 --- /dev/null +++ b/test/system/lock/exp.test002a @@ -0,0 +1,114 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Before rollback + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After rollback + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test002a.x86_64 b/test/system/lock/exp.test002a.x86_64 new file mode 100644 index 00000000..cef66345 --- /dev/null +++ b/test/system/lock/exp.test002a.x86_64 @@ -0,0 +1,114 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Before rollback + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After rollback + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test003 b/test/system/lock/exp.test003 new file mode 100644 index 00000000..b1156a6b --- /dev/null +++ b/test/system/lock/exp.test003 @@ -0,0 +1,14 @@ +Table created +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before commit + + 0 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test003a b/test/system/lock/exp.test003a new file mode 100644 index 00000000..13121947 --- /dev/null +++ b/test/system/lock/exp.test003a @@ -0,0 +1,15 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before commit + + 0 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test004 b/test/system/lock/exp.test004 new file mode 100644 index 00000000..851d3263 --- /dev/null +++ b/test/system/lock/exp.test004 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before commit + + + 17e7a014 + 1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + 1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + 1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + 1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + 1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + 1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + 1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + 1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + 1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + 1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test004.x86_64 b/test/system/lock/exp.test004.x86_64 new file mode 100644 index 00000000..27094114 --- /dev/null +++ b/test/system/lock/exp.test004.x86_64 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before commit + + + 17e7a01c + 1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + 1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + 1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + 1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + 1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + 1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + 1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + 1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + 1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + 1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test004a b/test/system/lock/exp.test004a new file mode 100644 index 00000000..b1ff8d54 --- /dev/null +++ b/test/system/lock/exp.test004a @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before commit + + + 17e7a014 + 1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + 1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + 1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + 1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + 1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + 1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + 1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + 1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + 1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + 1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test004a.x86_64 b/test/system/lock/exp.test004a.x86_64 new file mode 100644 index 00000000..db278ab0 --- /dev/null +++ b/test/system/lock/exp.test004a.x86_64 @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before commit + + + 17e7a01c + 1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + 1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + 1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + 1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + 1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + 1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + 1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + 1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + 1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + 1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test005 b/test/system/lock/exp.test005 new file mode 100644 index 00000000..c4072b25 --- /dev/null +++ b/test/system/lock/exp.test005 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before rollback + + + 17e7a014 + 1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + 1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + 1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + 1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + 1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + 1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + 1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + 1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + 1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + 1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After rollback + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test005.x86_64 b/test/system/lock/exp.test005.x86_64 new file mode 100644 index 00000000..9491dedb --- /dev/null +++ b/test/system/lock/exp.test005.x86_64 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before rollback + + + 17e7a01c + 1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + 1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + 1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + 1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + 1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + 1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + 1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + 1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + 1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + 1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After rollback + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test005a b/test/system/lock/exp.test005a new file mode 100644 index 00000000..d05f2f92 --- /dev/null +++ b/test/system/lock/exp.test005a @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before rollback + + + 17e7a014 + 1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + 1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + 1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + 1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + 1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + 1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + 1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + 1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + 1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + 1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After rollback + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test005a.x86_64 b/test/system/lock/exp.test005a.x86_64 new file mode 100644 index 00000000..3d655235 --- /dev/null +++ b/test/system/lock/exp.test005a.x86_64 @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before rollback + + + 17e7a01c + 1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + 1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + 1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + 1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + 1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + 1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + 1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + 1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + 1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + 1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After rollback + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test006 b/test/system/lock/exp.test006 new file mode 100644 index 00000000..2e74f21d --- /dev/null +++ b/test/system/lock/exp.test006 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before commit + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test006.x86_64 b/test/system/lock/exp.test006.x86_64 new file mode 100644 index 00000000..d594b3bd --- /dev/null +++ b/test/system/lock/exp.test006.x86_64 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before commit + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test006a b/test/system/lock/exp.test006a new file mode 100644 index 00000000..ebb03634 --- /dev/null +++ b/test/system/lock/exp.test006a @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before commit + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test006a.x86_64 b/test/system/lock/exp.test006a.x86_64 new file mode 100644 index 00000000..b591446c --- /dev/null +++ b/test/system/lock/exp.test006a.x86_64 @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before commit + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test007 b/test/system/lock/exp.test007 new file mode 100644 index 00000000..8e3dd550 --- /dev/null +++ b/test/system/lock/exp.test007 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before abort + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After abort + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test007.x86_64 b/test/system/lock/exp.test007.x86_64 new file mode 100644 index 00000000..a9af4475 --- /dev/null +++ b/test/system/lock/exp.test007.x86_64 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before abort + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After abort + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test007a b/test/system/lock/exp.test007a new file mode 100644 index 00000000..35b3a85b --- /dev/null +++ b/test/system/lock/exp.test007a @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before abort + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After abort + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test007a.x86_64 b/test/system/lock/exp.test007a.x86_64 new file mode 100644 index 00000000..f3633213 --- /dev/null +++ b/test/system/lock/exp.test007a.x86_64 @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before abort + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After abort + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test008 b/test/system/lock/exp.test008 new file mode 100644 index 00000000..499ce06e --- /dev/null +++ b/test/system/lock/exp.test008 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before commit + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test008.x86_64 b/test/system/lock/exp.test008.x86_64 new file mode 100644 index 00000000..102691d4 --- /dev/null +++ b/test/system/lock/exp.test008.x86_64 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before commit + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test008a b/test/system/lock/exp.test008a new file mode 100644 index 00000000..50f13bd4 --- /dev/null +++ b/test/system/lock/exp.test008a @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before commit + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test008a.x86_64 b/test/system/lock/exp.test008a.x86_64 new file mode 100644 index 00000000..8a72ef6e --- /dev/null +++ b/test/system/lock/exp.test008a.x86_64 @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before commit + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After commit + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test009 b/test/system/lock/exp.test009 new file mode 100644 index 00000000..b3f69262 --- /dev/null +++ b/test/system/lock/exp.test009 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before abort + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After abort + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test009.x86_64 b/test/system/lock/exp.test009.x86_64 new file mode 100644 index 00000000..c0d3171a --- /dev/null +++ b/test/system/lock/exp.test009.x86_64 @@ -0,0 +1,114 @@ +Table created +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before abort + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After abort + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test009a b/test/system/lock/exp.test009a new file mode 100644 index 00000000..595f9f35 --- /dev/null +++ b/test/system/lock/exp.test009a @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before abort + + + 17e7a014 + -1 + 0 + 0 + + + 20 + 1 + + + 17e7a024 + -1 + 0 + 0 + + + 36 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a044 + -1 + 0 + 0 + + + 68 + 1 + + + 17e7a054 + -1 + 0 + 0 + + + 84 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a074 + -1 + 0 + 0 + + + 116 + 1 + + + 17e7a084 + -1 + 0 + 0 + + + 132 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0a4 + -1 + 0 + 0 + + + 164 + 1 + + 10 + 1 + +After abort + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/exp.test009a.x86_64 b/test/system/lock/exp.test009a.x86_64 new file mode 100644 index 00000000..8ed9ba75 --- /dev/null +++ b/test/system/lock/exp.test009a.x86_64 @@ -0,0 +1,115 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before abort + + + 17e7a01c + -1 + 0 + 0 + + + 28 + 1 + + + 17e7a034 + -1 + 0 + 0 + + + 52 + 1 + + + 17e7a04c + -1 + 0 + 0 + + + 76 + 1 + + + 17e7a064 + -1 + 0 + 0 + + + 100 + 1 + + + 17e7a07c + -1 + 0 + 0 + + + 124 + 1 + + + 17e7a094 + -1 + 0 + 0 + + + 148 + 1 + + + 17e7a0ac + -1 + 0 + 0 + + + 172 + 1 + + + 17e7a0c4 + -1 + 0 + 0 + + + 196 + 1 + + + 17e7a0dc + -1 + 0 + 0 + + + 220 + 1 + + + 17e7a0f4 + -1 + 0 + 0 + + + 244 + 1 + + 10 + 1 + +After abort + + 0 + 1 + +Table Dropped diff --git a/test/system/lock/locktest001.c b/test/system/lock/locktest001.c new file mode 100644 index 00000000..72833cd1 --- /dev/null +++ b/test/system/lock/locktest001.c @@ -0,0 +1,36 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* check lock statistics +* commit transation +* check lock statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before commit\n"); + dbMgr->printDebugLockInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugLockInfo(); + dropTable(dbMgr, "t1"); + conn.close(); + return ret; +} diff --git a/test/system/lock/locktest002.c b/test/system/lock/locktest002.c new file mode 100644 index 00000000..bd3b64d5 --- /dev/null +++ b/test/system/lock/locktest002.c @@ -0,0 +1,36 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* check lock statistics +* abort transation +* check lock statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before rollback\n"); + dbMgr->printDebugLockInfo(); + conn.rollback(); + printf("After rollback\n"); + dbMgr->printDebugLockInfo(); + dropTable(dbMgr, "t1"); + conn.close(); + return ret; +} diff --git a/test/system/lock/locktest003.c b/test/system/lock/locktest003.c new file mode 100644 index 00000000..6e962977 --- /dev/null +++ b/test/system/lock/locktest003.c @@ -0,0 +1,43 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* start transaction with default isolation level +* select 10 tuples +* check lock statistics +* commit transation +* check lock statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = selectTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before commit\n"); + dbMgr->printDebugLockInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugLockInfo(); + dropTable(dbMgr, "t1"); + conn.close(); + return ret; +} diff --git a/test/system/lock/locktest004.c b/test/system/lock/locktest004.c new file mode 100644 index 00000000..b788051a --- /dev/null +++ b/test/system/lock/locktest004.c @@ -0,0 +1,43 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* start transaction with READ_REPEATABLE isolation level +* select 10 tuples +* check lock statistics +* commit transation +* check lock statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(READ_REPEATABLE); + if (rv != OK) ret = 5; + rc = selectTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before commit\n"); + dbMgr->printDebugLockInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugLockInfo(); + dropTable(dbMgr, "t1"); + conn.close(); + return ret; +} diff --git a/test/system/lock/locktest005.c b/test/system/lock/locktest005.c new file mode 100644 index 00000000..eb3ef5ee --- /dev/null +++ b/test/system/lock/locktest005.c @@ -0,0 +1,43 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* start transaction with READ_REPEATABLE isolation level +* select 10 tuples +* check lock statistics +* abort transation +* check lock statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(READ_REPEATABLE); + if (rv != OK) ret = 5; + rc = selectTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before rollback\n"); + dbMgr->printDebugLockInfo(); + conn.rollback(); + printf("After rollback\n"); + dbMgr->printDebugLockInfo(); + dropTable(dbMgr, "t1"); + conn.close(); + return ret; +} diff --git a/test/system/lock/locktest006.c b/test/system/lock/locktest006.c new file mode 100644 index 00000000..e85dd445 --- /dev/null +++ b/test/system/lock/locktest006.c @@ -0,0 +1,43 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* start transaction with READ_REPEATABLE isolation level +* update 10 tuples +* check lock statistics +* commit transation +* check lock statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(READ_REPEATABLE); + if (rv != OK) ret = 5; + rc = updateTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before commit\n"); + dbMgr->printDebugLockInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugLockInfo(); + dropTable(dbMgr, "t1"); + conn.close(); + return ret; +} diff --git a/test/system/lock/locktest007.c b/test/system/lock/locktest007.c new file mode 100644 index 00000000..cc533c9f --- /dev/null +++ b/test/system/lock/locktest007.c @@ -0,0 +1,43 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* start transaction with READ_REPEATABLE isolation level +* update 10 tuples +* check lock statistics +* abort transation +* check lock statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(READ_REPEATABLE); + if (rv != OK) ret = 5; + rc = updateTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before abort\n"); + dbMgr->printDebugLockInfo(); + conn.rollback(); + printf("After abort\n"); + dbMgr->printDebugLockInfo(); + dropTable(dbMgr, "t1"); + conn.close(); + return ret; +} diff --git a/test/system/lock/locktest008.c b/test/system/lock/locktest008.c new file mode 100644 index 00000000..02a0956f --- /dev/null +++ b/test/system/lock/locktest008.c @@ -0,0 +1,43 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* start transaction with READ_REPEATABLE isolation level +* delete 10 tuples +* check lock statistics +* commit transation +* check lock statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(READ_REPEATABLE); + if (rv != OK) ret = 5; + rc = deleteTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before commit\n"); + dbMgr->printDebugLockInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugLockInfo(); + dropTable(dbMgr, "t1"); + conn.close(); + return ret; +} diff --git a/test/system/lock/locktest009.c b/test/system/lock/locktest009.c new file mode 100644 index 00000000..b5cc8f83 --- /dev/null +++ b/test/system/lock/locktest009.c @@ -0,0 +1,43 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* start transaction with READ_REPEATABLE isolation level +* delete 10 tuples +* check lock statistics +* abort transation +* check lock statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(READ_REPEATABLE); + if (rv != OK) ret = 5; + rc = deleteTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before abort\n"); + dbMgr->printDebugLockInfo(); + conn.rollback(); + printf("After abort\n"); + dbMgr->printDebugLockInfo(); + dropTable(dbMgr, "t1"); + conn.close(); + return ret; +} diff --git a/test/system/proc/TODO b/test/system/proc/TODO new file mode 100644 index 00000000..15a41c5a --- /dev/null +++ b/test/system/proc/TODO @@ -0,0 +1,25 @@ +1.process 1 does insert and sleep (no commit), kill thread 1. +.check if the inserted row is seen in the database. +2.Do 1 with index, check for index nodes after that. +3.Do the above for update +5.Do the above for delete +7.Do the above for mixed insert, update and delete +8.Do 7 with index +9.proc 1 doing insert and sleep, kill proc1 with SIGINT, SIGTERM. +.check if the tuple is seen.check log whether it did cleanup. +10.proc 1 doing insert continously, kill proc1 with SIGINT, SIGTERM. +.check if the tuple is seen.check log whether it did cleanup. + + +Fault: +1.process 1 does insert and sleeps after inserting in chunk and before it inserts into hash index. kill the process +.check if the inserted row is seen. check the number of index nodes. +2.process 1 does insert and sleeps after inserting in chunk and idx1 and before it inserts into idx2. kill the process +.check if the inserted row is seen. check the number of index nodes in both idx +3.Do 1 for update +4.Do 2 for update +5.Do 1 for delete +6.Do 2 for delete +7.For all mutexes in system, take mutex and sleep. kill the proc. +.call apis which acquire that mutex and check if it works (Not now) + diff --git a/test/system/proc/exp.test001.ksh b/test/system/proc/exp.test001.ksh new file mode 100644 index 00000000..52a98c11 --- /dev/null +++ b/test/system/proc/exp.test001.ksh @@ -0,0 +1,6 @@ +Case 1: -d option with no connections + 1 + 99 +Case 2: -d option after 120 connect/disconnect + 1 + 99 diff --git a/test/system/proc/test001.ksh b/test/system/proc/test001.ksh new file mode 100755 index 00000000..c897b79e --- /dev/null +++ b/test/system/proc/test001.ksh @@ -0,0 +1,46 @@ +#!/bin/ksh +# TestCase: +# check proc slots used and free in proctable +# for i = 1 to 120 +# catalog +# end for +# check proc slots used and free in proctable +# check if any proc slot holds mutexes +# Note: catalog tool with no option specified connects and disconnects + +echo "Case 1: -d option with no connections" +$CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D proc |grep Slots +if [ $? -ne 0 ] +then + exit 1; +fi + + +count=120 +while [ ${count} -gt 0 ] +do + count=`expr ${count} - 1` + if [ $VALGRIND = "true" ] + then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog 2> $0.valgr + else + $CSQL_INSTALL_ROOT/bin/catalog >/dev/null + if [ $? -ne 0 ] + then + echo "create table failed" + exit 100; + fi + fi +done +echo "Case 2: -d option after 120 connect/disconnect" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D proc |grep Slots 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D proc |grep Slots + if [ $? -ne 0 ] + then + exit 1; + fi +fi +exit 0 diff --git a/test/system/trans/Makefile b/test/system/trans/Makefile new file mode 100644 index 00000000..f0548f59 --- /dev/null +++ b/test/system/trans/Makefile @@ -0,0 +1,87 @@ +OSNAME = $(shell uname -s) +PlatForm=notsupported +ifeq ($(OSNAME), SunOS) + CPlus = CC + CPlusFlags = -O2 -w $(COMPILER_FLAG) + SYSLIBS=-ldl -lnsl -lsocket -lposix4 + PlatForm=supported +endif +ifeq ($(OSNAME), Linux) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif +ifeq ($(OSNAME), FreeBSD) + CPlus = g++ + CPlusFlags = -g -w + SYSLIBS= -rdynamic -lrt -lpthread -lcrypt + PlatForm=supported +endif + + +INCL= -I$(CSQL_INSTALL_ROOT)/include -I../../../include +LIBS= -L$(CSQL_INSTALL_ROOT)/lib -lcsql + +TARGETS = \ + create drop \ + insert1andCommit insert1andAbort \ + test003 test003a \ + test004 test004a \ + test005 test005a \ + test006 test006a \ + test007 test007a \ + test008 test008a \ + test009 test009a \ + test010 test010a + +ifeq ($(PlatForm), supported) +all: $(TARGETS) +else +all: + echo "CSQL is not supported on $(OSNAME) platform" +endif + +create: create.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +drop: drop.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +insert1andCommit: insert1andCommit.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +insert1andAbort: insert1andAbort.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test003: transtest003.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test003a: transtest003.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004: transtest004.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test004a: transtest004.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005: transtest005.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test005a: transtest005.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test006: transtest006.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test006a: transtest006.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test007: transtest007.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test007a: transtest007.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test008: transtest008.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test008a: transtest008.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test009: transtest009.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test009a: transtest009.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test010: transtest010.c + $(CPlus) $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +test010a: transtest010.c + $(CPlus) -DWITHINDEX $(CPlusFlags) -o $@ $< $(INCL) $(LIBS) $(SYSLIBS) +clean: + rm -f $(TARGETS) + diff --git a/test/system/trans/common.h b/test/system/trans/common.h new file mode 100644 index 00000000..70460a1a --- /dev/null +++ b/test/system/trans/common.h @@ -0,0 +1,153 @@ +#include +DbRetVal createIndex(DatabaseManager *dbMgr, char *tblname, char *fldname, char *indname) +{ + HashIndexInitInfo *idxInfo = new HashIndexInitInfo(); + strcpy(idxInfo->tableName, tblname); + idxInfo->list.append(fldname); + idxInfo->indType = hashIndex; + idxInfo->isPrimary = true; + idxInfo->isUnique = true; + DbRetVal rv = dbMgr->createIndex(indname, idxInfo); + if (rv != OK) { printf("Index creation failed\n"); return rv; } + printf("Index created for %s\n", fldname); + delete idxInfo; + return OK; +} +DbRetVal createTable(DatabaseManager *dbMgr, char *tblname) +{ + TableDef tabDef; + tabDef.addField("f1", typeInt, 0, NULL, true); + tabDef.addField("f2", typeInt); + DbRetVal rv = dbMgr->createTable(tblname, tabDef); + if (rv != OK) { printf("Table creation failed\n"); return rv; } + printf("Table created\n"); + return OK; +} +DbRetVal dropTable(DatabaseManager *dbMgr, char *tblname) +{ + DbRetVal rv = dbMgr->dropTable(tblname); + if (rv != OK) { printf("Table drop failed\n"); return rv; } + printf("Table Dropped\n"); + return OK; +} +int insertTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + int id1 = 0; + table->bindFld("f1", &id1); + table->bindFld("f2", &id1); + int icount =0; + DbRetVal rv = OK; + for (int i = 0 ; i < count ; i++) + { + id1= i; + rv = table->insertTuple(); + if (rv != OK) break; + icount++; + + } + printf("Total Tuples inserted is %d\n", icount); + dbMgr->closeTable(table); + return icount; +} + +int selectTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + DbRetVal rv = OK; + + Condition p1; + int val1 = 0; + p1.setTerm("f1", OpEquals, &val1); + table->setCondition(&p1); + int i =0; + void *tuple; + for (i = 0 ; i < count ; i++) + { + val1 = i; + table->execute(); + if (rv != OK) break; + tuple = (char*)table->fetch() ; + if (tuple == NULL) break; + table->closeScan(); + } + printf("Total Tuples selected is %d\n", i); + dbMgr->closeTable(table); + return i; +} +int updateTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + DbRetVal rv = OK; + + int id1 = 0, id2 =0; + table->bindFld("f1", &id1); + table->bindFld("f2", &id2); + Condition p1; + int val1 = 0; + p1.setTerm("f1", OpEquals, &val1); + table->setCondition(&p1); + int i =0; + void *tuple; + for (i = 0 ; i < count ; i++) + { + val1 = i; + table->execute(); + if (rv != OK) break; + tuple = (char*)table->fetch() ; + if (tuple == NULL) break; + id2 = 1000 + i; + rv = table->updateTuple(); + if (rv != OK) break; + table->closeScan(); + } + printf("Total Tuples updated is %d\n", i); + dbMgr->closeTable(table); + return i; +} +int deleteTuple(DatabaseManager *dbMgr, Connection &conn, char *tblname, int count) +{ + Table *table = dbMgr->openTable(tblname); + if (table == NULL) + { + printf("Unable to open table\n"); + return 1; + } + DbRetVal rv = OK; + + Condition p1; + int val1 = 0; + p1.setTerm("f1", OpEquals, &val1); + table->setCondition(&p1); + int i =0; + void *tuple; + for (i = 0 ; i < count ; i++) + { + val1 = i; + table->execute(); + if (rv != OK) break; + tuple = (char*)table->fetch() ; + if (tuple == NULL) break; + rv = table->deleteTuple(); + if (rv != OK) break; + table->closeScan(); + } + printf("Total Tuples deleted is %d\n", i); + dbMgr->closeTable(table); + return i; +} diff --git a/test/system/trans/create.c b/test/system/trans/create.c new file mode 100644 index 00000000..2fa248b9 --- /dev/null +++ b/test/system/trans/create.c @@ -0,0 +1,16 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + if ( createTable(dbMgr, "t1") != 0 ) { ret = 3; } + + conn.close(); + return ret; + +} diff --git a/test/system/trans/drop.c b/test/system/trans/drop.c new file mode 100644 index 00000000..88eec578 --- /dev/null +++ b/test/system/trans/drop.c @@ -0,0 +1,15 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + if ( dropTable(dbMgr, "t1") != 0 ) { ret = 3; } + conn.close(); + return ret; + +} diff --git a/test/system/trans/exp.test001.ksh b/test/system/trans/exp.test001.ksh new file mode 100644 index 00000000..dfe248b2 --- /dev/null +++ b/test/system/trans/exp.test001.ksh @@ -0,0 +1,20 @@ +Table created +Case 1: -d option with no transactions + + 0 + 100 + + 0 + 1 + + +Case 2: -d option after 120 commits + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test002.ksh b/test/system/trans/exp.test002.ksh new file mode 100644 index 00000000..1b0559f6 --- /dev/null +++ b/test/system/trans/exp.test002.ksh @@ -0,0 +1,20 @@ +Table created +Case 1: -d option with no transactions + + 0 + 100 + + 0 + 1 + + +Case 2: -d option after 120 aborts + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test003 b/test/system/trans/exp.test003 new file mode 100644 index 00000000..9a31a708 --- /dev/null +++ b/test/system/trans/exp.test003 @@ -0,0 +1,141 @@ +Table created +Total Tuples inserted is 10 +Before commit + + + + 1 + + 16 + 0 + 17e7a0a4 + + + 16 + 0 + 17e7a094 + + + 16 + 0 + 17e7a084 + + + 16 + 0 + 17e7a074 + + + 16 + 0 + 17e7a064 + + + 16 + 0 + 17e7a054 + + + 16 + 0 + 17e7a044 + + + 16 + 0 + 17e7a034 + + + 16 + 0 + 17e7a024 + + + 16 + 0 + 17e7a014 + + 10 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test003.x86_64 b/test/system/trans/exp.test003.x86_64 new file mode 100644 index 00000000..b4fbd739 --- /dev/null +++ b/test/system/trans/exp.test003.x86_64 @@ -0,0 +1,141 @@ +Table created +Total Tuples inserted is 10 +Before commit + + + + 1 + + 16 + 0 + 17e7a0f4 + + + 16 + 0 + 17e7a0dc + + + 16 + 0 + 17e7a0c4 + + + 16 + 0 + 17e7a0ac + + + 16 + 0 + 17e7a094 + + + 16 + 0 + 17e7a07c + + + 16 + 0 + 17e7a064 + + + 16 + 0 + 17e7a04c + + + 16 + 0 + 17e7a034 + + + 16 + 0 + 17e7a01c + + 10 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test003a b/test/system/trans/exp.test003a new file mode 100644 index 00000000..2050a916 --- /dev/null +++ b/test/system/trans/exp.test003a @@ -0,0 +1,192 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Before commit + + + + 1 + + 16 + 0 + 17e7a0a4 + + + 20 + 3 + 17e7a0a4 + + + 16 + 0 + 17e7a094 + + + 20 + 3 + 17e7a094 + + + 16 + 0 + 17e7a084 + + + 20 + 3 + 17e7a084 + + + 16 + 0 + 17e7a074 + + + 20 + 3 + 17e7a074 + + + 16 + 0 + 17e7a064 + + + 20 + 3 + 17e7a064 + + + 16 + 0 + 17e7a054 + + + 20 + 3 + 17e7a054 + + + 16 + 0 + 17e7a044 + + + 20 + 3 + 17e7a044 + + + 16 + 0 + 17e7a034 + + + 20 + 3 + 17e7a034 + + + 16 + 0 + 17e7a024 + + + 20 + 3 + 17e7a024 + + + 16 + 0 + 17e7a014 + + + 20 + 3 + 17e7a014 + + 20 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 20 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test003a.x86_64 b/test/system/trans/exp.test003a.x86_64 new file mode 100644 index 00000000..615c803a --- /dev/null +++ b/test/system/trans/exp.test003a.x86_64 @@ -0,0 +1,192 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Before commit + + + + 1 + + 16 + 0 + 17e7a0f4 + + + 40 + 3 + 17e7a0f4 + + + 16 + 0 + 17e7a0dc + + + 40 + 3 + 17e7a0dc + + + 16 + 0 + 17e7a0c4 + + + 40 + 3 + 17e7a0c4 + + + 16 + 0 + 17e7a0ac + + + 40 + 3 + 17e7a0ac + + + 16 + 0 + 17e7a094 + + + 40 + 3 + 17e7a094 + + + 16 + 0 + 17e7a07c + + + 40 + 3 + 17e7a07c + + + 16 + 0 + 17e7a064 + + + 40 + 3 + 17e7a064 + + + 16 + 0 + 17e7a04c + + + 40 + 3 + 17e7a04c + + + 16 + 0 + 17e7a034 + + + 40 + 3 + 17e7a034 + + + 16 + 0 + 17e7a01c + + + 40 + 3 + 17e7a01c + + 20 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 20 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test004 b/test/system/trans/exp.test004 new file mode 100644 index 00000000..0f35e70b --- /dev/null +++ b/test/system/trans/exp.test004 @@ -0,0 +1,141 @@ +Table created +Total Tuples inserted is 10 +Before abort + + + + 1 + + 16 + 0 + 17e7a0a4 + + + 16 + 0 + 17e7a094 + + + 16 + 0 + 17e7a084 + + + 16 + 0 + 17e7a074 + + + 16 + 0 + 17e7a064 + + + 16 + 0 + 17e7a054 + + + 16 + 0 + 17e7a044 + + + 16 + 0 + 17e7a034 + + + 16 + 0 + 17e7a024 + + + 16 + 0 + 17e7a014 + + 10 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test004.x86_64 b/test/system/trans/exp.test004.x86_64 new file mode 100644 index 00000000..e135c214 --- /dev/null +++ b/test/system/trans/exp.test004.x86_64 @@ -0,0 +1,141 @@ +Table created +Total Tuples inserted is 10 +Before abort + + + + 1 + + 16 + 0 + 17e7a0f4 + + + 16 + 0 + 17e7a0dc + + + 16 + 0 + 17e7a0c4 + + + 16 + 0 + 17e7a0ac + + + 16 + 0 + 17e7a094 + + + 16 + 0 + 17e7a07c + + + 16 + 0 + 17e7a064 + + + 16 + 0 + 17e7a04c + + + 16 + 0 + 17e7a034 + + + 16 + 0 + 17e7a01c + + 10 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test004a b/test/system/trans/exp.test004a new file mode 100644 index 00000000..1df67e74 --- /dev/null +++ b/test/system/trans/exp.test004a @@ -0,0 +1,192 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Before abort + + + + 1 + + 16 + 0 + 17e7a0a4 + + + 20 + 3 + 17e7a0a4 + + + 16 + 0 + 17e7a094 + + + 20 + 3 + 17e7a094 + + + 16 + 0 + 17e7a084 + + + 20 + 3 + 17e7a084 + + + 16 + 0 + 17e7a074 + + + 20 + 3 + 17e7a074 + + + 16 + 0 + 17e7a064 + + + 20 + 3 + 17e7a064 + + + 16 + 0 + 17e7a054 + + + 20 + 3 + 17e7a054 + + + 16 + 0 + 17e7a044 + + + 20 + 3 + 17e7a044 + + + 16 + 0 + 17e7a034 + + + 20 + 3 + 17e7a034 + + + 16 + 0 + 17e7a024 + + + 20 + 3 + 17e7a024 + + + 16 + 0 + 17e7a014 + + + 20 + 3 + 17e7a014 + + 20 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 20 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test004a.x86_64 b/test/system/trans/exp.test004a.x86_64 new file mode 100644 index 00000000..9f30e947 --- /dev/null +++ b/test/system/trans/exp.test004a.x86_64 @@ -0,0 +1,192 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Before abort + + + + 1 + + 16 + 0 + 17e7a0f4 + + + 40 + 3 + 17e7a0f4 + + + 16 + 0 + 17e7a0dc + + + 40 + 3 + 17e7a0dc + + + 16 + 0 + 17e7a0c4 + + + 40 + 3 + 17e7a0c4 + + + 16 + 0 + 17e7a0ac + + + 40 + 3 + 17e7a0ac + + + 16 + 0 + 17e7a094 + + + 40 + 3 + 17e7a094 + + + 16 + 0 + 17e7a07c + + + 40 + 3 + 17e7a07c + + + 16 + 0 + 17e7a064 + + + 40 + 3 + 17e7a064 + + + 16 + 0 + 17e7a04c + + + 40 + 3 + 17e7a04c + + + 16 + 0 + 17e7a034 + + + 40 + 3 + 17e7a034 + + + 16 + 0 + 17e7a01c + + + 40 + 3 + 17e7a01c + + 20 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 20 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test005 b/test/system/trans/exp.test005 new file mode 100644 index 00000000..eca46961 --- /dev/null +++ b/test/system/trans/exp.test005 @@ -0,0 +1,32 @@ +Table created +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before commit + + + + 1 + 0 + + + 1 + 0 + + + 1 + 99 + + 0 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test005a b/test/system/trans/exp.test005a new file mode 100644 index 00000000..94387f5a --- /dev/null +++ b/test/system/trans/exp.test005a @@ -0,0 +1,33 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before commit + + + + 1 + 0 + + + 1 + 0 + + + 1 + 99 + + 0 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test006 b/test/system/trans/exp.test006 new file mode 100644 index 00000000..7a12c3a9 --- /dev/null +++ b/test/system/trans/exp.test006 @@ -0,0 +1,32 @@ +Table created +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before abort + + + + 1 + 0 + + + 1 + 0 + + + 1 + 99 + + 0 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test006a b/test/system/trans/exp.test006a new file mode 100644 index 00000000..ac667dfd --- /dev/null +++ b/test/system/trans/exp.test006a @@ -0,0 +1,33 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples selected is 10 +Before abort + + + + 1 + 0 + + + 1 + 0 + + + 1 + 99 + + 0 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test007 b/test/system/trans/exp.test007 new file mode 100644 index 00000000..14118471 --- /dev/null +++ b/test/system/trans/exp.test007 @@ -0,0 +1,142 @@ +Table created +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before commit + + + + 1 + + 32 + 2 + 17e7a0a4 + + + 32 + 2 + 17e7a094 + + + 32 + 2 + 17e7a084 + + + 32 + 2 + 17e7a074 + + + 32 + 2 + 17e7a064 + + + 32 + 2 + 17e7a054 + + + 32 + 2 + 17e7a044 + + + 32 + 2 + 17e7a034 + + + 32 + 2 + 17e7a024 + + + 32 + 2 + 17e7a014 + + 10 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test007.x86_64 b/test/system/trans/exp.test007.x86_64 new file mode 100644 index 00000000..6e4226bf --- /dev/null +++ b/test/system/trans/exp.test007.x86_64 @@ -0,0 +1,142 @@ +Table created +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before commit + + + + 1 + + 16 + 2 + 17e7a0f4 + + + 16 + 2 + 17e7a0dc + + + 16 + 2 + 17e7a0c4 + + + 16 + 2 + 17e7a0ac + + + 16 + 2 + 17e7a094 + + + 16 + 2 + 17e7a07c + + + 16 + 2 + 17e7a064 + + + 16 + 2 + 17e7a04c + + + 16 + 2 + 17e7a034 + + + 16 + 2 + 17e7a01c + + 10 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test007a b/test/system/trans/exp.test007a new file mode 100644 index 00000000..5510882e --- /dev/null +++ b/test/system/trans/exp.test007a @@ -0,0 +1,143 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before commit + + + + 1 + + 32 + 2 + 17e7a0a4 + + + 32 + 2 + 17e7a094 + + + 32 + 2 + 17e7a084 + + + 32 + 2 + 17e7a074 + + + 32 + 2 + 17e7a064 + + + 32 + 2 + 17e7a054 + + + 32 + 2 + 17e7a044 + + + 32 + 2 + 17e7a034 + + + 32 + 2 + 17e7a024 + + + 32 + 2 + 17e7a014 + + 10 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test007a.x86_64 b/test/system/trans/exp.test007a.x86_64 new file mode 100644 index 00000000..c2293d37 --- /dev/null +++ b/test/system/trans/exp.test007a.x86_64 @@ -0,0 +1,143 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before commit + + + + 1 + + 16 + 2 + 17e7a0f4 + + + 16 + 2 + 17e7a0dc + + + 16 + 2 + 17e7a0c4 + + + 16 + 2 + 17e7a0ac + + + 16 + 2 + 17e7a094 + + + 16 + 2 + 17e7a07c + + + 16 + 2 + 17e7a064 + + + 16 + 2 + 17e7a04c + + + 16 + 2 + 17e7a034 + + + 16 + 2 + 17e7a01c + + 10 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test008 b/test/system/trans/exp.test008 new file mode 100644 index 00000000..b3149c4d --- /dev/null +++ b/test/system/trans/exp.test008 @@ -0,0 +1,142 @@ +Table created +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before abort + + + + 1 + + 32 + 2 + 17e7a0a4 + + + 32 + 2 + 17e7a094 + + + 32 + 2 + 17e7a084 + + + 32 + 2 + 17e7a074 + + + 32 + 2 + 17e7a064 + + + 32 + 2 + 17e7a054 + + + 32 + 2 + 17e7a044 + + + 32 + 2 + 17e7a034 + + + 32 + 2 + 17e7a024 + + + 32 + 2 + 17e7a014 + + 10 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test008.x86_64 b/test/system/trans/exp.test008.x86_64 new file mode 100644 index 00000000..5658a113 --- /dev/null +++ b/test/system/trans/exp.test008.x86_64 @@ -0,0 +1,142 @@ +Table created +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before abort + + + + 1 + + 16 + 2 + 17e7a0f4 + + + 16 + 2 + 17e7a0dc + + + 16 + 2 + 17e7a0c4 + + + 16 + 2 + 17e7a0ac + + + 16 + 2 + 17e7a094 + + + 16 + 2 + 17e7a07c + + + 16 + 2 + 17e7a064 + + + 16 + 2 + 17e7a04c + + + 16 + 2 + 17e7a034 + + + 16 + 2 + 17e7a01c + + 10 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test008a b/test/system/trans/exp.test008a new file mode 100644 index 00000000..fbea281b --- /dev/null +++ b/test/system/trans/exp.test008a @@ -0,0 +1,143 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before abort + + + + 1 + + 32 + 2 + 17e7a0a4 + + + 32 + 2 + 17e7a094 + + + 32 + 2 + 17e7a084 + + + 32 + 2 + 17e7a074 + + + 32 + 2 + 17e7a064 + + + 32 + 2 + 17e7a054 + + + 32 + 2 + 17e7a044 + + + 32 + 2 + 17e7a034 + + + 32 + 2 + 17e7a024 + + + 32 + 2 + 17e7a014 + + 10 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test008a.x86_64 b/test/system/trans/exp.test008a.x86_64 new file mode 100644 index 00000000..fef1122d --- /dev/null +++ b/test/system/trans/exp.test008a.x86_64 @@ -0,0 +1,143 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples updated is 10 +Before abort + + + + 1 + + 16 + 2 + 17e7a0f4 + + + 16 + 2 + 17e7a0dc + + + 16 + 2 + 17e7a0c4 + + + 16 + 2 + 17e7a0ac + + + 16 + 2 + 17e7a094 + + + 16 + 2 + 17e7a07c + + + 16 + 2 + 17e7a064 + + + 16 + 2 + 17e7a04c + + + 16 + 2 + 17e7a034 + + + 16 + 2 + 17e7a01c + + 10 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test009 b/test/system/trans/exp.test009 new file mode 100644 index 00000000..90935d8e --- /dev/null +++ b/test/system/trans/exp.test009 @@ -0,0 +1,142 @@ +Table created +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before commit + + + + 1 + + 16 + 1 + 17e7a0a4 + + + 16 + 1 + 17e7a094 + + + 16 + 1 + 17e7a084 + + + 16 + 1 + 17e7a074 + + + 16 + 1 + 17e7a064 + + + 16 + 1 + 17e7a054 + + + 16 + 1 + 17e7a044 + + + 16 + 1 + 17e7a034 + + + 16 + 1 + 17e7a024 + + + 16 + 1 + 17e7a014 + + 10 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test009.x86_64 b/test/system/trans/exp.test009.x86_64 new file mode 100644 index 00000000..28d8b154 --- /dev/null +++ b/test/system/trans/exp.test009.x86_64 @@ -0,0 +1,142 @@ +Table created +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before commit + + + + 1 + + 0 + 1 + 17e7a0f4 + + + 0 + 1 + 17e7a0dc + + + 0 + 1 + 17e7a0c4 + + + 0 + 1 + 17e7a0ac + + + 0 + 1 + 17e7a094 + + + 0 + 1 + 17e7a07c + + + 0 + 1 + 17e7a064 + + + 0 + 1 + 17e7a04c + + + 0 + 1 + 17e7a034 + + + 0 + 1 + 17e7a01c + + 10 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test009a b/test/system/trans/exp.test009a new file mode 100644 index 00000000..ba293d3b --- /dev/null +++ b/test/system/trans/exp.test009a @@ -0,0 +1,193 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before commit + + + + 1 + + 16 + 1 + 17e7a0a4 + + + 20 + 5 + 17e7a0a4 + + + 16 + 1 + 17e7a094 + + + 20 + 5 + 17e7a094 + + + 16 + 1 + 17e7a084 + + + 20 + 5 + 17e7a084 + + + 16 + 1 + 17e7a074 + + + 20 + 5 + 17e7a074 + + + 16 + 1 + 17e7a064 + + + 20 + 5 + 17e7a064 + + + 16 + 1 + 17e7a054 + + + 20 + 5 + 17e7a054 + + + 16 + 1 + 17e7a044 + + + 20 + 5 + 17e7a044 + + + 16 + 1 + 17e7a034 + + + 20 + 5 + 17e7a034 + + + 16 + 1 + 17e7a024 + + + 20 + 5 + 17e7a024 + + + 16 + 1 + 17e7a014 + + + 20 + 5 + 17e7a014 + + 20 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 20 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test009a.x86_64 b/test/system/trans/exp.test009a.x86_64 new file mode 100644 index 00000000..cad82331 --- /dev/null +++ b/test/system/trans/exp.test009a.x86_64 @@ -0,0 +1,193 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before commit + + + + 1 + + 0 + 1 + 17e7a0f4 + + + 40 + 5 + 17e7a0f4 + + + 0 + 1 + 17e7a0dc + + + 40 + 5 + 17e7a0dc + + + 0 + 1 + 17e7a0c4 + + + 40 + 5 + 17e7a0c4 + + + 0 + 1 + 17e7a0ac + + + 40 + 5 + 17e7a0ac + + + 0 + 1 + 17e7a094 + + + 40 + 5 + 17e7a094 + + + 0 + 1 + 17e7a07c + + + 40 + 5 + 17e7a07c + + + 0 + 1 + 17e7a064 + + + 40 + 5 + 17e7a064 + + + 0 + 1 + 17e7a04c + + + 40 + 5 + 17e7a04c + + + 0 + 1 + 17e7a034 + + + 40 + 5 + 17e7a034 + + + 0 + 1 + 17e7a01c + + + 40 + 5 + 17e7a01c + + 20 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 20 + 1 + + +After commit + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test010 b/test/system/trans/exp.test010 new file mode 100644 index 00000000..96f2f5ef --- /dev/null +++ b/test/system/trans/exp.test010 @@ -0,0 +1,142 @@ +Table created +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before abort + + + + 1 + + 16 + 1 + 17e7a0a4 + + + 16 + 1 + 17e7a094 + + + 16 + 1 + 17e7a084 + + + 16 + 1 + 17e7a074 + + + 16 + 1 + 17e7a064 + + + 16 + 1 + 17e7a054 + + + 16 + 1 + 17e7a044 + + + 16 + 1 + 17e7a034 + + + 16 + 1 + 17e7a024 + + + 16 + 1 + 17e7a014 + + 10 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test010.x86_64 b/test/system/trans/exp.test010.x86_64 new file mode 100644 index 00000000..62a57a25 --- /dev/null +++ b/test/system/trans/exp.test010.x86_64 @@ -0,0 +1,142 @@ +Table created +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before abort + + + + 1 + + 0 + 1 + 17e7a0f4 + + + 0 + 1 + 17e7a0dc + + + 0 + 1 + 17e7a0c4 + + + 0 + 1 + 17e7a0ac + + + 0 + 1 + 17e7a094 + + + 0 + 1 + 17e7a07c + + + 0 + 1 + 17e7a064 + + + 0 + 1 + 17e7a04c + + + 0 + 1 + 17e7a034 + + + 0 + 1 + 17e7a01c + + 10 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 10 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test010a b/test/system/trans/exp.test010a new file mode 100644 index 00000000..ca3e1b30 --- /dev/null +++ b/test/system/trans/exp.test010a @@ -0,0 +1,193 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before abort + + + + 1 + + 16 + 1 + 17e7a0a4 + + + 20 + 5 + 17e7a0a4 + + + 16 + 1 + 17e7a094 + + + 20 + 5 + 17e7a094 + + + 16 + 1 + 17e7a084 + + + 20 + 5 + 17e7a084 + + + 16 + 1 + 17e7a074 + + + 20 + 5 + 17e7a074 + + + 16 + 1 + 17e7a064 + + + 20 + 5 + 17e7a064 + + + 16 + 1 + 17e7a054 + + + 20 + 5 + 17e7a054 + + + 16 + 1 + 17e7a044 + + + 20 + 5 + 17e7a044 + + + 16 + 1 + 17e7a034 + + + 20 + 5 + 17e7a034 + + + 16 + 1 + 17e7a024 + + + 20 + 5 + 17e7a024 + + + 16 + 1 + 17e7a014 + + + 20 + 5 + 17e7a014 + + 20 + + + 1 + + 17e7a014 + -1 + 0 + 0 + + + 17e7a024 + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a044 + -1 + 0 + 0 + + + 17e7a054 + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a074 + -1 + 0 + 0 + + + 17e7a084 + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0a4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 20 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/exp.test010a.x86_64 b/test/system/trans/exp.test010a.x86_64 new file mode 100644 index 00000000..a279a160 --- /dev/null +++ b/test/system/trans/exp.test010a.x86_64 @@ -0,0 +1,193 @@ +Table created +Index created for f1 +Total Tuples inserted is 10 +Total Tuples deleted is 10 +Before abort + + + + 1 + + 0 + 1 + 17e7a0f4 + + + 40 + 5 + 17e7a0f4 + + + 0 + 1 + 17e7a0dc + + + 40 + 5 + 17e7a0dc + + + 0 + 1 + 17e7a0c4 + + + 40 + 5 + 17e7a0c4 + + + 0 + 1 + 17e7a0ac + + + 40 + 5 + 17e7a0ac + + + 0 + 1 + 17e7a094 + + + 40 + 5 + 17e7a094 + + + 0 + 1 + 17e7a07c + + + 40 + 5 + 17e7a07c + + + 0 + 1 + 17e7a064 + + + 40 + 5 + 17e7a064 + + + 0 + 1 + 17e7a04c + + + 40 + 5 + 17e7a04c + + + 0 + 1 + 17e7a034 + + + 40 + 5 + 17e7a034 + + + 0 + 1 + 17e7a01c + + + 40 + 5 + 17e7a01c + + 20 + + + 1 + + 17e7a01c + -1 + 0 + 0 + + + 17e7a034 + -1 + 0 + 0 + + + 17e7a04c + -1 + 0 + 0 + + + 17e7a064 + -1 + 0 + 0 + + + 17e7a07c + -1 + 0 + 0 + + + 17e7a094 + -1 + 0 + 0 + + + 17e7a0ac + -1 + 0 + 0 + + + 17e7a0c4 + -1 + 0 + 0 + + + 17e7a0dc + -1 + 0 + 0 + + + 17e7a0f4 + -1 + 0 + 0 + + 10 + + + 1 + 99 + + 20 + 1 + + +After abort + + 0 + 100 + + 0 + 1 + + +Table Dropped diff --git a/test/system/trans/insert1andAbort.c b/test/system/trans/insert1andAbort.c new file mode 100644 index 00000000..778e0cb0 --- /dev/null +++ b/test/system/trans/insert1andAbort.c @@ -0,0 +1,17 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + conn.startTransaction(); + ret = insertTuple(dbMgr, conn, "t1", 1); + conn.rollback(); + conn.close(); + return ret; + +} diff --git a/test/system/trans/insert1andCommit.c b/test/system/trans/insert1andCommit.c new file mode 100644 index 00000000..39e669d4 --- /dev/null +++ b/test/system/trans/insert1andCommit.c @@ -0,0 +1,17 @@ + +#include "common.h" +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManager *dbMgr = conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0; + conn.startTransaction(); + ret = insertTuple(dbMgr, conn, "t1", 1); + conn.commit(); + conn.close(); + return ret; + +} diff --git a/test/system/trans/locktest009.c b/test/system/trans/locktest009.c new file mode 100644 index 00000000..448b33d8 --- /dev/null +++ b/test/system/trans/locktest009.c @@ -0,0 +1,44 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* start new transaction +* delete 10 tuples +* check transaction statistics +* commit transation +* check transaction statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = deleteTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + + printf("Before commit\n"); + dbMgr->printDebugTransInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugTransInfo(); + conn.close(); + return ret; +} diff --git a/test/system/trans/test001.ksh b/test/system/trans/test001.ksh new file mode 100755 index 00000000..b385efaf --- /dev/null +++ b/test/system/trans/test001.ksh @@ -0,0 +1,75 @@ +#!/bin/ksh +# TestCase: +# check used and free transacation slots in transaction table +# create table +# for i = 1 to 120 +# insert 1 tuple in 1 transaction and commit +# end for +# check used and free transacation slots in transaction table + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail +EXECUTABLE=${PWD}/system/trans/create +REL_PATH=. +if [ -s "$EXECUTABLE" ] +then + REL_PATH=${PWD}/system/trans +fi +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2> $0.valgr +else + ${REL_PATH}/create + if [ $? -ne 0 ] + then + echo "create table failed" + exit 100; + fi +fi + +echo "Case 1: -d option with no transactions" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans + if [ $? -ne 0 ] + then + exit 1; + fi +fi + +count=120 +while [ ${count} -gt 0 ] +do + count=`expr ${count} - 1` + if [ $VALGRIND = "true" ] + then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert1andCommit 2>> $0.valgr + else + ${REL_PATH}/insert1andCommit >/tmp/tstlog + if [ $? -ne 1 ] + then + echo "insert failed" + exit 100; + fi + fi +done +echo "Case 2: -d option after 120 commits" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans + if [ $? -ne 0 ] + then + exit 1; + fi +fi +${REL_PATH}/drop +if [ $? -ne 0 ] +then + echo "drop table failed" + exit 100; +fi +exit 0 diff --git a/test/system/trans/test002.ksh b/test/system/trans/test002.ksh new file mode 100755 index 00000000..e266cf91 --- /dev/null +++ b/test/system/trans/test002.ksh @@ -0,0 +1,74 @@ +#!/bin/ksh +# TestCase: +# check used and free transacation slots in transaction table +# create table +# for i = 1 to 120 +# insert 1 tuple in 1 transaction and abort +# end for +# check used and free transacation slots in transaction table + +#Run this test only under csql/test or on this directory. +#Otherwise, it may fail +EXECUTABLE=${PWD}/system/trans/create +REL_PATH=. +if [ -s "$EXECUTABLE" ] +then + REL_PATH=${PWD}/system/trans +fi +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2> $0.valgr +else + ${REL_PATH}/create + if [ $? -ne 0 ] + then + echo "create table failed" + exit 100; + fi +fi +echo "Case 1: -d option with no transactions" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans + if [ $? -ne 0 ] + then + exit 1; + fi +fi + +count=120 +while [ ${count} -gt 0 ] +do + count=`expr ${count} - 1` + if [ $VALGRIND = "true" ] + then + valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert1andAbort 2>> $0.valgr + else + ${REL_PATH}/insert1andAbort >/tmp/tstlog + if [ $? -ne 1 ] + then + echo "insert failed" + exit 100; + fi + fi +done +echo "Case 2: -d option after 120 aborts" +if [ $VALGRIND = "true" ] +then + valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans 2>> $0.valgr +else + $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans + if [ $? -ne 0 ] + then + exit 1; + fi +fi +${REL_PATH}/drop +if [ $? -ne 0 ] +then + echo "drop table failed" + exit 100; +fi +exit 0 diff --git a/test/system/trans/transtest003.c b/test/system/trans/transtest003.c new file mode 100644 index 00000000..48a9a3c1 --- /dev/null +++ b/test/system/trans/transtest003.c @@ -0,0 +1,36 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* check transaction statistics +* commit transation +* check transaction statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before commit\n"); + dbMgr->printDebugTransInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugTransInfo(); + dropTable(dbMgr ,"t1"); + conn.close(); + return ret; +} diff --git a/test/system/trans/transtest004.c b/test/system/trans/transtest004.c new file mode 100644 index 00000000..d75cde06 --- /dev/null +++ b/test/system/trans/transtest004.c @@ -0,0 +1,36 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* check transaction statistics +* abort transation +* check transaction statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + printf("Before abort\n"); + dbMgr->printDebugTransInfo(); + conn.rollback(); + printf("After abort\n"); + dbMgr->printDebugTransInfo(); + dropTable(dbMgr ,"t1"); + conn.close(); + return ret; +} diff --git a/test/system/trans/transtest005.c b/test/system/trans/transtest005.c new file mode 100644 index 00000000..f989dc86 --- /dev/null +++ b/test/system/trans/transtest005.c @@ -0,0 +1,45 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* start new transaction +* select 10 tuples +* check transaction statistics +* commit transation +* check transaction statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = selectTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + + printf("Before commit\n"); + dbMgr->printDebugTransInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugTransInfo(); + dropTable(dbMgr ,"t1"); + conn.close(); + return ret; +} diff --git a/test/system/trans/transtest006.c b/test/system/trans/transtest006.c new file mode 100644 index 00000000..02649f56 --- /dev/null +++ b/test/system/trans/transtest006.c @@ -0,0 +1,45 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* start new transaction +* select 10 tuples +* check transaction statistics +* abort transation +* check transaction statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = selectTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + + printf("Before abort\n"); + dbMgr->printDebugTransInfo(); + conn.rollback(); + printf("After abort\n"); + dbMgr->printDebugTransInfo(); + dropTable(dbMgr ,"t1"); + conn.close(); + return ret; +} diff --git a/test/system/trans/transtest007.c b/test/system/trans/transtest007.c new file mode 100644 index 00000000..7acc2e3c --- /dev/null +++ b/test/system/trans/transtest007.c @@ -0,0 +1,45 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* start new transaction +* update 10 tuples +* check transaction statistics +* commit transation +* check transaction statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = updateTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + + printf("Before commit\n"); + dbMgr->printDebugTransInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugTransInfo(); + dropTable(dbMgr ,"t1"); + conn.close(); + return ret; +} diff --git a/test/system/trans/transtest008.c b/test/system/trans/transtest008.c new file mode 100644 index 00000000..e8408b7f --- /dev/null +++ b/test/system/trans/transtest008.c @@ -0,0 +1,45 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* start new transaction +* update 10 tuples +* check transaction statistics +* abort transation +* check transaction statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = updateTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + + printf("Before abort\n"); + dbMgr->printDebugTransInfo(); + conn.rollback(); + printf("After abort\n"); + dbMgr->printDebugTransInfo(); + dropTable(dbMgr ,"t1"); + conn.close(); + return ret; +} diff --git a/test/system/trans/transtest009.c b/test/system/trans/transtest009.c new file mode 100644 index 00000000..e822f0aa --- /dev/null +++ b/test/system/trans/transtest009.c @@ -0,0 +1,45 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* start new transaction +* delete 10 tuples +* check transaction statistics +* commit transation +* check transaction statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = deleteTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + + printf("Before commit\n"); + dbMgr->printDebugTransInfo(); + conn.commit(); + printf("After commit\n"); + dbMgr->printDebugTransInfo(); + dropTable(dbMgr ,"t1"); + conn.close(); + return ret; +} diff --git a/test/system/trans/transtest010.c b/test/system/trans/transtest010.c new file mode 100644 index 00000000..2ec9d2d4 --- /dev/null +++ b/test/system/trans/transtest010.c @@ -0,0 +1,45 @@ +/********************************************************** +* Test Case +* create table t1 +* create index if specified +* insert 10 tuples +* start new transaction +* delete 10 tuples +* check transaction statistics +* abort transation +* check transaction statistics +*/ +#include "common.h" +#include +int main() +{ + Connection conn; + DbRetVal rv = conn.open("root", "manager"); + if (rv != OK) return 1; + DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager(); + if (dbMgr == NULL) { printf("Auth failed\n"); return 2;} + int ret =0, rc =0; + if (createTable(dbMgr, "t1") != 0 ) { ret = 3; } +#ifdef WITHINDEX + if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; } +#endif + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = insertTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + conn.commit(); + + rv = conn.startTransaction(); + if (rv != OK) ret = 5; + rc = deleteTuple(dbMgr, conn, "t1", 10); + if (rc != 10) ret = 6; + + printf("Before abort\n"); + dbMgr->printDebugTransInfo(); + conn.rollback(); + printf("After abort\n"); + dbMgr->printDebugTransInfo(); + dropTable(dbMgr ,"t1"); + conn.close(); + return ret; +} -- 2.11.4.GIT