Transactd Utilities guide
This document consists of the how to use the utilities.
Installation, please refer to the installation of Transactd Utilities.
Index
- Transactd High Availability (THA) manager
- Details of the benchmark program
- C++ O/R mapping source code generator
- Query executer
Transactd High Availability (THA) manager
How to use Transactd High Availability (THA), please see haMgr reference (Japanese). For Details of how THA works, please see High Availability (THA) (Japanese).
Details of the benchmark program
There are two types in the benchmark program. One of them is the benchmark which read SQL-like query (bench_query_xxx). Another is basic CRUD operations benchmark (bench_tdclcpp_c_xxx).
bench_tdclcpp_xxx can be executed in multiple instances, by changing the processNumber in command line arguments.
The command line options are:
bench_tdclcpp_c_xxx.exe databaseUri processNumber functionNumber
|----------------|--------------------------------------------------------|
| option name | description |
|----------------|--------------------------------------------------------|
| databaseUri | URI of a database. |
|----------------|--------------------------------------------------------|
| processNumber | Specify different number to run two or more instances. |
|----------------|--------------------------------------------------------|
| functionNumber | Specify the operation number. |
| | The operations: |
| | -1: all of following |
| | 0: Insert |
| | 1: Insert in transaction. 20rec x 1000times |
| | 2: Insert by bulkmode. 20rec x 1000times |
| | 3: read each record |
| | 4: read each record with snapshot |
| | 5: read range. 20rec x 1000times |
| | 6: read range with snapshot . 20rec x 1000times |
| | 7: update |
| | 8: update in transaction. 20rec x 1000times |
|----------------|--------------------------------------------------------|
ex)
bench_tdclcpp_c_vc140_64u.exe "tdap://localhost/test?dbfile=test.bdf" 0 -1
bench_query_xxx measures the speed of getting a similar result with the following SQL:
select
`user`.`id`
,`user`.`name`
,`extention`.`comment`
,`groups`.`name` as `group_name`
from
`user` INNER JOIN `extention`
ON `user`.`id` = `extention`.`id`
LEFT JOIN `groups`
ON `user`.`group` = `groups`.`code`
where
`user`.`id` > 0 and `user`.`id` <= 15000;
The command line options are:
bench_query_xxx createdb hostname type n
|----------------|--------------------------------------------------------|
| option name | description |
|----------------|--------------------------------------------------------|
| createdb | Specify 0 or 1 to determine whether or not to create a |
| | new test database. The default is 1. |
|----------------|--------------------------------------------------------|
| hostname | Specify the name or IP address of the location database|
| | .The default is localhost. |
|----------------|--------------------------------------------------------|
| type | Specific numbers, the contents of the query. |
| | The default is 15. |
| | 1: Read 15,000 records from the user table |
| | 3: JOIN the comment field of the extention table on the|
| | results of the 1 |
| | 7: JOIN the name of the table groups the results of the|
| | 3 |
| | 5: JOIN the name of the groups on the results of the 1 |
| |+8: Display the execution progress of repeat |
|----------------|--------------------------------------------------------|
| n | Specifies the number of executions of the query |
| | specified by type. The default is 100. |
|----------------|--------------------------------------------------------|
ex)
bench_query_vc140_64u 0 localhost 15 100
C++ O/R mapping source code generator
ormsrcgen (32|64) is a source code generator for C++ O/R mapping.
C++ does not allow to define classes dynamically. So we need to generate model classes with the source code generator. You can use O/R mapping fast and easy in C++ with it.
Files
Related files of the generator is in source/global/ormsrcgen/template
.
The descriptions of each files are:
- ormDataClass_template.cpp : Template of C ++ model class.
- ormDataClass_template.h : Template of C ++ model class.
- ormMapClass_template.cpp : Template of C ++ map class.
- ormMapClass_template.h : Template of C ++ map class.
- template.cnf : Template of the configuration file
- fieldNameList_sample.txt : Sample file of field name alias.
Edit fieldNameList_sample.txt
and template.cnf
as needed.
Command-line options
Command line options are:
command line option:
-d [ --database_uri ] database uri ex:tdap://hostname/dbname?dbfile=trnasctd_schema
-t [ --table_name ] table name.
-c [ --class_name ] class name.
-f [ --conf_name ] configuration file.
-d :Specify the database URI.
-t :Specify the table name to generate the model class.
The class is generated for each table.
-c :Specify the name of the model class.
-f :Specify the path of configuration file.
In many cases, you can use same configuration file even if tables are different.
Template of configuration file is source/global/ormsrcgen/template/template.cnf
.
You can copy and edit it.
Descriptions of the configuration file
lang = (language)
Specify the language of the code to be generated. Only
C++
is supported in current version.files = (number of file)
Specify the number of template files required for a model. In the case of C++, the number is
2
.file1 = (file path) file2 = (file path) ... fileN = (file path)
Specify the path of the template file, with the number that was specified in
files=
. Default values arefile1 = ormDataClass_template
file2 = ormMapClass_template
, but please specify the absolute path in actually.saveDir = (output dir)
Specify the output directory to save generated source code files.
setPrefix = (setter prefix)
Specify the prefix of the setter method of member variables in the class. If
setPrefix = set
is specified, the setter function forname
field is:setName(const char* v)
getPrefix = (getter prefix)
Specify the prefix of the getter method as well as setPrefix.
externWord = (extern keyword)
Add export keyword in class declaration when make shared libraries such as
.SO
or.DLL
.class $externWord someModel { ... };
fieldRenameList = (alias list file)
Normally, the member variable name of the class is same as the name of field in the table. If you want to change the name, specify fieldRenameList which contains alias list. The fieldRenameList format is:
originalName1=alias1 originalName2=alias2
name_space = (namespace of model class)
Specify the namespace of the model class.
name_space_map = (namespace of map class)
Specify the namespace of the map class. The map class maps the members of the model class and the fields in the table.
Query executer
querystmts is a program that execute the Transactd query that has been described in XML file. If you pass an XML file to querystmts, it executes the queries and outputs the result to the stdout.
To make Transactd query XML file(s), we need the querybuilder program. But querybuilder has not been released yet. It will be released soon.
6. Bug reporting, requests and questions
- If you find any bugs or if you have any requests, please send it to Issues tracker on github. It requires github account(free).
- If you have any questions, please see our website or send to Issues tracker on github above.