1d-dynamiccur-ctxdiff.patch
text/x-patch
Filename: 1d-dynamiccur-ctxdiff.patch
Type: text/x-patch
Part: 3
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.addons | 46 | 1 |
| src/interfaces/ecpg/preproc/ecpg.trailer | 25 | 2 |
| src/interfaces/ecpg/preproc/ecpg.type | 1 | 0 |
diff -dcrpN pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.addons pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.addons
*** pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 00:51:58.000000000 +0200
--- pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 01:24:46.000000000 +0200
*************** ECPG: var_valueNumericOnly addon
*** 213,228 ****
--- 213,248 ----
}
ECPG: fetch_argscursor_name addon
add_additional_variables($1, false);
+ if ($1[0] == ':')
+ {
+ free($1);
+ $1 = make_str("$0");
+ }
ECPG: fetch_argsfrom_incursor_name addon
add_additional_variables($2, false);
+ if ($2[0] == ':')
+ {
+ free($2);
+ $2 = make_str("$0");
+ }
ECPG: fetch_argsNEXTopt_from_incursor_name addon
ECPG: fetch_argsPRIORopt_from_incursor_name addon
ECPG: fetch_argsFIRST_Popt_from_incursor_name addon
ECPG: fetch_argsLAST_Popt_from_incursor_name addon
ECPG: fetch_argsALLopt_from_incursor_name addon
add_additional_variables($3, false);
+ if ($3[0] == ':')
+ {
+ free($3);
+ $3 = make_str("$0");
+ }
ECPG: fetch_argsSignedIconstopt_from_incursor_name addon
add_additional_variables($3, false);
+ if ($3[0] == ':')
+ {
+ free($3);
+ $3 = make_str("$0");
+ }
if ($1[0] == '$')
{
free($1);
*************** ECPG: fetch_argsSignedIconstopt_from_inc
*** 231,246 ****
--- 251,285 ----
ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon
ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon
add_additional_variables($4, false);
+ if ($4[0] == ':')
+ {
+ free($4);
+ $4 = make_str("$0");
+ }
ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_incursor_name addon
ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon
ECPG: fetch_argsFORWARDSignedIconstopt_from_incursor_name addon
ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon
add_additional_variables($4, false);
+ if ($4[0] == ':')
+ {
+ free($4);
+ $4 = make_str("$0");
+ }
if ($2[0] == '$')
{
free($2);
$2 = make_str("$0");
}
+ ECPG: cursor_namename rule
+ | char_civar
+ {
+ char *curname = mm_alloc(strlen($1) + 2);
+ sprintf(curname, ":%s", $1);
+ free($1);
+ $1 = curname;
+ $$ = $1;
+ }
ECPG: PrepareStmtPREPAREprepared_nameprep_type_clauseASPreparableStmt block
{
$$.name = $2;
*************** ECPG: ExecuteStmtEXECUTEprepared_nameexe
*** 258,263 ****
--- 297,303 ----
ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block
{
struct cursor *ptr, *this;
+ char *cursor_marker = $2[0] == ':' ? make_str("$0") : mm_strdup($2);
char *comment;
for (ptr = cur; ptr != NULL; ptr = ptr->next)
*************** ECPG: DeclareCursorStmtDECLAREcursor_nam
*** 272,278 ****
this->name = $2;
this->connection = connection;
this->opened = false;
! this->command = cat_str(7, make_str("declare"), mm_strdup($2), $3, make_str("cursor"), $5, make_str("for"), $7);
this->argsinsert = argsinsert;
this->argsresult = argsresult;
argsinsert = argsresult = NULL;
--- 312,318 ----
this->name = $2;
this->connection = connection;
this->opened = false;
! this->command = cat_str(7, make_str("declare"), cursor_marker, $3, make_str("cursor"), $5, make_str("for"), $7);
this->argsinsert = argsinsert;
this->argsresult = argsresult;
argsinsert = argsresult = NULL;
*************** ECPG: DeclareCursorStmtDECLAREcursor_nam
*** 292,297 ****
--- 332,342 ----
else
$$ = comment;
}
+ ECPG: ClosePortalStmtCLOSEcursor_name block
+ {
+ char *cursor_marker = $2[0] == ':' ? make_str("$0") : $2;
+ $$ = cat2_str(make_str("close"), cursor_marker);
+ }
ECPG: opt_hold block
{
if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit == true)
diff -dcrpN pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.trailer
*** pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 00:55:00.000000000 +0200
--- pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 01:36:36.000000000 +0200
*************** prepared_name: name {
*** 288,293 ****
--- 288,294 ----
ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_name
{
struct cursor *ptr, *this;
+ char *cursor_marker = $2[0] == ':' ? make_str("$0") : mm_strdup($2);
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
const char *con = connection ? connection : "NULL";
*************** ECPGCursorStmt: DECLARE cursor_name cur
*** 304,310 ****
this->next = cur;
this->name = $2;
this->connection = connection;
! this->command = cat_str(6, make_str("declare"), mm_strdup($2), $3, make_str("cursor"), $5, make_str("for $1"));
this->argsresult = NULL;
thisquery->type = &ecpg_query;
--- 305,311 ----
this->next = cur;
this->name = $2;
this->connection = connection;
! this->command = cat_str(6, make_str("declare"), cursor_marker, $3, make_str("cursor"), $5, make_str("for $1"));
this->argsresult = NULL;
thisquery->type = &ecpg_query;
*************** ECPGCursorStmt: DECLARE cursor_name cur
*** 314,319 ****
--- 315,326 ----
sprintf(thisquery->name, "ECPGprepared_statement(%s, %s, __LINE__)", con, $7);
this->argsinsert = NULL;
+ if ($2[0] == ':')
+ {
+ struct variable *var = find_variable($2 + 1);
+ remove_variable_from_list(&argsinsert, var);
+ add_variable_to_head(&(this->argsinsert), var, &no_indicator);
+ }
add_variable_to_head(&(this->argsinsert), thisquery, &no_indicator);
cur = this;
*************** ECPGFree: SQL_FREE name { $$ = $2; }
*** 957,963 ****
/*
* open is an open cursor, at the moment this has to be removed
*/
! ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using { $$ = $2; };
opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; }
| ecpg_using { $$ = $1; }
--- 964,979 ----
/*
* open is an open cursor, at the moment this has to be removed
*/
! ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using
! {
! if ($2[0] == ':')
! {
! struct variable *var = find_variable($2 + 1);
! remove_variable_from_list(&argsinsert, var);
! }
! $$ = $2;
! }
! ;
opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; }
| ecpg_using { $$ = $1; }
*************** civarind: cvariable indicator
*** 1782,1787 ****
--- 1798,1810 ----
}
;
+ char_civar: char_variable
+ {
+ add_variable_to_head(&argsinsert, find_variable($1), &no_indicator);
+ $$ = $1;
+ }
+ ;
+
civar: cvariable
{
add_variable_to_head(&argsinsert, find_variable($1), &no_indicator);
diff -dcrpN pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.type pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.type
*** pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.type 2008-11-14 11:03:33.000000000 +0100
--- pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 01:36:11.000000000 +0200
***************
*** 43,48 ****
--- 43,49 ----
%type <str> c_term
%type <str> c_thing
%type <str> char_variable
+ %type <str> char_civar
%type <str> civar
%type <str> civarind
%type <str> ColLabel