Skip to content

Commit

Permalink
Issue #33 - Fix test case list (duplicate appendindex)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppomes committed Oct 14, 2024
1 parent 0cf3d12 commit 77919d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ EXTRA_DIST = $(top_srcdir)/uthash/uthash.h \
$(top_srcdir)/debian/copyright \
$(top_srcdir)/debian/rules

TULIST = test1 test1-insert-ignore null-example appendkey prependkey issue29 test_substring appendindex appendindex
TULIST = test1 test1-insert-ignore null-example appendkey prependkey issue29 test_substring appendindex prependindex
PYTHON_SUPPORT = @PYTHON_SUPPORT@
JQ_SUPPORT = @JQ@

Expand Down
19 changes: 11 additions & 8 deletions main/dumpparser.y
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ static anon_json_st *jscur=NULL;
/* True on first extended insert found for each table */
static bool bfirstinsert;

/* Current row position in current table */
static int rowindex;

static void quoted_output_helper (char *s, unsigned short len, bool quoted);

#ifdef HAVE_JQ
Expand Down Expand Up @@ -104,7 +107,12 @@ tables: table
table: create
| create insert_st_list

create: CREATE_TABLE { currentfieldpos=0; } LEFTPAR fields RIGHTPAR ENGINE
create: CREATE_TABLE {
currentfieldpos=0;
bfirstinsert=true;
rowindex=0;
memset(fieldconfig,0,sizeof(fieldconfig));
} LEFTPAR fields RIGHTPAR ENGINE

fields: field
| fields field;
Expand Down Expand Up @@ -134,16 +142,14 @@ type : TYPE { if (cur != NULL) {
insert_st_list : insert_st
| insert_st_list insert_st

insert_st : INSERT_INTO VALUES {
bfirstinsert=true ;
memset(fieldconfig,0,sizeof(fieldconfig));
} valueline SEMICOLUMN
insert_st : INSERT_INTO VALUES valueline SEMICOLUMN

valueline: value
| valueline COMA value

value: LEFTPAR {
currentfieldpos =0;
rowindex++;
memset(tablekey,0,sizeof(tablekey));
} fieldv RIGHTPAR {
bfirstinsert=false;
Expand All @@ -156,7 +162,6 @@ singlefield : VALUE {
anonymized_res_st res_st;
char *s;
int nbcopied;
int rowindex;
char concatvalue[ID_SIZE];
#ifdef HAVE_JQ
char *newjsonbackslash_str=NULL;
Expand All @@ -170,7 +175,6 @@ singlefield : VALUE {

bool found=false;
if (bfirstinsert) {
rowindex=0;
for (cur=infos;cur!=NULL;cur=cur->hh.next) {
if (memcmp(cur->key,currenttable,strlen(currenttable)) == 0) {
if (cur->pos == currentfieldpos) {
Expand All @@ -189,7 +193,6 @@ singlefield : VALUE {

if (found) {
cur->infos.nbhits++;
rowindex++;
}

/* NULL values should remains NULL
Expand Down

0 comments on commit 77919d0

Please sign in to comment.