Skip to content

Commit dc550f9

Browse files
committed
Visual Studio 2017 compiler tested
Add more desirable indices for SQL
1 parent d9420d9 commit dc550f9

File tree

15 files changed

+55
-9
lines changed

15 files changed

+55
-9
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,7 @@ as appropriate
7373

7474
May 2018 (v4.1.0)
7575
* Ability to add SQL/DDL commands to generated DDL file from templates.
76+
77+
Jun 2018 (v4.2.0)
78+
* Visual Studio 2017 compiler warnings fixed
79+
* -f sql was not setting correct internal flags

bin/aix/convH

41 Bytes
Binary file not shown.

bin/aix/mqsmfcsv

2.82 KB
Binary file not shown.

bin/linux/convH

-48 Bytes
Binary file not shown.

bin/linux/mqsmfcsv

-44 Bytes
Binary file not shown.

bin/win/mqsmfcsv.exe

77 KB
Binary file not shown.

src/m2017.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rem This sets the environment for Visual Studio 2017
2+
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build"\vcvarsall x86_amd64

src/mqsmf.c

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ void takeCheckPoint(char *,myoff_t);
105105
myoff_t readCheckPoint(FILE *);
106106
static char *getFormatRate(myoff_t pos);
107107
static char *getFormatPercent(myoff_t totalFileSize,myoff_t pos);
108+
static BOOL inconsistentVersions(char *v1,char *v2,int l);
108109

109110
#define DEFAULT_TICKER 10000 /* Print out status every N records */
110111

@@ -185,6 +186,7 @@ int main( int argc, char *argv[] )
185186
unsigned int d[3]; /* used in date conversion */
186187
unsigned int ddd,year; /* day number and year number */
187188
unsigned int smfTime; /* Copied from the SMF header */
189+
char savedMqVer[3] = {0};
188190

189191
char *inputFile = NULL;
190192
FILE *fp;
@@ -208,6 +210,7 @@ int main( int argc, char *argv[] )
208210

209211
BOOL error = FALSE;
210212
BOOL knownSubType = TRUE;
213+
BOOL formatWarning = FALSE;
211214
int c;
212215

213216
int sectionCount;
@@ -229,7 +232,7 @@ int main( int argc, char *argv[] )
229232
fprintf(stderr,"Data type sizes do not match requirements.\n");
230233
fprintf(stderr,"Need to rebuild program with correct options.\n");
231234
fprintf(stderr,"Here: short=%d int=%d long=%d long long=%d bytes\n",
232-
sizeof(short), sizeof(int), sizeof(long), sizeof(long long));
235+
(int)sizeof(short), (int)sizeof(int), (int)sizeof(long), (int)sizeof(long long));
233236
fprintf(stderr,"Need: short=%d int=%d long=%d long long=%d bytes\n",2,4,4,8);
234237
exit(1);
235238
}
@@ -267,9 +270,11 @@ int main( int argc, char *argv[] )
267270
useRDW = TRUE;
268271
if (strstr(mqoptarg,"JSON"))
269272
outputFormat = OF_JSON;
270-
else if (strstr(mqoptarg,"SQL"))
273+
else if (strstr(mqoptarg,"SQL")) {
271274
outputFormat = OF_SQL;
272-
else if (strstr(mqoptarg,"CSV"))
275+
printHeaders = FALSE;
276+
addEquals=0;
277+
} else if (strstr(mqoptarg,"CSV"))
273278
outputFormat = OF_CSV;
274279
break;
275280
case 'h':
@@ -530,6 +535,7 @@ int main( int argc, char *argv[] )
530535
memcpy(commonF.systemId,convStr(pSMFRecord->Header.SMFRECSID,4),4);
531536
memcpy(commonF.mqVer,convStr(pSMFRecord->Header.SMFRECREL,3),3);
532537

538+
533539
/*********************************************************************/
534540
/* The SMF header contains a date formatted as 0x0cyydddF The "ddd" */
535541
/* is the day-of-the-year (1-365). Extract the digits and convert */
@@ -601,6 +607,13 @@ int main( int argc, char *argv[] )
601607

602608
if (recordType == 116 || recordType == 115)
603609
{
610+
if (savedMqVer[0] == 0)
611+
memcpy(savedMqVer,commonF.mqVer,3);
612+
613+
if (inconsistentVersions(commonF.mqVer,savedMqVer,3)) {
614+
fprintf(stderr,"Warning: Data contains records from multiple versions of MQ - %3.3s and %3.3s\n",commonF.mqVer,savedMqVer);
615+
}
616+
604617
/*******************************************************************/
605618
/* The first triplet past the standard header usually points at a */
606619
/* QWHS structure. */
@@ -959,7 +972,7 @@ int main( int argc, char *argv[] )
959972

960973
default:
961974
knownSubType = FALSE;
962-
sprintf(tmpHead, "Unknown subtype %d for 116 records");
975+
sprintf(tmpHead, "Unknown subtype %d for 116 records",recordSubType);
963976
printDEBUG(tmpHead, dataBuf,offset);
964977
fprintf(infoStream,"%s\n",tmpHead);
965978
break;
@@ -978,6 +991,10 @@ int main( int argc, char *argv[] )
978991
sprintf(tmpHead,"Unknown SMF record type %d at record %u",recordType,totalRecords);
979992
printDEBUG(tmpHead, dataBuf,offset);
980993
fprintf(infoStream,"%s\n",tmpHead);
994+
if (offset > 32768 && !formatWarning) {
995+
fprintf(infoStream,"WARNING: Possible incorrect input format. Check use of RDW/NORDW flag.\n");
996+
formatWarning = TRUE;
997+
}
981998
}
982999

9831000
if (totalRecords % ticker == 0 && totalRecords > startingRecords)
@@ -1365,3 +1382,23 @@ static char *getFormatPercent(myoff_t totalFileSize,myoff_t pos)
13651382
}
13661383
return formatPercentString;
13671384
}
1385+
1386+
/*****************************************************************/
1387+
/* FUNCTION: inconsistentVersions */
1388+
/* PURPOSE: */
1389+
/* There may be times where the MQ versions in the data would */
1390+
/* cause problems with missing header or columns (eg fields */
1391+
/* put into a later version, when we have already printed the */
1392+
/* headers for an older version). So this test will be able */
1393+
/* to look for that. */
1394+
/* */
1395+
/* But for now, always return FALSE. */
1396+
/*****************************************************************/
1397+
static BOOL inconsistentVersions(char *v1,char *v2,int l)
1398+
{
1399+
BOOL rc = FALSE;
1400+
if (memcmp(v1,v2,l) != 0) /* Maybe need to do more about specific version comparisons */
1401+
rc= TRUE;
1402+
return FALSE;
1403+
}
1404+

src/printQCST.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void printQCST(qcst *p)
5757
ADDU32 ("Net_Time_Min" ,p->qcstntmn);
5858
ADDU32 ("Net_Time_Max" ,p->qcstntmx);
5959
ADDTIME ("Net_Time_Max_Date",p->qcstntdt);
60-
ADDSTREN("Remote_QMgr" ,p->qcstrqmn,48);
60+
ADDSTREN("Remote_QMgr_Or_App" ,p->qcstrqmn,48);
6161
ADDSTRB ("SSL_Peer_Serial",p->qcstslsn,8);
6262
ADDSTREN("SSL_CERTI" ,p->qcstslcn,16);
6363
ADDX32 ("SSL_CipherSuite" ,p->qcstslcs);

src/printWQ.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void printWQ(wq *p)
3636
SMFPRINTSTART("WQ", p, conv16(p->wqll));
3737

3838
ADDSTRB ("Correlation" ,p->correl, 16);
39+
ADDINDEX("Correlation");
3940
ADDSTREN("Open_Name",p->objname,48);
4041
ADDSTREN("Base_Name",p->basename,48);
4142
ADDINDEX("Base_Name");

src/printWTAS.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void printWTAS(wtas *p)
3232

3333
ADDS32 ("Record_Version" , p->wtasver);
3434
ADDSTRB("Correl", (char *)&p->wtasstrt,16);
35+
ADDINDEX("Correl");
3536
ADDTIME("Start_Time", p->wtasstrt);
3637
ADDS32 ("Block_Count", p->wtaswqct);
3738

src/printWTID.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ void printWTID(wtid *p, unsigned char *correlid)
1919
SMFPRINTSTART("WTID", p, conv16(p->wtidlen));
2020

2121
ADDSTRB ("WTAS_Correlator",correlid,16);
22+
ADDINDEX("WTAS_Correlator");
2223
ADDSTR ("Appl_Type", strConnType(conv32(p->wtidatyp)),16);
2324
ADDSTREN("Connection_Name", p->wtidccn, 8);
2425
ADDSTREN("Operator_ID", p->wtidopid,8);

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 ON %s.%s(%s);\n",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");

src/smfJson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static void jsonAddLine(columnHeader_t *h ,int type, const char *fmt,...)
205205
if (offset > (jsonOutputSize * 90 /100)) {
206206
jsonOutputSize = jsonOutputSize*2;
207207
if (debugLevel > 0)
208-
fprintf(infoStream,"Resizing JSON output buffer to %d\n",jsonOutputSize);
208+
fprintf(infoStream,"Resizing JSON output buffer to %ld\n",(long)jsonOutputSize);
209209
jsonOutputStart = realloc(jsonOutputStart,jsonOutputSize);
210210
jsonPtr = jsonOutputStart + offset;
211211
}

src/smfPrint.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void smfAddData(int datatype,char *fmt,...)
136136
jsonAddString(h,c,l);
137137
break;
138138
default:
139-
fprintf(stderr,"Found unknown datatype %d for \"%s\"\n",datatype,h);
139+
fprintf(stderr,"Found unknown datatype %d for \"%s\"\n",datatype,h->name);
140140
break;
141141
}
142142
columnCount++;
@@ -241,7 +241,7 @@ FILE *smfPrintStart(FILE *fp, char *name, void *p, size_t l, BOOL *f, BOOL *newF
241241
return fpNew;
242242
}
243243

244-
void smfPrintStop(FILE *fp, BOOL newFile, BOOL *first,columnHeader_t **h)
244+
void smfPrintStop(FILE *fp, BOOL newFile, BOOL *first, columnHeader_t **h)
245245
{
246246
int i;
247247
if (*first && newFile && printHeaders && outputFormat != OF_JSON)

0 commit comments

Comments
 (0)