case SHORT:
/*write the parsing stuff ..... for parsing the options member of the object to seperate the statement and
main phrase parts*/
Ques=((Short *)object)->stmt[0];
Question=parseQuestion(Ques); // function called for replacing tilde,cape symbol to angluar brackets
Questemp=Question;
((Short *)object)->stmt[0]=Questemp;
temp = "\"" + chapter + "\", \"" + board + "\", \"" + subject + "\", \"" + temp2.setNum(((baseFillChoose *)object)->pageNo)+ "\", \"" + ((Short *)object)->Queswav + "\",";
temp += " \"" + ((Short *)object)->stmt[0] + "\",\"" + ((Short *)object)->mgif[0] + "\",\"" + ((Short *)object)->mgif1[0] + "\", \"" + ((Short *)object)->ChooseType + "\", \"" +((Short *)object)->misc[0] + "\"";
text12="insert into ShortQues(Chapter,Board,Subject,PageNo,Queswav,Que stion,Q1Gif1,Q1Gif2,Shorttype,StaticGif1) values (" + temp + ");";
cout<<"text12\n"<<text12<<endl;
query
= new QSqlQuery("insert into ShortQues(Chapter,Board,Subject,PageNo,Queswav,Que stion,Q1Gif1,Q1Gif2,Shorttype,StaticGif1) values (" + temp
+ ")");
temp = "";
index = 0;
query
= new QSqlQuery("select MAX(QNo) as QNo from ShortQues");
if(!query->first())
{
exit(-2);
}
qNo = (query->value(0)).toInt();
for(i = 0;i<object->getNumOpt();i++)
{
index = 0;
while((((Short *)object)->options[i])[index]!='\0') //here it points
{
index = parseOption(index,((Short *)object)->options[i],stmt1,phrase);
cout<<"index : "<<index<<"\n"<<stmt1<<"\n"<<phrase<<endl;
stmt1temp=stmt1;
stmt1=stmt1temp;
phrasetemp=phrase;
phrase=phrasetemp;
if(index!=-1)
{
text11="insert into ShAnsPts(Statement1,Statement2,Option1,QNo,PointNo ,CorrectNo) values (\"" + stmt1 + "\", NULL,\"" + phrase + "\"," + temp2.setNum(qNo) + "," + temp2.setNum(((Short *)object)->ptno[i+1]) + ",1)";
cout<<"\n\ntext11"<<text11<<endl;
query
= new QSqlQuery("insert into ShAnsPts(Statement1,Statement2,Option1,QNo,PointNo ,CorrectNo) values (\"" + stmt1
+ "\", NULL,\"" + phrase
+ "\"," + temp2.
setNum(qNo
) + "," + temp2.
setNum(((Short *)object
)->ptno
[i
+1])+",1)");
}
else {
query
= new QSqlQuery("select MAX(APNo) as APNo from ShAnsPts where QNo=" + temp2.
setNum(qNo
) +"&& PointNo=" + temp2.
setNum(((Short *)object
)->ptno
[i
+1]));
if(!query->first())
{
cout<<"There is no main phrase in this point ..... aborting\n";
exit(-2);
}
aPNo = (query->value(0)).toInt();
cout<<"This is apNo values"<<aPNo<<endl;
stmt1=parseQuestion(stmt1); // function called for replacing tilde,cape symbol to angluar brackets
stmt2temp=parseStepNo(stmt1,i,aPNo);
cout<<"\nThis is the apno value required"<<aPNo<<endl;
// stmt2temp=stmt1;
stmt2=stmt2temp;
cout<<"This is STatement2 value"<<stmt2<<endl;
// (((baseFillChoose *)object)->stepno[i+1])=stepval[i];
// cout<<"This is stepmark value"<<stepval[i]<<endl;
query
= new QSqlQuery("update ShAnsPts set Statement2 = \"" + stmt2
+ "\" where APNo=" + temp2.
setNum(aPNo
));
// query = new QSqlQuery("update ShAnsPts set StepMark = \"" + ((baseFillChoose *)object)->stepno[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
query
= new QSqlQuery("update ShAnsPts set Q1Gif1 = \"" + ((Short *)object
)->mgif
[i
+1] + "\" where APNo=" + temp2.
setNum(aPNo
));
query
= new QSqlQuery("update ShAnsPts set Q1Gif2 = \"" + ((Short *)object
)->mgif1
[i
+1] + "\" where APNo=" + temp2.
setNum(aPNo
));
query
= new QSqlQuery("update ShAnsPts set StaticGif1 = \"" + ((Short *)object
)->misc
[i
+1] + "\" where APNo=" + temp2.
setNum(aPNo
));
query
= new QSqlQuery("update ShAnsPts set voiceover = \"" + ((Short *)object
)->voiceovers
[i
+1] + "\" where APNo=" + temp2.
setNum(aPNo
));
}
}
}
break;
case SHORT:
/*write the parsing stuff ..... for parsing the options member of the object to seperate the statement and
main phrase parts*/
Ques=((Short *)object)->stmt[0];
Question=parseQuestion(Ques); // function called for replacing tilde,cape symbol to angluar brackets
Questemp=Question;
((Short *)object)->stmt[0]=Questemp;
temp = "\"" + chapter + "\", \"" + board + "\", \"" + subject + "\", \"" + temp2.setNum(((baseFillChoose *)object)->pageNo)+ "\", \"" + ((Short *)object)->Queswav + "\",";
temp += " \"" + ((Short *)object)->stmt[0] + "\",\"" + ((Short *)object)->mgif[0] + "\",\"" + ((Short *)object)->mgif1[0] + "\", \"" + ((Short *)object)->ChooseType + "\", \"" +((Short *)object)->misc[0] + "\"";
text12="insert into ShortQues(Chapter,Board,Subject,PageNo,Queswav,Que stion,Q1Gif1,Q1Gif2,Shorttype,StaticGif1) values (" + temp + ");";
cout<<"text12\n"<<text12<<endl;
query = new QSqlQuery("insert into ShortQues(Chapter,Board,Subject,PageNo,Queswav,Que stion,Q1Gif1,Q1Gif2,Shorttype,StaticGif1) values (" + temp + ")");
temp = "";
index = 0;
query = new QSqlQuery("select MAX(QNo) as QNo from ShortQues");
if(!query->first())
{
exit(-2);
}
qNo = (query->value(0)).toInt();
for(i = 0;i<object->getNumOpt();i++)
{
index = 0;
while((((Short *)object)->options[i])[index]!='\0') //here it points
{
index = parseOption(index,((Short *)object)->options[i],stmt1,phrase);
cout<<"index : "<<index<<"\n"<<stmt1<<"\n"<<phrase<<endl;
QString text11;
stmt1temp=stmt1;
stmt1=stmt1temp;
phrasetemp=phrase;
phrase=phrasetemp;
if(index!=-1)
{
text11="insert into ShAnsPts(Statement1,Statement2,Option1,QNo,PointNo ,CorrectNo) values (\"" + stmt1 + "\", NULL,\"" + phrase + "\"," + temp2.setNum(qNo) + "," + temp2.setNum(((Short *)object)->ptno[i+1]) + ",1)";
cout<<"\n\ntext11"<<text11<<endl;
query = new QSqlQuery("insert into ShAnsPts(Statement1,Statement2,Option1,QNo,PointNo ,CorrectNo) values (\"" + stmt1 + "\", NULL,\"" + phrase + "\"," + temp2.setNum(qNo) + "," + temp2.setNum(((Short *)object)->ptno[i+1])+",1)");
}
else {
query = new QSqlQuery("select MAX(APNo) as APNo from ShAnsPts where QNo=" + temp2.setNum(qNo) +"&& PointNo=" + temp2.setNum(((Short *)object)->ptno[i+1]));
if(!query->first())
{
cout<<"There is no main phrase in this point ..... aborting\n";
exit(-2);
}
aPNo = (query->value(0)).toInt();
cout<<"This is apNo values"<<aPNo<<endl;
stmt1=parseQuestion(stmt1); // function called for replacing tilde,cape symbol to angluar brackets
stmt2temp=parseStepNo(stmt1,i,aPNo);
cout<<"\nThis is the apno value required"<<aPNo<<endl;
// stmt2temp=stmt1;
stmt2=stmt2temp;
cout<<"This is STatement2 value"<<stmt2<<endl;
// (((baseFillChoose *)object)->stepno[i+1])=stepval[i];
// cout<<"This is stepmark value"<<stepval[i]<<endl;
query = new QSqlQuery("update ShAnsPts set Statement2 = \"" + stmt2 + "\" where APNo=" + temp2.setNum(aPNo));
// query = new QSqlQuery("update ShAnsPts set StepMark = \"" + ((baseFillChoose *)object)->stepno[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
query = new QSqlQuery("update ShAnsPts set Q1Gif1 = \"" + ((Short *)object)->mgif[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
query = new QSqlQuery("update ShAnsPts set Q1Gif2 = \"" + ((Short *)object)->mgif1[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
query = new QSqlQuery("update ShAnsPts set StaticGif1 = \"" + ((Short *)object)->misc[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
query = new QSqlQuery("update ShAnsPts set voiceover = \"" + ((Short *)object)->voiceovers[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
}
}
}
break;
To copy to clipboard, switch view to plain text mode
{
int j = 0;
int index = ind;
cout<<"311 : parseOption : "<<option<<endl;
cout<<"index&&\n"<<index<<endl;
while(option[index] != '|')
{
stmt1[j] = option[index];
cout<<"stmt1[j]\n"<<stmt1[j]<<endl;
if(option[index]=='\0')
{
stmt1[j] = '\0';
cout<<"stmt1[j]\n"<<stmt1[j]<<endl;
option[0] = '\0';
cout<<"option[0]\n"<<option[0]<<endl;
return -1;
}
index++;
j++;
}
stmt1[j] = '\0';
cout<<"stmt1[j]**&\n"<<stmt1[j]<<endl;
stmt1=stmt1.replace( "{sub}","<sub>");
stmt1=stmt1.replace( "{/sub}","</sub>" );
cout<<"425 : "<<stmt1<<endl;
j = 0;
index++;
while(option[index] != '\\')
{
phrase[j] = option[index];
index++;
j++;
}
phrase=phrase.replace( "{sub}","<sub>" );
phrase=phrase.replace( "{sub}","<sub>" );
cout<<"Phrase value"<<phrase<<endl;
phrase[j] = '\0';
cout<<"436 : "<<phrase<<endl;
return (index + 1);
}
int mainForm:arseOption(int ind,QString option, QString &stmt1, QString &phrase)
{
QTextStream cout(stdout, QIODevice::WriteOnly);
int j = 0;
int index = ind;
cout<<"311 : parseOption : "<<option<<endl;
cout<<"index&&\n"<<index<<endl;
while(option[index] != '|')
{
stmt1[j] = option[index];
cout<<"stmt1[j]\n"<<stmt1[j]<<endl;
if(option[index]=='\0')
{
stmt1[j] = '\0';
cout<<"stmt1[j]\n"<<stmt1[j]<<endl;
option[0] = '\0';
cout<<"option[0]\n"<<option[0]<<endl;
return -1;
}
index++;
j++;
}
stmt1[j] = '\0';
cout<<"stmt1[j]**&\n"<<stmt1[j]<<endl;
stmt1=stmt1.replace( "{sub}","<sub>");
stmt1=stmt1.replace( "{/sub}","</sub>" );
cout<<"425 : "<<stmt1<<endl;
j = 0;
index++;
while(option[index] != '\\')
{
phrase[j] = option[index];
index++;
j++;
}
phrase=phrase.replace( "{sub}","<sub>" );
phrase=phrase.replace( "{sub}","<sub>" );
cout<<"Phrase value"<<phrase<<endl;
phrase[j] = '\0';
cout<<"436 : "<<phrase<<endl;
return (index + 1);
}
To copy to clipboard, switch view to plain text mode
{
cout<<"It is coming inside the parse function"<<endl;
stmt1=stmt1.replace( "{sub}","<sub>" );
stmt1=stmt1.replace( "{/sub}","</sub>" );
stmt1=stmt1.replace( "{sup}","<sup>" );
stmt1=stmt1.replace( "{/sup}","</sup>" );
return(stmt1);
}
QString mainForm:arseQuestion(QString &stmt1)
{
QTextStream cout(stdout, QIODevice::WriteOnly);
cout<<"It is coming inside the parse function"<<endl;
stmt1=stmt1.replace( QChar('^'),QChar('<') );
stmt1=stmt1.replace( QChar('~'),QChar('>') );
stmt1=stmt1.replace( "{sub}","<sub>" );
stmt1=stmt1.replace( "{/sub}","</sub>" );
stmt1=stmt1.replace( "{sup}","<sup>" );
stmt1=stmt1.replace( "{/sup}","</sup>" );
return(stmt1);
}
To copy to clipboard, switch view to plain text mode
Bookmarks