Skip to content

Commit 3047b17

Browse files
committed
Add support for MySQL databases
1 parent ec0cd12 commit 3047b17

File tree

12 files changed

+101
-15
lines changed

12 files changed

+101
-15
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,8 @@ Jun 2018 (v4.2.0)
8080

8181
Jul 2018 (v4.3.0)
8282
* Add command for converting VBS dataset to USS on z/OS
83+
84+
Oct 2018 (v5.0.0)
85+
* Add instructions for MySQL importing
86+
* (Breaking) Modify a few column names for MySQL compatibility
87+
* Update for MQ V9.1.1

bin/aix/convH

0 Bytes
Binary file not shown.

bin/aix/mqsmfcsv

131 KB
Binary file not shown.

bin/linux/convH

0 Bytes
Binary file not shown.

bin/linux/mqsmfcsv

0 Bytes
Binary file not shown.

bin/win/mqsmfcsv.exe

100755100644
512 Bytes
Binary file not shown.

mqsmfcsv.doc

2 KB
Binary file not shown.

src/printQMST.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ void printQMST(qmst *p)
1919
{
2020
SMFPRINTSTART("QMST", p, conv16(p->qmstll));
2121

22-
ADDS32("Open",p->qmstopen);
23-
ADDS32("Close",p->qmstclos);
24-
ADDS32("Get ",p->qmstget );
25-
ADDS32("Put" ,p->qmstput );
26-
ADDS32("Put1",p->qmstput1);
27-
ADDS32("Inq ",p->qmstinq );
22+
ADDS32("MQOpen",p->qmstopen);
23+
ADDS32("MQClose",p->qmstclos);
24+
ADDS32("MQGet ",p->qmstget );
25+
ADDS32("MQPut" ,p->qmstput );
26+
ADDS32("MQPut1",p->qmstput1);
27+
ADDS32("MQInq ",p->qmstinq );
2828
ADDS32("Inql",p->qmstinql);
29-
ADDS32("Set ",p->qmstset );
29+
ADDS32("MQSet ",p->qmstset );
3030
ADDS32("Endw",p->qmstendw);
3131
ADDS32("Close_Handles",p->qmstcalh);
3232
if (conv16(p->qmstll) > offsetof(qmst, qmstsub))/* Fields added for V7.0 API calls*/
3333
{
34-
ADDS32("Sub" ,p->qmstsub);
35-
ADDS32("SubReq",p->qmstsubr);
36-
ADDS32("CB " ,p->qmstcb);
37-
ADDS32("CTL " ,p->qmstctl);
38-
ADDS32("Status",p->qmststus);
34+
ADDS32("MQSub" ,p->qmstsub);
35+
ADDS32("MQSubReq",p->qmstsubr);
36+
ADDS32("MQCB " ,p->qmstcb);
37+
ADDS32("MQCTL " ,p->qmstctl);
38+
ADDS32("MQStatus",p->qmststus);
3939
ADDS32("Pubs" ,p->qmstpubs);
4040
}
4141
#if CSQDSMF_VERSION >= 903

src/printWQ.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ void printWQ(wq *p)
4646
/*--------------------------------------------------------*/
4747
/* Object information */
4848
/*--------------------------------------------------------*/
49-
ADDSTR("Type" ,strMQQT(conv32(p->qtype)),16);
50-
ADDSTR("Index",strMQIT(conv32(p->indxtype)),16);
49+
ADDSTR("QueueType" ,strMQQT(conv32(p->qtype)),16);
50+
ADDSTR("IndexType",strMQIT(conv32(p->indxtype)),16);
5151
ADDSTR("Scope",strMQQSGD(conv32(p->qsgdisp)),16);
5252

5353
/*--------------------------------------------------------*/

src/smfDDL.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void closeDDL(char *name)
111111
{
112112
char *c = indexSet[i];
113113
if (c) {
114-
fprintf(fp,"CREATE INDEX %s.%s_%s ON %s.%s(%s);\n",schema,name,c,schema,name,c);
114+
fprintf(fp,"CREATE INDEX %s_%s ON %s.%s(%s);\n",name,c,schema,name,c);
115115
}
116116
}
117117
fprintf(fp,"\n");

testing/load-db2.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This script is an example of how to populate a Db2 database
2+
#
3+
# You will need to modify variables such as where the formatted csv files
4+
# have been created, and which database/schema to work with.
5+
6+
# Where are the output files
7+
cd /tmp/smf/out
8+
chmod a+rx .
9+
10+
# Set up the environment for the db2 command
11+
. /home/db2inst3/sqllib/db2profile
12+
export LIBPATH=/opt/freeware/lib64:/opt/freeware/lib:$LIBPATH
13+
export PATH=$PATH:.
14+
15+
dbName="metdb"
16+
schema="MQSMF"
17+
18+
# Connect
19+
db2 -x connect to $dbName >/dev/null 2>&1
20+
if [ $? -ne 0 ]
21+
then
22+
echo "Connection to DB2 $dbName failed"
23+
exit 1
24+
else
25+
echo "Connected to $dbName"
26+
fi
27+
28+
# Run the DDL to create the tables
29+
db2 -tf SMF-MQTABLES.ddl
30+
31+
32+
# And import all the data files
33+
for x in *csv
34+
do
35+
b=`basename $x .csv`
36+
f=`echo $b | sed "s/SMF-//g"`
37+
38+
echo Loading from $b into $f
39+
chmod a+r $x
40+
db2 load client from $x of del insert into $schema.$f
41+
done

testing/load-mysql.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This script is an example of how to populate a MySQL database
2+
#
3+
# You will need to modify variables such as where the formatted csv files
4+
# have been created, and which database/schema to work with.
5+
6+
# Set credentials
7+
user="root"
8+
pw="Passw0rd!"
9+
10+
# Where are the output files
11+
cd /tmp/smf/out
12+
13+
# Which database/schema to work with
14+
schema="MQSMF"
15+
16+
# Use the "force" option to make the command continue even if
17+
# there are errors. Will be common to have the DROP TABLE fail for
18+
# a new database.
19+
20+
# Run the DDL to create the tables
21+
mysql -u $user --password=$pw --force < SMF-MQTABLES.ddl
22+
23+
# And import all the data files
24+
for x in *csv
25+
do
26+
b=`basename $x .csv`
27+
f=`echo $b | sed "s/SMF-//g"`
28+
29+
echo Loading from $b into $f
30+
31+
mysql -u $user --password=$pw --local-infile=1 --force << EOF
32+
USE $schema;
33+
34+
load data local infile '$x' into table $f
35+
fields terminated by ','
36+
enclosed by '"'
37+
lines terminated by '\n';
38+
39+
EOF
40+
done

0 commit comments

Comments
 (0)