diff options
Diffstat (limited to 'src/interfaces/ecpg/lib/ecpglib.c')
-rw-r--r-- | src/interfaces/ecpg/lib/ecpglib.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c index de093895e0c..2b0067449f1 100644 --- a/src/interfaces/ecpg/lib/ecpglib.c +++ b/src/interfaces/ecpg/lib/ecpglib.c @@ -766,7 +766,16 @@ ECPGexecute(struct statement * stmt) case ECPGt_unsigned_long: ((long *) var->ind_value)[act_tuple] = -PQgetisnull(results, act_tuple, act_field); break; + case ECPGt_NO_INDICATOR: + if (PQgetisnull(results, act_tuple, act_field)) + { + register_error(ECPG_MISSING_INDICATOR, "NULL value without indicator variable on line %d.", stmt->lineno); + status = false; + } + break; default: + register_error(ECPG_UNSUPPORTED, "Unsupported indicator type %s on line %d.", ECPGtype_name(var->ind_type), stmt->lineno); + status = false; break; } @@ -891,6 +900,11 @@ ECPGexecute(struct statement * stmt) ((char *) var->value)[act_tuple] = true; break; } + else if (pval[0] == '\0' && PQgetisnull(results, act_tuple, act_field)) + { + // NULL is valid + break; + } } register_error(ECPG_CONVERT_BOOL, "Unable to convert %s to bool on line %d.", |