//--------------------------------------------------------------------------- Table *Database::OpenTable(char *TableName, char *IdxName, BOOL Create, BOOL Cached) //char *tablefn, char*indexfn, BOOL create) { Table *table = new Table(TableName, IdxName, Create, this, Cached); if (table) { if (table->Open()) return table; table->Close(); delete table; } return NULL; }
MailReaderFrame::MailReaderFrame() { { #if 0 { Table accounts; accounts.Open("C:\\accounts", "a+b"); accounts.Append(); accounts.AddField(OLESTR("ID"), FieldDef::FTyp_Long); accounts.AddField(OLESTR("Server"), FieldDef::FTyp_VarString); accounts.AddField(OLESTR("Username"), FieldDef::FTyp_VarString); accounts.AddField(OLESTR("Password"), FieldDef::FTyp_VarString); Record* pRecord = accounts.NewRecord(); pRecord->m_fields[0]->u.int32 = 1; pRecord->m_fields[1]->SetData("pop.bredband.no"); pRecord->m_fields[2]->SetData("sigler"); pRecord->m_fields[3]->SetData("04bi1u6"); pRecord->Write(&accounts); accounts.Close(); } #endif #if 0 { Table accounts; accounts.Open("C:\\news_accounts", "a+b"); accounts.Append(); accounts.AddField(OLESTR("ID"), FieldDef::FTyp_Long); accounts.AddField(OLESTR("Server"), FieldDef::FTyp_VarString); // accounts.AddField(OLESTR("Username"), FieldDef::FTyp_VarString); // accounts.AddField(OLESTR("Password"), FieldDef::FTyp_VarString); Record* pRecord = accounts.NewRecord(); pRecord->m_fields[0]->u.int32 = 1; pRecord->m_fields[1]->SetData("freetext.usenetserver.com"); // pRecord->m_fields[2]->SetData("sigler"); // pRecord->m_fields[3]->SetData("04bi1u6"); pRecord->Write(&accounts); accounts.Close(); } #endif #if 0 { Table* pTable = new Table; pTable->AddField(OLESTR("ID"), FieldDef::FTyp_Long); pTable->AddField(OLESTR("Subject"), FieldDef::FTyp_VarString); pTable->AddField(OLESTR("From"), FieldDef::FTyp_VarString); pTable->AddField(OLESTR("Headers"), FieldDef::FTyp_VarString); pTable->AddField(OLESTR("Content"), FieldDef::FTyp_VarString); pTable->AddField(OLESTR("Sent"), FieldDef::FTyp_ShortDate); pTable->AddField(OLESTR("Received"), FieldDef::FTyp_ShortDate); pTable->AddField(OLESTR("Account"), FieldDef::FTyp_Long); pTable->Open("C:\\mail", "a+b"); pTable->Append(); Table accounts; accounts.Open("C:\\accounts", "rb"); int count = accounts.GetCount(); for (int i = 0; i < count; i++) { Record* pRecord = accounts.GetRecord(i); Field* Server = pRecord->m_fields[1]; Field* Username = pRecord->m_fields[2]; Field* Password = pRecord->m_fields[3]; MailAccount account; account.m_ID = pRecord->m_fields[0]->u.int32; account.m_server = std::string((char*)Server->GetData(), Server->GetSize()); account.m_username = std::string((char*)Username->GetData(), Username->GetSize()); account.m_password = std::string((char*)Password->GetData(), Password->GetSize()); account.GetNewMail(pTable); } pTable->Close(); } #endif #if 0 { Table accounts; accounts.Open("C:\\news_accounts", "rb"); /* int count = accounts.GetCount(); for (int i = 0; i < count; i++) { */ Record* pRecord = accounts.GetRecord(0); Field* Server = pRecord->m_fields[1]; // Field* Username = pRecord->m_fields[2]; // Field* Password = pRecord->m_fields[3]; NewsAccount account; // account.m_ID = pRecord->m_fields[0]->u.int32; account.m_server = std::string((char*)Server->GetData(), Server->GetSize()); // account.m_username = std::string((char*)Username->GetData(), Username->GetSize()); // account.m_password = std::string((char*)Password->GetData(), Password->GetSize()); { account.m_list = new Table; account.m_list->Open("C:\\newsgroups", "a+b"); account.m_list->Append(); account.m_list->AddField(OLESTR("ID"), FieldDef::FTyp_Long); account.m_list->AddField(OLESTR("Group"), FieldDef::FTyp_VarString); } account.Connect(); // account.GetList(); account.Quit(); { account.m_list->Close(); } // } } #endif } { CView* view = new CView(0, L"Text"); //m_uiManager->FindMenu(_Module.GetResourceInstance(), IDR_XMLLAYOUTVIEW, &view->m_menu); m_xmlDocumentWorkspace.m_views.Add(view); } { CDocumentSheet* pSheet = new CDocumentSheet; pSheet->m_views.Add(m_xmlDocumentWorkspace.m_views[0]); m_xmlDocumentWorkspace.m_views[0]->m_ownerSheet = pSheet; m_xmlDocumentWorkspace.m_documentsSheets.Add(pSheet); } pCanvas = new ChildWindowContainer; #if 0 { ITable* m_table = OpenTable("C:\\accounts", "rb"); ViewTable(m_table); } { ITable* m_table = OpenTable("C:\\news_accounts", "rb"); ViewTable(m_table); } #endif #if 1 Database db("C:\\db", "rb"); { Table m_table = db.GetTable(OLESTR("classes")); ViewTable(m_table); } { Table m_table = db.GetTable(OLESTR("classbases")); ViewTable(m_table); } { Table table; table = db.Execute("SELECT ID, Derived, Base, Name FROM classes, classbases WHERE Name=\"AsyncIAdviseSink2\" AND ID=Derived"); // ITable* table = Execute("DELETE FROM classes WHERE Name=\"test\""); if (table != NULL) { ViewTable(table); } } #endif #if 0 { Table* m_table = new Table; m_table->Open("C:\\mail", "rb"); ViewTable(m_table); } { Table* m_table = new Table; m_table->Open("C:\\newsgroups", "rb"); ViewTable(m_table); } #endif #if 0 { m_text = new TextEdit; m_text->set_textDocument(new TextDocument()); ChildWindow* pWindow = new ChildWindow; pWindow->set_Width(new Length(200, Length::UnitAbsolute)); pWindow->set_Height(new Length(200, Length::UnitAbsolute)); ScrollViewer* pScroller = new ScrollViewer; { pScroller->set_Content(m_text); } pWindow->set_Content(pScroller); pWindow->set_TitleText(OLESTR("www.bredband.no")); pCanvas->AddChild(pWindow); } #endif set_Width(Length(1300)); set_Height(Length(1000)); set_Content(pCanvas); }