1f-cursorname-in-varchar-ctxdiff.patch
text/x-patch
Filename: 1f-cursorname-in-varchar-ctxdiff.patch
Type: text/x-patch
Part: 5
Message:
Re: CommitFest 2009-09, two weeks on
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/interfaces/ecpg/preproc/ecpg.trailer | 33 | 1 |
| src/interfaces/ecpg/preproc/ecpg.type | 1 | 0 |
diff -dcrpN pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.cname_in_varchar/src/interfaces/ecpg/preproc/ecpg.trailer
*** pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 01:42:17.000000000 +0200
--- pgsql.cname_in_varchar/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 02:05:58.000000000 +0200
*************** char_variable: cvariable
*** 228,233 ****
--- 228,265 ----
}
;
+ cursor_char_variable: cvariable
+ {
+ /* check if we have a string variable */
+ struct variable *p = find_variable($1);
+ enum ECPGttype type = p->type->type;
+
+ /* If we have just one character this is not a string */
+ if (atol(p->type->size) == 1)
+ mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
+ else
+ {
+ /* if array see what's inside */
+ if (type == ECPGt_array)
+ type = p->type->u.element->type;
+
+ switch (type)
+ {
+ case ECPGt_char:
+ case ECPGt_unsigned_char:
+ case ECPGt_string:
+ case ECPGt_varchar:
+ $$ = $1;
+ break;
+ default:
+ mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
+ $$ = $1;
+ break;
+ }
+ }
+ }
+ ;
+
opt_options: Op connect_options
{
if (strlen($1) == 0)
*************** civarind: cvariable indicator
*** 1798,1804 ****
}
;
! char_civar: char_variable
{
add_variable_to_head(&argsinsert, find_variable($1), &no_indicator);
$$ = $1;
--- 1830,1836 ----
}
;
! char_civar: cursor_char_variable
{
add_variable_to_head(&argsinsert, find_variable($1), &no_indicator);
$$ = $1;
diff -dcrpN pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.type pgsql.cname_in_varchar/src/interfaces/ecpg/preproc/ecpg.type
*** pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 01:41:51.000000000 +0200
--- pgsql.cname_in_varchar/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 02:03:31.000000000 +0200
***************
*** 46,51 ****
--- 46,52 ----
%type <str> char_civar
%type <str> civar
%type <str> civarind
+ %type <str> cursor_char_variable
%type <str> ColLabel
%type <str> connect_options
%type <str> connection_object