transactd 1.0.1-x86-mswin32-100
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/BUILD_UNIX-JA +174 -0
- data/BUILD_WIN-JA +256 -0
- data/CMakeLists.txt +96 -0
- data/COPYING +339 -0
- data/README +406 -0
- data/README-JA +424 -0
- data/bin/1.9/transactd.so +0 -0
- data/bin/2.0/transactd.so +0 -0
- data/bin/common/tdclc_32_1_0.dll +0 -0
- data/bin/common/tdclcpp_vc100_32m_1_1.dll +0 -0
- data/build/common/copyifgreater.cmd +30 -0
- data/build/common/copyifgreater.js +290 -0
- data/build/common/system.cmake +122 -0
- data/build/tdclrb/bldgem/extconf.rb +123 -0
- data/build/tdclrb/gem/INSTALLLOG.win32 +9 -0
- data/build/tdclrb/gem/Makefile.win32-VS +65 -0
- data/build/tdclrb/gem/Makefile.win32-prebuilt +48 -0
- data/build/tdclrb/gem/detect.rb +31 -0
- data/build/tdclrb/gem/helper.rb +113 -0
- data/build/tdclrb/gem/transactd.rb +22 -0
- data/source/bzs/test/tdclrb/bench_tdclcpp.rb +375 -0
- data/source/bzs/test/tdclrb/prepare.rb +226 -0
- data/source/bzs/test/tdclrb/transactd_datetime_spec.rb +172 -0
- data/source/bzs/test/tdclrb/transactd_kanjischema_spec.rb +208 -0
- data/source/bzs/test/tdclrb/transactd_spec.rb +1536 -0
- data/transactd.gemspec +97 -0
- metadata +76 -0
@@ -0,0 +1,113 @@
|
|
1
|
+
# coding : utf-8
|
2
|
+
=begin =============================================================
|
3
|
+
Copyright (C) 2013 BizStation Corp All rights reserved.
|
4
|
+
|
5
|
+
This program is free software; you can redistribute it and/or
|
6
|
+
modify it under the terms of the GNU General Public License
|
7
|
+
as published by the Free Software Foundation; either version 2
|
8
|
+
of the License, or (at your option) any later version.
|
9
|
+
|
10
|
+
This program is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with this program; if not, write to the Free Software
|
17
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
18
|
+
02111-1307, USA.
|
19
|
+
===================================================================
|
20
|
+
=end
|
21
|
+
def to_native_path(path)
|
22
|
+
return File::ALT_SEPARATOR ? path.gsub('/', File::ALT_SEPARATOR) : path
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_slash_path(path)
|
26
|
+
return File::ALT_SEPARATOR ? path.gsub(File::ALT_SEPARATOR, '/') : path
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_ruby_bitness
|
30
|
+
return ['a'].pack('P').length > 4 ? 64 : 32
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_windows_bitness
|
34
|
+
return ENV.has_key?('ProgramFiles(x86)') ? 64 : 32
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_windows_sysdir()
|
38
|
+
ruby_bitness = get_ruby_bitness()
|
39
|
+
windows_bitness = get_windows_bitness()
|
40
|
+
if windows_bitness == 32
|
41
|
+
return to_native_path(File.join(ENV['Systemroot'], 'System32/'))
|
42
|
+
else
|
43
|
+
if ruby_bitness == 32
|
44
|
+
return to_native_path(File.join(ENV['Systemroot'], 'SysWOW64/'))
|
45
|
+
else
|
46
|
+
return to_native_path(File.join(ENV['Systemroot'], 'System32/'))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_common_binary_files(transactd_gem_root)
|
52
|
+
ruby_bitness = get_ruby_bitness()
|
53
|
+
windows_bitness = get_windows_bitness()
|
54
|
+
ruby_bitness = 32 if windows_bitness == 32
|
55
|
+
bin_files = Dir.glob(File.join(transactd_gem_root, 'bin/common/tdclc_' + ruby_bitness.to_s + '_*.dll'))
|
56
|
+
bin_files += Dir.glob(File.join(transactd_gem_root, 'bin/common/tdclcpp_*_' + ruby_bitness.to_s + 'm_*.dll'))
|
57
|
+
sysdir = get_windows_sysdir()
|
58
|
+
bin_files = bin_files.map{ |i| '"' + to_native_path(i) + '" "' + sysdir + '"' }
|
59
|
+
return bin_files
|
60
|
+
end
|
61
|
+
|
62
|
+
def make_makefile_prebuilt_win32(ruby_bin_path, transactd_gem_root)
|
63
|
+
bin_files = get_common_binary_files(transactd_gem_root)
|
64
|
+
begin
|
65
|
+
mkfile_dummy = open('Makefile', 'w')
|
66
|
+
mkfile = open('nmake.cmd', 'w')
|
67
|
+
srcpath = File.join(transactd_gem_root, 'build/tdclrb/gem/Makefile.win32-prebuilt')
|
68
|
+
copycmd = File.join(transactd_gem_root, 'build/common/copyifgreater.cmd')
|
69
|
+
source = open(srcpath, 'r')
|
70
|
+
mkfile.puts '@echo off'
|
71
|
+
mkfile.puts 'set TRANSACTD_GEM_ROOT=' + to_native_path(transactd_gem_root)
|
72
|
+
mkfile.puts 'set RUBY_BIN_PATH=' + to_native_path(ruby_bin_path)
|
73
|
+
mkfile.puts 'set COPYCMD=' + to_native_path(copycmd)
|
74
|
+
mkfile.puts source.read
|
75
|
+
mkfile.puts ''
|
76
|
+
bin_files.each{ |i|
|
77
|
+
files = i.split(' ').map{ |i| i.strip.gsub!(/(^(\s|\"|)+)|((\s|\")+$)/, '')}
|
78
|
+
srcfile = (files.length > 0) ? files[0] : 'unknown error'
|
79
|
+
dstfile = (files.length > 1) ? files[1] : 'unknown error'
|
80
|
+
mkfile.puts <<EOS
|
81
|
+
call "%COPYCMD%" #{i} >> "%INSTALLLOG%" 2>> "%ERRMSG%"
|
82
|
+
call :getsize "%ERRMSG%"
|
83
|
+
if !getsize_ret! GTR 0 (
|
84
|
+
if ERRORLEVEL 1 (
|
85
|
+
echo ************************************************************** 1>&2
|
86
|
+
echo EROOR MESSAGE 1>&2
|
87
|
+
echo Failed to Install. 1>&2
|
88
|
+
echo Perhaps it require to run as Administrator, or file is in use. 1>&2
|
89
|
+
type "%ERRMSG%" 1>&2
|
90
|
+
echo ************************************************************** 1>&2
|
91
|
+
exit /b 1
|
92
|
+
) else (
|
93
|
+
echo ************************************************************** >> "%INSTALLLOG%"
|
94
|
+
echo WARNING MESSAGE >> "%INSTALLLOG%"
|
95
|
+
echo Files not copied because it could not read the version from the binary. >> "%INSTALLLOG%"
|
96
|
+
echo There is a possibility that the program does not work properly. >> "%INSTALLLOG%"
|
97
|
+
echo Please check the compatibility of following binaries. >> "%INSTALLLOG%"
|
98
|
+
type "%ERRMSG%" >> "%INSTALLLOG%"
|
99
|
+
echo ************************************************************** >> "%INSTALLLOG%"
|
100
|
+
del "%ERRMSG%"
|
101
|
+
)
|
102
|
+
)
|
103
|
+
EOS
|
104
|
+
}
|
105
|
+
mkfile.puts 'exit /b 0'
|
106
|
+
mkfile.puts 'endlocal'
|
107
|
+
$makefile_created = true
|
108
|
+
ensure
|
109
|
+
source.close
|
110
|
+
mkfile.close
|
111
|
+
mkfile_dummy.close
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding : utf-8
|
2
|
+
=begin =============================================================
|
3
|
+
Copyright (C) 2013 BizStation Corp All rights reserved.
|
4
|
+
|
5
|
+
This program is free software; you can redistribute it and/or
|
6
|
+
modify it under the terms of the GNU General Public License
|
7
|
+
as published by the Free Software Foundation; either version 2
|
8
|
+
of the License, or (at your option) any later version.
|
9
|
+
|
10
|
+
This program is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with this program; if not, write to the Free Software
|
17
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
18
|
+
02111-1307, USA.
|
19
|
+
===================================================================
|
20
|
+
=end
|
21
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'detect.rb'))
|
22
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '../bin', get_binary_path()))
|
@@ -0,0 +1,375 @@
|
|
1
|
+
# coding : utf-8
|
2
|
+
=begin =============================================================
|
3
|
+
Copyright (C) 2013 BizStation Corp All rights reserved.
|
4
|
+
|
5
|
+
This program is free software; you can redistribute it and/or
|
6
|
+
modify it under the terms of the GNU General Public License
|
7
|
+
as published by the Free Software Foundation; either version 2
|
8
|
+
of the License, or (at your option) any later version.
|
9
|
+
|
10
|
+
This program is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with this program; if not, write to the Free Software
|
17
|
+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
18
|
+
02111-1307, USA.
|
19
|
+
===================================================================
|
20
|
+
=end
|
21
|
+
require 'date'
|
22
|
+
require 'transactd'
|
23
|
+
|
24
|
+
TYPE_SCHEMA_BDF = 0
|
25
|
+
|
26
|
+
USE_NORMAL = 0
|
27
|
+
USE_TRANS = 1
|
28
|
+
USE_BALKINS = 2
|
29
|
+
USE_SNAPSHOT = 4
|
30
|
+
|
31
|
+
FN_ID = 0
|
32
|
+
FN_NAME = 1
|
33
|
+
|
34
|
+
AUTO_CREATE_TABLE = true
|
35
|
+
PARALLEL_TRN = 1000
|
36
|
+
LOCK_SINGLE_NOWAIT = 200
|
37
|
+
TRANS_BIAS = PARALLEL_TRN + LOCK_SINGLE_NOWAIT
|
38
|
+
|
39
|
+
BULKBUFSIZE = 65535 - 1000
|
40
|
+
|
41
|
+
## --------------------------------------------------------------------------------
|
42
|
+
def showTableError(tb, description)
|
43
|
+
if (tb.stat() != 0)
|
44
|
+
puts("#{description} error #{tb.tableDef().fileName()}:No.#{tb.stat().to_s}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
## --------------------------------------------------------------------------------
|
49
|
+
def showEnginError(db, tableName)
|
50
|
+
if (db.stat() != 0)
|
51
|
+
puts("#{tableName} error No.#{db.stat().to_s}")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
## --------------------------------------------------------------------------------
|
56
|
+
def openTable(db, tableName, mode)
|
57
|
+
tb = db.openTable(tableName, mode, AUTO_CREATE_TABLE)
|
58
|
+
showEnginError(db, tableName) if (tb == nil)
|
59
|
+
return tb
|
60
|
+
end
|
61
|
+
|
62
|
+
## --------------------------------------------------------------------------------
|
63
|
+
def createDataBase(db, uri)
|
64
|
+
db.create(uri)
|
65
|
+
return (db.stat() == 0)
|
66
|
+
end
|
67
|
+
|
68
|
+
## --------------------------------------------------------------------------------
|
69
|
+
def write(tb, start, endid)
|
70
|
+
tb.setKeyNum(0)
|
71
|
+
for i in start..(endid - 1) do
|
72
|
+
tb.clearBuffer()
|
73
|
+
tb.setFV(FN_ID, i)
|
74
|
+
tb.setFV(FN_NAME, i)
|
75
|
+
tb.insert()
|
76
|
+
if (tb.stat() != 0)
|
77
|
+
showTableError(tb, 'write')
|
78
|
+
return false
|
79
|
+
end
|
80
|
+
end
|
81
|
+
return true
|
82
|
+
end
|
83
|
+
|
84
|
+
## --------------------------------------------------------------------------------
|
85
|
+
def deleteAll(db, tb, start, endid)
|
86
|
+
db.beginTrn(TRANS_BIAS)
|
87
|
+
tb.clearBuffer()
|
88
|
+
for i in start..(endid - 1) do
|
89
|
+
tb.setFV(FN_ID, i)
|
90
|
+
tb.seek()
|
91
|
+
if (tb.stat() == 0)
|
92
|
+
tb.del()
|
93
|
+
if (tb.stat() != 0)
|
94
|
+
showTableError(tb, 'deleteAll')
|
95
|
+
db.endTrn()
|
96
|
+
return false
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
db.endTrn()
|
101
|
+
return true
|
102
|
+
end
|
103
|
+
|
104
|
+
## --------------------------------------------------------------------------------
|
105
|
+
def Inserts(db, tb, start, endid, mode, unit)
|
106
|
+
ret = true
|
107
|
+
total = endid - start
|
108
|
+
count = total / unit
|
109
|
+
st = start
|
110
|
+
en = st
|
111
|
+
while (en != endid) do
|
112
|
+
en = st + unit
|
113
|
+
db.beginTrn(TRANS_BIAS) if (mode == USE_TRANS)
|
114
|
+
tb.beginBulkInsert(BULKBUFSIZE) if (mode == USE_BALKINS)
|
115
|
+
ret = write(tb, st, en)
|
116
|
+
tb.commitBulkInsert() if (mode == USE_BALKINS)
|
117
|
+
db.endTrn() if (mode == USE_TRANS)
|
118
|
+
break if (ret == false)
|
119
|
+
st = en
|
120
|
+
end
|
121
|
+
return ret
|
122
|
+
end
|
123
|
+
|
124
|
+
## --------------------------------------------------------------------------------
|
125
|
+
def Read(db, tb, start, endid, shapshot)
|
126
|
+
ret = true
|
127
|
+
tb.clearBuffer()
|
128
|
+
db.beginSnapshot() if (shapshot == USE_SNAPSHOT)
|
129
|
+
for i in start..(endid - 1) do
|
130
|
+
tb.setFV(FN_ID, i)
|
131
|
+
tb.seek()
|
132
|
+
if ((tb.stat() != 0) || (tb.getFVlng(FN_ID) != i))
|
133
|
+
puts("GetEqual Error stat() = #{tb.stat().to_s} Value #{i.to_s} = #{tb.getFVlng(FN_ID).to_s}")
|
134
|
+
ret = false
|
135
|
+
break
|
136
|
+
end
|
137
|
+
end
|
138
|
+
db.endSnapshot() if (shapshot == USE_SNAPSHOT)
|
139
|
+
return ret
|
140
|
+
end
|
141
|
+
|
142
|
+
## --------------------------------------------------------------------------------
|
143
|
+
def Reads(db, tb, start, endid, unit, shapshot)
|
144
|
+
ret = true
|
145
|
+
total = endid - start
|
146
|
+
count = total / unit
|
147
|
+
st = start
|
148
|
+
en = st
|
149
|
+
db.beginSnapshot() if (shapshot == USE_SNAPSHOT)
|
150
|
+
tb.setKeyNum(0)
|
151
|
+
tb.setFilter('*', 1, 20)
|
152
|
+
tb.clearBuffer()
|
153
|
+
tb.setFV(FN_ID, st)
|
154
|
+
tb.find(Transactd::Table::FindForword)
|
155
|
+
while (en != endid)
|
156
|
+
en = st + unit
|
157
|
+
for i in st..(en - 1) do
|
158
|
+
if (tb.getFVlng(FN_ID) != i)
|
159
|
+
puts("findNext Error stat() = #{tb.stat().to_s} Value #{i.to_s} = #{tb.getFVlng(FN_ID).to_s}")
|
160
|
+
ret = false
|
161
|
+
break
|
162
|
+
end
|
163
|
+
tb.findNext()
|
164
|
+
end
|
165
|
+
break if (ret == false)
|
166
|
+
st = en
|
167
|
+
end
|
168
|
+
db.endSnapshot() if (shapshot == USE_SNAPSHOT)
|
169
|
+
return ret
|
170
|
+
end
|
171
|
+
|
172
|
+
## --------------------------------------------------------------------------------
|
173
|
+
def Updates(db, tb, start, endid, tran, unit)
|
174
|
+
ret = true
|
175
|
+
tb.setKeyNum(0)
|
176
|
+
total = endid - start
|
177
|
+
count = total / unit
|
178
|
+
st = start
|
179
|
+
en = st
|
180
|
+
while (en != endid)
|
181
|
+
en = st + unit
|
182
|
+
db.beginTrn(TRANS_BIAS) if (tran == USE_TRANS)
|
183
|
+
for i in st..(en - 1) do
|
184
|
+
tb.setFV(FN_ID, i)
|
185
|
+
tb.setFV(FN_NAME, "#{i + 1 + tran}")
|
186
|
+
tb.update(Transactd::Table::ChangeInKey)
|
187
|
+
if (tb.stat() != 0)
|
188
|
+
ret = false
|
189
|
+
break
|
190
|
+
end
|
191
|
+
end
|
192
|
+
db.endTrn() if (tran == USE_TRANS)
|
193
|
+
break if (ret == false)
|
194
|
+
st = en
|
195
|
+
end
|
196
|
+
return ret
|
197
|
+
end
|
198
|
+
|
199
|
+
## --------------------------------------------------------------------------------
|
200
|
+
def createTestDataBase(db, uri)
|
201
|
+
db.create(uri)
|
202
|
+
if (db.stat() != 0)
|
203
|
+
puts("createTestDataBase erorr:No.#{db.stat().to_s} #{uri}")
|
204
|
+
return false
|
205
|
+
end
|
206
|
+
if (db.open(uri, TYPE_SCHEMA_BDF, Transactd::TD_OPEN_NORMAL, '', ''))
|
207
|
+
dbdef = db.dbDef()
|
208
|
+
td = Transactd::Tabledef.new()
|
209
|
+
td.setTableName('user')
|
210
|
+
td.setFileName('user.dat')
|
211
|
+
td.id = 1
|
212
|
+
# td.primaryKeyNum = -1
|
213
|
+
# td.parentKeyNum = -1
|
214
|
+
# td.replicaKeyNum = -1
|
215
|
+
td.pageSize = 2048
|
216
|
+
dbdef.insertTable(td)
|
217
|
+
|
218
|
+
fd = dbdef.insertField(td.id, 0)
|
219
|
+
fd.setName('id')
|
220
|
+
fd.type = Transactd::Ft_integer
|
221
|
+
fd.len = 4
|
222
|
+
dbdef.updateTableDef(1)
|
223
|
+
|
224
|
+
fd = dbdef.insertField(td.id, 1)
|
225
|
+
fd.setName('name')
|
226
|
+
fd.type = Transactd::Ft_myvarchar
|
227
|
+
fd.len = 100
|
228
|
+
dbdef.updateTableDef(td.id)
|
229
|
+
|
230
|
+
kd = dbdef.insertKey(td.id, 0)
|
231
|
+
kd.segment(0).fieldNum = 0
|
232
|
+
kd.segment(0).flags.bit8 = 1 # extend key type
|
233
|
+
kd.segment(0).flags.bit1 = 1 # changeable
|
234
|
+
kd.segmentCount = 1
|
235
|
+
|
236
|
+
td.primaryKeyNum = 0
|
237
|
+
dbdef.updateTableDef(td.id)
|
238
|
+
return true
|
239
|
+
else
|
240
|
+
puts("open daatabse erorr No:#{db.stat().to_s}")
|
241
|
+
end
|
242
|
+
return false
|
243
|
+
end
|
244
|
+
|
245
|
+
## --------------------------------------------------------------------------------
|
246
|
+
def printDateTime()
|
247
|
+
puts(DateTime.now.strftime('%Y/%m/%d %H:%M:%S'))
|
248
|
+
end
|
249
|
+
|
250
|
+
## --------------------------------------------------------------------------------
|
251
|
+
def printHeader(uri, count)
|
252
|
+
puts("Start Bench mark Insert Items = #{count.to_s}")
|
253
|
+
printDateTime()
|
254
|
+
puts(uri)
|
255
|
+
puts("----------------------------------------")
|
256
|
+
end
|
257
|
+
|
258
|
+
## --------------------------------------------------------------------------------
|
259
|
+
def printTail()
|
260
|
+
puts("----------------------------------------")
|
261
|
+
end
|
262
|
+
|
263
|
+
## --------------------------------------------------------------------------------
|
264
|
+
def main(argv)
|
265
|
+
if (argv.length < 4)
|
266
|
+
puts("usage: ruby bench_tdclcpp.rb databaseUri processNumber functionNumber noDeleteFlag")
|
267
|
+
puts("\t --- functionNumber list ---")
|
268
|
+
puts("\t-1: all function")
|
269
|
+
puts("\t 0: Insert")
|
270
|
+
puts("\t 1: Insert in transaction. 20rec x 1000times")
|
271
|
+
puts("\t 2: Insert by bulkmode. 20rec x 1000times")
|
272
|
+
puts("\t 3: read each record")
|
273
|
+
puts("\t 4: read each record with snapshot")
|
274
|
+
puts("\t 5: read range. 20rec x 1000times")
|
275
|
+
puts("\t 6: read range with snapshpot. 20rec x 1000times")
|
276
|
+
puts("\t 7: update")
|
277
|
+
puts("\t 8: update in transaction. 20rec x 1000times")
|
278
|
+
puts("example : ruby bench_tdclcpp.rb \"tdap://localhost/test?dbfile=test.bdf\" 0 -1 1")
|
279
|
+
return
|
280
|
+
end
|
281
|
+
uri = argv[1] # "tdap://localhost/test?dbfile=test.bdf"
|
282
|
+
procID = Integer(argv[2]) # 0
|
283
|
+
count = 20000
|
284
|
+
start = procID * count + 1
|
285
|
+
endid = start + count
|
286
|
+
exeType = Integer(argv[3]) # -1
|
287
|
+
insertBeforeNoDelete = ((argv.length > 4) && (Integer(argv[4]) != 0))
|
288
|
+
|
289
|
+
db = Transactd::Database.createObject()
|
290
|
+
if (db.open(uri, TYPE_SCHEMA_BDF, Transactd::TD_OPEN_NORMAL, '', '') == false)
|
291
|
+
if (!createTestDataBase(db, uri))
|
292
|
+
db.close()
|
293
|
+
return
|
294
|
+
end
|
295
|
+
puts("CreateDataBase success.")
|
296
|
+
end
|
297
|
+
printHeader(uri, count)
|
298
|
+
|
299
|
+
if (!db.open(uri, TYPE_SCHEMA_BDF, Transactd::TD_OPEN_NORMAL, '', ''))
|
300
|
+
puts("open table erorr No:#{db.stat().to_s}")
|
301
|
+
else
|
302
|
+
tb = openTable(db, 'user', Transactd::TD_OPEN_NORMAL)
|
303
|
+
if tb == nil
|
304
|
+
puts "can not open table 'user'"
|
305
|
+
db.close()
|
306
|
+
return
|
307
|
+
end
|
308
|
+
|
309
|
+
if ((exeType == -1) || (exeType == 0))
|
310
|
+
if (insertBeforeNoDelete || deleteAll(db, tb, start, endid))
|
311
|
+
Transactd::Benchmark::start()
|
312
|
+
succeed = Inserts(db, tb, start, endid, USE_NORMAL, 1)
|
313
|
+
Transactd::Benchmark::showTimeSec(succeed, ': Insert')
|
314
|
+
else
|
315
|
+
puts("deleteAll erorr No:#{tb.stat().to_s}")
|
316
|
+
end
|
317
|
+
end
|
318
|
+
if ((exeType == -1) || (exeType == 1))
|
319
|
+
if (insertBeforeNoDelete || deleteAll(db, tb, start, endid))
|
320
|
+
Transactd::Benchmark::start()
|
321
|
+
succeed = Inserts(db, tb, start, endid, USE_TRANS, 20)
|
322
|
+
Transactd::Benchmark::showTimeSec(succeed, ': Insert in transaction. 20rec x 1000times.')
|
323
|
+
else
|
324
|
+
puts("deleteAll erorr No:#{tb.stat().to_s}")
|
325
|
+
end
|
326
|
+
end
|
327
|
+
if ((exeType == -1) || (exeType == 2))
|
328
|
+
if (insertBeforeNoDelete || deleteAll(db, tb, start, endid))
|
329
|
+
Transactd::Benchmark::start()
|
330
|
+
succeed = Inserts(db, tb, start, endid, USE_BALKINS, 20)
|
331
|
+
Transactd::Benchmark::showTimeSec(succeed, ': Insert by bulkmode. 20rec x 1000times.')
|
332
|
+
else
|
333
|
+
puts("deleteAll erorr No:#{tb.stat().to_s}")
|
334
|
+
end
|
335
|
+
end
|
336
|
+
if ((exeType == -1) || (exeType == 3))
|
337
|
+
Transactd::Benchmark::start()
|
338
|
+
succeed = Read(db, tb, start, endid, USE_NORMAL)
|
339
|
+
Transactd::Benchmark::showTimeSec(succeed, 'read each record.')
|
340
|
+
end
|
341
|
+
if ((exeType == -1) || (exeType == 4))
|
342
|
+
Transactd::Benchmark::start()
|
343
|
+
succeed = Read(db, tb, start, endid, USE_SNAPSHOT)
|
344
|
+
Transactd::Benchmark::showTimeSec(succeed, ': read each record with snapshot.')
|
345
|
+
end
|
346
|
+
if ((exeType == -1) || (exeType == 5))
|
347
|
+
Transactd::Benchmark::start()
|
348
|
+
succeed = Reads(db, tb, start, endid, 20, USE_NORMAL)
|
349
|
+
Transactd::Benchmark::showTimeSec(succeed, ': read range. 20rec x 1000times.')
|
350
|
+
end
|
351
|
+
if ((exeType == -1) || (exeType == 6))
|
352
|
+
Transactd::Benchmark::start()
|
353
|
+
succeed = Reads(db, tb, start, endid, 20, USE_SNAPSHOT)
|
354
|
+
Transactd::Benchmark::showTimeSec(succeed, ': read range with snapshpot. 20rec x 1000times.')
|
355
|
+
end
|
356
|
+
if ((exeType == -1) || (exeType == 7))
|
357
|
+
Transactd::Benchmark::start()
|
358
|
+
succeed = Updates(db, tb, start, endid, USE_NORMAL, 1)
|
359
|
+
Transactd::Benchmark::showTimeSec(succeed, ': update.')
|
360
|
+
end
|
361
|
+
if ((exeType == -1) || (exeType == 8))
|
362
|
+
Transactd::Benchmark::start()
|
363
|
+
succeed = Updates(db, tb, start, endid, USE_TRANS, 20)
|
364
|
+
Transactd::Benchmark::showTimeSec(succeed, ': update in transaction. 20rec x 1000times.')
|
365
|
+
end
|
366
|
+
end
|
367
|
+
tb.close()
|
368
|
+
db.close()
|
369
|
+
printTail()
|
370
|
+
return
|
371
|
+
end
|
372
|
+
|
373
|
+
args = ARGV
|
374
|
+
args.unshift(__FILE__)
|
375
|
+
main(args)
|