Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f5a164

Browse files
committed
Hello,
Two patches included:- the first one enables the use of bool variables in fields which mightbecome NULL. Up to now the lib told you that NULL is not a bool variable, even ifyou provide a indicator.- the second patch checks whether a value is null and issues an error ifno indicator is provided.Sidenote: IIRC, the variable should be left alone if the value is NULL.ECPGlib sets it's value to 0 on NULL. Is this a violation of thestandard?Regards Christof
1 parentebb618b commit3f5a164

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Tue Aug 24 15:53:28 MEST 1999
2+
3+
- made NULL a valid bool value
4+
- check for indicator variables on NULL
5+
16
Wed Feb 11 10:58:13 CET 1998
27

38
- Added '-d' option to turn on debugging.

‎src/interfaces/ecpg/include/ecpgerrno.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#defineECPG_FLOAT_FORMAT-206
2323
#defineECPG_CONVERT_BOOL-207
2424
#defineECPG_EMPTY-208
25+
#defineECPG_MISSING_INDICATOR-209
2526

2627
#defineECPG_NO_CONN-220
2728
#defineECPG_NOT_CONN-221

‎src/interfaces/ecpg/lib/ecpglib.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,16 @@ ECPGexecute(struct statement * stmt)
766766
caseECPGt_unsigned_long:
767767
((long*)var->ind_value)[act_tuple]=-PQgetisnull(results,act_tuple,act_field);
768768
break;
769+
caseECPGt_NO_INDICATOR:
770+
if (PQgetisnull(results,act_tuple,act_field))
771+
{
772+
register_error(ECPG_MISSING_INDICATOR,"NULL value without indicator variable on line %d.",stmt->lineno);
773+
status= false;
774+
}
775+
break;
769776
default:
777+
register_error(ECPG_UNSUPPORTED,"Unsupported indicator type %s on line %d.",ECPGtype_name(var->ind_type),stmt->lineno);
778+
status= false;
770779
break;
771780
}
772781

@@ -891,6 +900,11 @@ ECPGexecute(struct statement * stmt)
891900
((char*)var->value)[act_tuple]= true;
892901
break;
893902
}
903+
elseif (pval[0]=='\0'&&PQgetisnull(results,act_tuple,act_field))
904+
{
905+
// NULL is valid
906+
break;
907+
}
894908
}
895909

896910
register_error(ECPG_CONVERT_BOOL,"Unable to convert %s to bool on line %d.",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp