Skip to content

Commit 12a5e8e

Browse files
bhvkshahbsharifi
authored andcommitted
More security improvements.
1 parent 0f92b52 commit 12a5e8e

File tree

1 file changed

+58
-21
lines changed

1 file changed

+58
-21
lines changed

src/main/java/com/amazon/redshift/core/v3/SimpleParameterList.java

+58-21
Original file line numberDiff line numberDiff line change
@@ -284,27 +284,64 @@ public String toString(int index, boolean standardConformingStrings) {
284284
textValue = paramValues[index].toString();
285285
int paramType = paramTypes[index];
286286

287-
if (paramType == Oid.TIMESTAMP) {
288-
type = "timestamp";
289-
} else if (paramType == Oid.TIMESTAMPTZ) {
290-
type = "timestamp with time zone";
291-
} else if (paramType == Oid.TIME) {
292-
type = "time";
293-
} else if (paramType == Oid.TIMETZ) {
294-
type = "time with time zone";
295-
} else if (paramType == Oid.DATE) {
296-
type = "date";
297-
} else if (paramType == Oid.INTERVAL) {
298-
type = "interval";
299-
} else if (paramType == Oid.INTERVALY2M) {
300-
type = "interval year to month";
301-
} else if (paramType == Oid.INTERVALD2S) {
302-
type = "interval day to second";
303-
} else if (paramType == Oid.NUMERIC) {
304-
type = "numeric";
305-
}
306-
else {
307-
type = null;
287+
switch (paramTypes[index])
288+
{
289+
case Oid.INT2:
290+
type = "int2";
291+
break;
292+
case Oid.INT4:
293+
type = "int4";
294+
break;
295+
case Oid.INT8:
296+
type = "int8";
297+
break;
298+
case Oid.FLOAT4:
299+
type = "real";
300+
break;
301+
case Oid.FLOAT8:
302+
type = "double precision";
303+
break;
304+
case Oid.TIMESTAMP:
305+
type = "timestamp";
306+
break;
307+
case Oid.TIMESTAMPTZ:
308+
type = "timestamp with time zone";
309+
break;
310+
case Oid.TIME:
311+
type = "time";
312+
break;
313+
case Oid.TIMETZ:
314+
type = "time with time zone";
315+
break;
316+
case Oid.DATE:
317+
type = "date";
318+
break;
319+
case Oid.INTERVAL:
320+
type = "interval";
321+
break;
322+
case Oid.INTERVALY2M:
323+
type = "interval year to month";
324+
break;
325+
case Oid.INTERVALD2S:
326+
type = "interval day to second";
327+
break;
328+
case Oid.NUMERIC:
329+
type = "numeric";
330+
break;
331+
case Oid.UUID:
332+
type = "uuid";
333+
break;
334+
case Oid.BOOL:
335+
type = "boolean";
336+
break;
337+
case Oid.BOX:
338+
type = "box";
339+
break;
340+
case Oid.POINT:
341+
type = "point";
342+
break;
343+
default:
344+
type = null;
308345
}
309346
}
310347
return quoteAndCast(textValue, type, standardConformingStrings);

0 commit comments

Comments
 (0)