From: <gua...@us...> - 2013-12-20 12:27:14
|
Revision: 5653 http://sourceforge.net/p/moneymanagerex/code/5653 Author: guanlisheng Date: 2013-12-20 12:27:11 +0000 (Fri, 20 Dec 2013) Log Message: ----------- new approach for general report: SQL to extract data and Lua to adjust the result Modified Paths: -------------- trunk/sql/tables_v1.sql trunk/src/customreportdialog.cpp trunk/src/customreportdialog.h trunk/src/db/DB_Table.h trunk/src/db/DB_Table_Accountlist_V1.h trunk/src/db/DB_Table_Assets_V1.h trunk/src/db/DB_Table_Billsdeposits_V1.h trunk/src/db/DB_Table_Budgetsplittransactions_V1.h trunk/src/db/DB_Table_Budgettable_V1.h trunk/src/db/DB_Table_Budgetyear_V1.h trunk/src/db/DB_Table_Category_V1.h trunk/src/db/DB_Table_Checkingaccount_V1.h trunk/src/db/DB_Table_Currencyformats_V1.h trunk/src/db/DB_Table_Infotable_V1.h trunk/src/db/DB_Table_Payee_V1.h trunk/src/db/DB_Table_Report_V1.h trunk/src/db/DB_Table_Setting_V1.h trunk/src/db/DB_Table_Splittransactions_V1.h trunk/src/db/DB_Table_Stock_V1.h trunk/src/db/DB_Table_Subcategory_V1.h trunk/src/model/Model_Report.cpp Modified: trunk/sql/tables_v1.sql =================================================================== --- trunk/sql/tables_v1.sql 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/sql/tables_v1.sql 2013-12-20 12:27:11 UTC (rev 5653) @@ -196,8 +196,8 @@ , REPORTNAME TEXT COLLATE NOCASE NOT NULL UNIQUE , STATUS TEXT COLLATE NOCASE NOT NULL , GROUPNAME TEXT COLLATE NOCASE -, CONTENTTYPE TEXT COLLATE NOCASE -, CONTENT TEXT +, SQLCONTENT TEXT +, LUACONTENT TEXT , TEMPLATEPATH TEXT ); CREATE INDEX INDEX_REPORT_NAME ON REPORT_V1(REPORTNAME); Modified: trunk/src/customreportdialog.cpp =================================================================== --- trunk/src/customreportdialog.cpp 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/customreportdialog.cpp 2013-12-20 12:27:11 UTC (rev 5653) @@ -278,12 +278,6 @@ wxFlexGridSizer* flex_sizer = new wxFlexGridSizer(0, 2, 0, 0); // - wxStaticText* type_label = new wxStaticText(this, ID_TYPELABEL - , wxString::Format(_("Script type: %s"), "") - , wxDefaultPosition, wxSize(titleTextWidth, -1)); - flex_sizer->Add(type_label, flags); - flex_sizer->AddSpacer(1); - long treeCtrlFlags = wxTR_EDIT_LABELS | wxTR_SINGLE | wxTR_HAS_BUTTONS; #if defined (__WXWIN__) treeCtrlFlags = wxTR_EDIT_LABELS | wxTR_SINGLE | wxTR_HAS_BUTTONS | wxTR_ROW_LINES; @@ -458,8 +452,8 @@ if (report) { MinimalEditor* m_scriptText = (MinimalEditor*) FindWindow(wxID_VIEW_DETAILS); - report->CONTENT = m_scriptText->GetValue(); - m_scriptText->ChangeValue(report->CONTENT); + report->SQLCONTENT = m_scriptText->GetValue(); + m_scriptText->ChangeValue(report->SQLCONTENT); Model_Report::instance().save(report); } } @@ -491,7 +485,7 @@ if (iData) report_id = iData->get_report_id(); wxMenu* customReportMenu = new wxMenu; - customReportMenu->Append(ID_NEW1, _("New SQL Custom Report")); + customReportMenu->Append(ID_NEW1, _("New Custom Report")); //TODO: Hided till release the workload //customReportMenu->Append(ID_NEW2, _("New Lua Custom Report")); customReportMenu->AppendSeparator(); @@ -505,13 +499,11 @@ { selectedItemId_ = event.GetItem(); m_selectedGroup = ""; - wxStaticText* script_label = (wxStaticText*) FindWindow(ID_TYPELABEL); MinimalEditor* m_scriptText = (MinimalEditor*) FindWindow(wxID_VIEW_DETAILS); MinimalEditor* m_templateText = (MinimalEditor*) FindWindow(ID_TEMPLATE); m_scriptText->ChangeValue(""); m_fileNameCtrl->ChangeValue(""); m_templateText->ChangeValue(""); - script_label->SetLabel(""); wxNotebook* n = (wxNotebook*) FindWindow(ID_NOTEBOOK); n->SetSelection(0); button_Run_->Enable(false); @@ -526,9 +518,8 @@ Model_Report::Data * report = Model_Report::instance().get(id); if (report) { - script_label->SetLabel(wxString::Format(_("Script Type: %s"), report->CONTENTTYPE)); m_fileNameCtrl->ChangeValue(report->TEMPLATEPATH); - m_scriptText->ChangeValue(report->CONTENT); + m_scriptText->ChangeValue(report->SQLCONTENT); m_scriptText->SetLexerSql(); wxString full_path = report->TEMPLATEPATH; @@ -606,12 +597,8 @@ int id = event.GetId(); if (id == ID_NEW1 || id == ID_NEW2) { - newReport("SQL"); + newReport(); } - if (id == ID_NEW2) - { - newReport("Lua"); - } else if (id == ID_DELETE) { MyTreeItemData* iData = dynamic_cast<MyTreeItemData*>(treeCtrl_->GetItemData(selectedItemId_)); @@ -624,7 +611,7 @@ fillControls(); } -void mmGeneralReportManager::newReport(const wxString type) +void mmGeneralReportManager::newReport() { wxString group_name; if (selectedItemId_ == root_) @@ -640,12 +627,11 @@ Model_Report::Data* report = Model_Report::instance().create(); report->GROUPNAME = group_name; int i = Model_Report::instance().all().size(); - wxString report_name = _("New SQL Report"); + wxString report_name = _("New Report"); while (!Model_Report::instance().find(Model_Report::REPORTNAME(report_name)).empty()) - report_name = wxString::Format(_("New SQL Report %i"), ++i); + report_name = wxString::Format(_("New Report %i"), ++i); report->REPORTNAME = report_name; - report->CONTENTTYPE = type; - report->CONTENT = "select 'Hello World' as COLUMN1" ; + report->SQLCONTENT = "select 'Hello World' as COLUMN1" ; report->TEMPLATEPATH = "sample.html"; Model_Report::instance().save(report); openTemplate(report->REPORTID); Modified: trunk/src/customreportdialog.h =================================================================== --- trunk/src/customreportdialog.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/customreportdialog.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -72,7 +72,7 @@ bool DeleteReport(int id); void OnMenuSelected(wxCommandEvent& event); void OnSourceTxtChar(wxKeyEvent& event); - void newReport(const wxString type); + void newReport(); //wxStyledTextCtrl* m_scriptText; //wxStyledTextCtrl* m_templateText; Modified: trunk/src/db/DB_Table.h =================================================================== --- trunk/src/db/DB_Table.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= @@ -341,15 +341,6 @@ } }; -struct SorterByCONTENT -{ - template<class DATA> - bool operator()(const DATA& x, const DATA& y) - { - return x.CONTENT < y.CONTENT; - } -}; - struct SorterByGROUPNAME { template<class DATA> @@ -431,30 +422,30 @@ } }; -struct SorterByCONTENTTYPE +struct SorterBySETTINGVALUE { template<class DATA> bool operator()(const DATA& x, const DATA& y) { - return x.CONTENTTYPE < y.CONTENTTYPE; + return x.SETTINGVALUE < y.SETTINGVALUE; } }; -struct SorterBySETTINGVALUE +struct SorterBySUBCATEGNAME { template<class DATA> bool operator()(const DATA& x, const DATA& y) { - return x.SETTINGVALUE < y.SETTINGVALUE; + return x.SUBCATEGNAME < y.SUBCATEGNAME; } }; -struct SorterBySUBCATEGNAME +struct SorterBySQLCONTENT { template<class DATA> bool operator()(const DATA& x, const DATA& y) { - return x.SUBCATEGNAME < y.SUBCATEGNAME; + return x.SQLCONTENT < y.SQLCONTENT; } }; @@ -764,6 +755,15 @@ } }; +struct SorterByLUACONTENT +{ + template<class DATA> + bool operator()(const DATA& x, const DATA& y) + { + return x.LUACONTENT < y.LUACONTENT; + } +}; + struct SorterByASSETNAME { template<class DATA> Modified: trunk/src/db/DB_Table_Accountlist_V1.h =================================================================== --- trunk/src/db/DB_Table_Accountlist_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Accountlist_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Assets_V1.h =================================================================== --- trunk/src/db/DB_Table_Assets_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Assets_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Billsdeposits_V1.h =================================================================== --- trunk/src/db/DB_Table_Billsdeposits_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Billsdeposits_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Budgetsplittransactions_V1.h =================================================================== --- trunk/src/db/DB_Table_Budgetsplittransactions_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Budgetsplittransactions_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Budgettable_V1.h =================================================================== --- trunk/src/db/DB_Table_Budgettable_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Budgettable_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Budgetyear_V1.h =================================================================== --- trunk/src/db/DB_Table_Budgetyear_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Budgetyear_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Category_V1.h =================================================================== --- trunk/src/db/DB_Table_Category_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Category_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Checkingaccount_V1.h =================================================================== --- trunk/src/db/DB_Table_Checkingaccount_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Checkingaccount_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Currencyformats_V1.h =================================================================== --- trunk/src/db/DB_Table_Currencyformats_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Currencyformats_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Infotable_V1.h =================================================================== --- trunk/src/db/DB_Table_Infotable_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Infotable_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Payee_V1.h =================================================================== --- trunk/src/db/DB_Table_Payee_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Payee_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Report_V1.h =================================================================== --- trunk/src/db/DB_Table_Report_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Report_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= @@ -61,7 +61,7 @@ { try { - db->ExecuteUpdate("CREATE TABLE REPORT_V1(REPORTID integer not null primary key, REPORTNAME TEXT COLLATE NOCASE NOT NULL UNIQUE, STATUS TEXT COLLATE NOCASE NOT NULL, GROUPNAME TEXT COLLATE NOCASE, CONTENTTYPE TEXT COLLATE NOCASE, CONTENT TEXT, TEMPLATEPATH TEXT)"); + db->ExecuteUpdate("CREATE TABLE REPORT_V1(REPORTID integer not null primary key, REPORTNAME TEXT COLLATE NOCASE NOT NULL UNIQUE, STATUS TEXT COLLATE NOCASE NOT NULL, GROUPNAME TEXT COLLATE NOCASE, SQLCONTENT TEXT, LUACONTENT TEXT, TEMPLATEPATH TEXT)"); } catch(const wxSQLite3Exception &e) { @@ -110,15 +110,15 @@ static wxString name() { return "GROUPNAME"; } GROUPNAME(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {} }; - struct CONTENTTYPE : public DB_Column<wxString> + struct SQLCONTENT : public DB_Column<wxString> { - static wxString name() { return "CONTENTTYPE"; } - CONTENTTYPE(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {} + static wxString name() { return "SQLCONTENT"; } + SQLCONTENT(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {} }; - struct CONTENT : public DB_Column<wxString> + struct LUACONTENT : public DB_Column<wxString> { - static wxString name() { return "CONTENT"; } - CONTENT(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {} + static wxString name() { return "LUACONTENT"; } + LUACONTENT(const wxString &v, OP op = EQUAL): DB_Column<wxString>(v, op) {} }; struct TEMPLATEPATH : public DB_Column<wxString> { @@ -132,8 +132,8 @@ , COL_REPORTNAME = 1 , COL_STATUS = 2 , COL_GROUPNAME = 3 - , COL_CONTENTTYPE = 4 - , COL_CONTENT = 5 + , COL_SQLCONTENT = 4 + , COL_LUACONTENT = 5 , COL_TEMPLATEPATH = 6 }; @@ -146,8 +146,8 @@ case COL_REPORTNAME: return "REPORTNAME"; case COL_STATUS: return "STATUS"; case COL_GROUPNAME: return "GROUPNAME"; - case COL_CONTENTTYPE: return "CONTENTTYPE"; - case COL_CONTENT: return "CONTENT"; + case COL_SQLCONTENT: return "SQLCONTENT"; + case COL_LUACONTENT: return "LUACONTENT"; case COL_TEMPLATEPATH: return "TEMPLATEPATH"; default: break; } @@ -162,8 +162,8 @@ else if ("REPORTNAME" == name) return COL_REPORTNAME; else if ("STATUS" == name) return COL_STATUS; else if ("GROUPNAME" == name) return COL_GROUPNAME; - else if ("CONTENTTYPE" == name) return COL_CONTENTTYPE; - else if ("CONTENT" == name) return COL_CONTENT; + else if ("SQLCONTENT" == name) return COL_SQLCONTENT; + else if ("LUACONTENT" == name) return COL_LUACONTENT; else if ("TEMPLATEPATH" == name) return COL_TEMPLATEPATH; return COLUMN(-1); @@ -180,8 +180,8 @@ wxString REPORTNAME; wxString STATUS; wxString GROUPNAME; - wxString CONTENTTYPE; - wxString CONTENT; + wxString SQLCONTENT; + wxString LUACONTENT; wxString TEMPLATEPATH; int id() const { return REPORTID; } void id(int id) { REPORTID = id; } @@ -209,8 +209,8 @@ REPORTNAME = q.GetString("REPORTNAME"); STATUS = q.GetString("STATUS"); GROUPNAME = q.GetString("GROUPNAME"); - CONTENTTYPE = q.GetString("CONTENTTYPE"); - CONTENT = q.GetString("CONTENT"); + SQLCONTENT = q.GetString("SQLCONTENT"); + LUACONTENT = q.GetString("LUACONTENT"); TEMPLATEPATH = q.GetString("TEMPLATEPATH"); } @@ -229,8 +229,8 @@ o["REPORTNAME"] = json::String(this->REPORTNAME.ToStdString()); o["STATUS"] = json::String(this->STATUS.ToStdString()); o["GROUPNAME"] = json::String(this->GROUPNAME.ToStdString()); - o["CONTENTTYPE"] = json::String(this->CONTENTTYPE.ToStdString()); - o["CONTENT"] = json::String(this->CONTENT.ToStdString()); + o["SQLCONTENT"] = json::String(this->SQLCONTENT.ToStdString()); + o["LUACONTENT"] = json::String(this->LUACONTENT.ToStdString()); o["TEMPLATEPATH"] = json::String(this->TEMPLATEPATH.ToStdString()); return 0; } @@ -241,8 +241,8 @@ row("REPORTNAME") = REPORTNAME; row("STATUS") = STATUS; row("GROUPNAME") = GROUPNAME; - row("CONTENTTYPE") = CONTENTTYPE; - row("CONTENT") = CONTENT; + row("SQLCONTENT") = SQLCONTENT; + row("LUACONTENT") = LUACONTENT; row("TEMPLATEPATH") = TEMPLATEPATH; return row; } @@ -316,11 +316,11 @@ wxString sql = wxEmptyString; if (entity->id() < 0) // new & insert { - sql = "INSERT INTO REPORT_V1(REPORTNAME, STATUS, GROUPNAME, CONTENTTYPE, CONTENT, TEMPLATEPATH) VALUES(?, ?, ?, ?, ?, ?)"; + sql = "INSERT INTO REPORT_V1(REPORTNAME, STATUS, GROUPNAME, SQLCONTENT, LUACONTENT, TEMPLATEPATH) VALUES(?, ?, ?, ?, ?, ?)"; } else { - sql = "UPDATE REPORT_V1 SET REPORTNAME = ?, STATUS = ?, GROUPNAME = ?, CONTENTTYPE = ?, CONTENT = ?, TEMPLATEPATH = ? WHERE REPORTID = ?"; + sql = "UPDATE REPORT_V1 SET REPORTNAME = ?, STATUS = ?, GROUPNAME = ?, SQLCONTENT = ?, LUACONTENT = ?, TEMPLATEPATH = ? WHERE REPORTID = ?"; } try @@ -330,8 +330,8 @@ stmt.Bind(1, entity->REPORTNAME); stmt.Bind(2, entity->STATUS); stmt.Bind(3, entity->GROUPNAME); - stmt.Bind(4, entity->CONTENTTYPE); - stmt.Bind(5, entity->CONTENT); + stmt.Bind(4, entity->SQLCONTENT); + stmt.Bind(5, entity->LUACONTENT); stmt.Bind(6, entity->TEMPLATEPATH); if (entity->id() > 0) stmt.Bind(7, entity->REPORTID); Modified: trunk/src/db/DB_Table_Setting_V1.h =================================================================== --- trunk/src/db/DB_Table_Setting_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Setting_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Splittransactions_V1.h =================================================================== --- trunk/src/db/DB_Table_Splittransactions_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Splittransactions_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Stock_V1.h =================================================================== --- trunk/src/db/DB_Table_Stock_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Stock_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/db/DB_Table_Subcategory_V1.h =================================================================== --- trunk/src/db/DB_Table_Subcategory_V1.h 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/db/DB_Table_Subcategory_V1.h 2013-12-20 12:27:11 UTC (rev 5653) @@ -10,7 +10,7 @@ * @brief * * Revision History: - * AUTO GENERATED at 2013-12-19 14:43:31.114225. + * AUTO GENERATED at 2013-12-20 20:07:33.623031. * DO NOT EDIT! */ //============================================================================= Modified: trunk/src/model/Model_Report.cpp =================================================================== --- trunk/src/model/Model_Report.cpp 2013-12-20 12:05:09 UTC (rev 5652) +++ trunk/src/model/Model_Report.cpp 2013-12-20 12:27:11 UTC (rev 5653) @@ -61,62 +61,55 @@ report("REPORTID") = r->REPORTID; report("REPORTNAME") = r->REPORTNAME; report("GROUPNAME") = r->GROUPNAME; - report("CONTENTTYPE") = r->CONTENTTYPE; - report("CONTENT") = r->CONTENT; + report("SQLCONTENTTYPE") = r->SQLCONTENT; + report("LUACONTENT") = r->LUACONTENT; report("TEMPLATEPATH") = r->TEMPLATEPATH; loop_t contents; - if (r->CONTENTTYPE == "LUA") + wxSQLite3Statement stmt = this->db_->PrepareStatement(r->SQLCONTENT); + wxLogDebug(stmt.GetSQL()); + if (!stmt.IsReadOnly()) { - // TODO + report("ERROR") = r->SQLCONTENT + " will modify database! aborted!"; } - else // (r->CONTENTTYPE == "SQL") + else { - wxSQLite3Statement stmt = this->db_->PrepareStatement(r->CONTENT); - wxLogDebug(stmt.GetSQL()); - if (!stmt.IsReadOnly()) + wxSQLite3ResultSet sqlQueryResult = stmt.ExecuteQuery(); + int columnCount = sqlQueryResult.GetColumnCount(); + + loop_t columns; + for (int i = 0; i < columnCount; ++ i) { - report("ERROR") = r->CONTENT + " will modify database! aborted!"; + row_t row; + row("COLUMN") = sqlQueryResult.GetColumnName(i); + + columns += row; } - else + report("COLUMNS") = columns; + + while (sqlQueryResult.NextRow()) { - wxSQLite3ResultSet sqlQueryResult = stmt.ExecuteQuery(); - int columnCount = sqlQueryResult.GetColumnCount(); - - loop_t columns; + row_t row; for (int i = 0; i < columnCount; ++ i) { - row_t row; - row("COLUMN") = sqlQueryResult.GetColumnName(i); - - columns += row; - } - report("COLUMNS") = columns; - - while (sqlQueryResult.NextRow()) - { - row_t row; - for (int i = 0; i < columnCount; ++ i) + wxString column_name = sqlQueryResult.GetColumnName(i); + switch (sqlQueryResult.GetColumnType(i)) { - wxString column_name = sqlQueryResult.GetColumnName(i); - switch (sqlQueryResult.GetColumnType(i)) - { - case WXSQLITE_INTEGER: - row(column_name.ToStdString()) = sqlQueryResult.GetInt(i); - break; - case WXSQLITE_FLOAT: - row(column_name.ToStdString()) = sqlQueryResult.GetDouble(i); - break; - default: - row(column_name.ToStdString()) = sqlQueryResult.GetAsString(i); - break; - } + case WXSQLITE_INTEGER: + row(column_name.ToStdString()) = sqlQueryResult.GetInt(i); + break; + case WXSQLITE_FLOAT: + row(column_name.ToStdString()) = sqlQueryResult.GetDouble(i); + break; + default: + row(column_name.ToStdString()) = sqlQueryResult.GetAsString(i); + break; } - contents += row; } - sqlQueryResult.Finalize(); + contents += row; } + sqlQueryResult.Finalize(); } report("CONTENTS") = contents; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |