void ProfileListForm::ListUpdate(void) { int id; String title; __pTitleList.RemoveAll(true); __pIndexList.RemoveAll(true); DbEnumerator* pEnum; pEnum = __pProfileDatabase->QueryN(L"SELECT id, title FROM profile"); if (pEnum) { while(pEnum->MoveNext() == E_SUCCESS) { pEnum->GetIntAt(0, id); pEnum->GetStringAt(1, title); __pIndexList.Add(new Integer(id)); __pTitleList.Add(new String(title)); } delete pEnum; } __pProfileListView->UpdateList(); Draw(); Show(); }
void DatabaseForm::ReadItemsFromDatabase() { Database pDatabase; DbEnumerator* pEnum; String sql; String statement; result r = E_SUCCESS; r = pDatabase.Construct(__databaseName, false); sql.Append(L"select id, description from movies"); pEnum = pDatabase.QueryN(sql); String description; int id; while( pEnum->MoveNext()== E_SUCCESS ) { pEnum->GetIntAt(0, id); pEnum->GetStringAt(1, description); // Store the item in our data structure DatabaseItem* newItem = new DatabaseItem(description); newItem->SetIndex(id); // Display the item in our user interface using our own method AddItemToList(newItem); } if (pEnum != null) delete pEnum; }
void ProfileListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status) { if (status == LIST_ITEM_STATUS_SELECTED) { AppLog("OnListViewItemLongPressed.2222"); SceneManager* pSceneManager = SceneManager::GetInstance(); AppAssert(pSceneManager); ArrayList* pList = new (std::nothrow) ArrayList(); pList->Construct(); result r= E_SUCCESS; __currentIndex = index; DbEnumerator* pEnum; DbStatement* pStmt; pStmt = __pProfileDatabase->CreateStatementN(L"SELECT title, " "year, month, day, hour, minute, " "year2, month2, day2, hour2, minute,2 " "latitude, longitude, volume, wifi, memo FROM profile WHERE id = ?"); Integer* itemId = static_cast<Integer*>(__pIndexList.GetAt(index)); pList->Add(*new (std::nothrow) Integer(index/**itemId*/)); r = pStmt->BindInt(0, itemId->ToInt()); pEnum = __pProfileDatabase->ExecuteStatementN(*pStmt); if (pEnum) { String title; pEnum->MoveNext(); r = pEnum->GetStringAt(0, title); pList->Add(*new (std::nothrow) String(title)); int intItem; double item; r = pEnum->GetIntAt(1, intItem); //year pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(2, intItem); //month pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(3, intItem); //day pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(4, intItem); //hour pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(5, intItem); //minute pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(6, intItem); //year2 pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(7, intItem); //month2 pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(8, intItem); //day2 pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(9, intItem); //hour2 pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(10, intItem); //minute2 pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetDoubleAt(11, item); //latitude pList->Add(*new (std::nothrow) Double(item)); r = pEnum->GetDoubleAt(12, item); //longitude pList->Add(*new (std::nothrow) Double(item)); r = pEnum->GetIntAt(13, intItem); //volume pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetIntAt(14, intItem); //wifi pList->Add(*new (std::nothrow) Integer(intItem)); r = pEnum->GetStringAt(15, title); //memo pList->Add(*new (std::nothrow) String(title)); delete pEnum; } delete pStmt; pSceneManager->GoForward(ForwardSceneTransition(SCENE_DETAIL), pList); __isUpdateMode = true; } }