Skip to content

Commit ec9a510

Browse files
committed
More MySQL mods to not break DB2 compatibility
1 parent c2dc031 commit ec9a510

File tree

8 files changed

+13
-7
lines changed

8 files changed

+13
-7
lines changed

CHANGES.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,5 @@ Jun 2018 (v4.2.0)
8181
Jul 2018 (v4.3.0)
8282
* Add command for converting VBS dataset to USS on z/OS
8383

84-
Oct 2018 (v5.0.0)
85-
* Add instructions for MySQL importing
86-
* Update for MQ V9.1.1
84+
Sep 2018 (v5.0.0)
85+
* Add support for MySQL imports

bin/aix/convH

0 Bytes
Binary file not shown.

bin/aix/mqsmfcsv

-132 KB
Binary file not shown.

bin/linux/mqsmfcsv

24 Bytes
Binary file not shown.

bin/win/mqsmfcsv.exe

0 Bytes
Binary file not shown.

src/mqsmf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ BOOL streamInput = TRUE;
121121
char *ddlTemplateOpen = NULL;
122122
char *ddlTemplateClose = NULL;
123123
char *ddlQuote = "";
124+
BOOL ddlFold = FALSE;
124125
commonFields_t commonF = {0};
125126
enum outputFormat_e outputFormat = OF_CSV;
126127
FILE *infoStream;
@@ -258,8 +259,10 @@ int main( int argc, char *argv[] )
258259
if (!strcmp(mqoptarg,"MYSQL")) {
259260
ddlQuote="`";
260261
ddlTemplateOpen = "-";
262+
ddlFold = TRUE;
261263
} else if (!strcmp(mqoptarg,"DB2")) {
262264
ddlQuote="";
265+
ddlFold = FALSE;
263266
} else {
264267
error = TRUE;
265268
}

src/mqsmf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ extern FILE *infoStream;
440440
extern char *ddlTemplateOpen;
441441
extern char *ddlTemplateClose;
442442
extern char *ddlQuote;
443+
extern BOOL ddlFold;
443444

444445
enum outputFormat_e { OF_CSV=0, OF_SQL=1, OF_JSON=2 };
445446
extern enum outputFormat_e outputFormat;

src/smfDDL.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,19 @@ void printDDL(char *name, int type, int len)
191191
case DDL_SUS: /* a seconds/microseconds field */
192192
p = strstr(nameCopy,"(US)");
193193
if (p) *p = 0;
194-
fprintf(fp,"%s %s%s_us%s \t BIGINT\n",comma,ddlQuote,formatDDL(nameCopy),ddlQuote);
194+
fprintf(fp,"%s %s%s_%s%s \t BIGINT\n",comma,ddlQuote,formatDDL(nameCopy),ddlFold?"US":"us",ddlQuote);
195195
break;
196196

197197
case DDL_DATE:
198198
p = strstr(nameCopy," (DATE)");
199199
if (p) *p = 0; /* remove the "(DATE)" bit */
200-
fprintf(fp,"%s %s%s_Date%s \t DATE\n",comma,ddlQuote,formatDDL(nameCopy),ddlQuote);
200+
fprintf(fp,"%s %s%s_%s%s \t DATE\n",comma,ddlQuote,formatDDL(nameCopy),ddlFold?"DATE":"Date",ddlQuote);
201201
break;
202202
case DDL_TIME:
203203
p = strstr(nameCopy," (TIME)");
204204
if (p)
205205
*p = 0;
206-
fprintf(fp,"%s %s%s_Time%s \t CHAR(19)\n",comma,ddlQuote,formatDDL(nameCopy),ddlQuote);
206+
fprintf(fp,"%s %s%s_%s%s \t CHAR(19)\n",comma,ddlQuote,formatDDL(nameCopy),ddlFold?"TIME":"Time",ddlQuote);
207207
break;
208208
}
209209

@@ -252,7 +252,10 @@ char *formatDDLMaxLength(char *name,int maxLength)
252252
/* Get rid of repeated '_' characters */
253253
if (c != prev || prev != '_')
254254
{
255-
*o = c;
255+
if (ddlFold)
256+
*o = toupper(c);
257+
else
258+
*o = c;
256259
o++;
257260
}
258261
i++;

0 commit comments

Comments
 (0)