/** Outputs one table values. Fetch all selected rows and output them in the html file @param aTableIndex table index in the table array @leave if there is an error at sql level, it will be forwarded */ void CDbSqlDumper::OutputTableToFileL(TInt aTableIndex) { TInt err; iFile.Write(KTable); OutputTableNameToFile(aTableIndex); OutputTableColHeadingsToFile(aTableIndex); PrepareSQLStatementL(aTableIndex); // output the table's rows while ((err =iSqlStatement.Next()) == KSqlAtRow ) { iFile.Write(KRow); OutputTableColDataToFileL(aTableIndex); iFile.Write(KRowEnd); } // check if there were any error if(err != KSqlAtEnd) { iSqlStatement.Close(); User::Leave(err); } iSqlStatement.Close(); iFile.Write(KTableEnd); }
/** Output one table to the html file. Traverse a table and output each row in the html file @param aTableIndex table index in the table array */ void CDbDbmsDumper::OutputTableToFileL(TInt aTableIndex) { iFile.Write(KTable); OutputTableNameToFile(aTableIndex); CDesCArray* colNames = OutputTableColHeadingsToFileLC(aTableIndex); User::LeaveIfError(iDbTable.Open(iDatabase, (*iTableNames)[aTableIndex], RDbRowSet::EReadOnly) ); User::LeaveIfError(iDbTable.SetNoIndex() ); // set rowset order as underlying row order iDbTable.BeginningL(); // set cursor to start of table iDbTable.NextL(); // output the table's rows while (!iDbTable.AtEnd() ) { iFile.Write(KRow); OutputTableColDataToFileL(*colNames); iDbTable.NextL(); iFile.Write(KRowEnd); } iDbTable.Close(); iFile.Write(KTableEnd); CleanupStack::PopAndDestroy(colNames); }