TABLE="";
NF=split(data,cmd);
#insert command is defined by the key words: insert into;
if (cmd[1] == "insert" && cmd[2] == "into") {
for (i=NF;i>0;i--){
if (split(cmd[i],t,"=") == 2)
{ FIELDVALUE[t[1]] = t[2]}
}
for (i in FIELDVALUE){print i"="FIELDVALUE[i];}
print "perform insert action";
cmdflag = 1;
}
}
####End Begin Bloc####
TABLEDEF["NRTABLEDEF"]=NR+1;
#for (i in TABLEDEF){print i":=:" TABLEDEF[i]} # just a printout for debug
if (cmdflag == 1) {
if ("AUTONUM" in TABLEDEF) {
TABLEDEF["AUTONUM"]++ ;
$NTABLEDEF["AUTONUM"] = "AUTONUM="TABLEDEF["AUTONUM"];
}
}
}
#read tablefields must always be next line after tabledefinition
/^%/{ if(NR == TABLEDEF["NRTABLEDEF"]){
$0 = substr($0,2);
NFIELDS=split($0,FIELDNAME,"\t");
for (i in FIELDNAME) {print i"=" FIELDNAME[i];} # just a printout for debug
}
}