예제 #1
0
bool DatabaseForm::AddItemToDatabase(DatabaseItem* newItem)
{

	String        notesString(L"very empty");
	Database      pDatabase;
	DbStatement*  pStmt;
	DbEnumerator* pEnum;
	String        statement;
	result        r = E_SUCCESS;

	pDatabase.BeginTransaction();

	// Prepare the INSERT statement
	statement.Append(L"INSERT INTO movies(description) VALUES (?, ?)");
	pStmt = pDatabase.CreateStatementN(statement);

   // Bind the values from the current entry into this statement
	pStmt->BindString(0, newItem->__description);

	// Now execute the statement with our values included
	pEnum = pDatabase.ExecuteStatementN(*pStmt);
	pDatabase.CommitTransaction();

	delete pEnum;
	delete pStmt;
	return true;
}
예제 #2
0
void
ProfileListForm::SaveUsingmodeProfile(Tizen::Base::String title,
		int year,
		int month,
		int day,
		int hour,
		int minute,
		int year2,
		int month2,
		int day2,
		int hour2,
		int minute2,
		double latitude,
		double longitude,
		int volume,
		int wifi,
		Tizen::Base::String memo)
{
	AppLog("%s, %s", title.GetPointer(), memo.GetPointer());

    DbStatement* pStmt;
    DbEnumerator* pEnum;
    long long id;

    Tizen::System::SystemTime::GetTicks(id);
    __pProfileDatabase->BeginTransaction();

    if (__isUpdateMode) {
        pStmt = __pProfileDatabase->CreateStatementN(L"UPDATE profile SET title = ?, "
        		"year = ?, month = ?, day = ?, hour = ?, minute = ?, "
        		"year2 = ?, month2 = ?, day2 = ?, hour2 = ?, minute2 = ?, "
        		"latitude = ?, longitude = ?, volume = ?, wifi = ?, memo = ? WHERE id = ?");
        pStmt->BindString(0, title);
        pStmt->BindInt(1, year);
        pStmt->BindInt(2, month);
        pStmt->BindInt(3, day);
        pStmt->BindInt(4, hour);
        pStmt->BindInt(5, minute);
        pStmt->BindInt(6, year);
        pStmt->BindInt(7, month);
        pStmt->BindInt(8, day);
        pStmt->BindInt(9, hour);
        pStmt->BindInt(10, minute);
        pStmt->BindDouble(11, latitude);
        pStmt->BindDouble(12, longitude);
        pStmt->BindInt(13, volume);
        pStmt->BindInt(14, wifi);
        pStmt->BindString(15, memo);
        Integer* itemId = static_cast<Integer*>(__pIndexList.GetAt(__currentIndex));
        pStmt->BindInt(16, itemId->ToInt());
        __isUpdateMode = false;
    } else {
        AppLog("Normal Save");
        pStmt = __pProfileDatabase->CreateStatementN(L"INSERT INTO profile (id, title, "
        		"year, month, day, hour, minute, "
        		"year2, month2, day2, hour2, minute2, "
        				"latitude, longitude, volume, wifi, memo) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
        pStmt->BindInt(0, id);
        pStmt->BindString(1, title);
        pStmt->BindInt(2, year);
        pStmt->BindInt(3, month);
        pStmt->BindInt(4, day);
        pStmt->BindInt(5, hour);
        pStmt->BindInt(6, minute);
        pStmt->BindInt(7, year2);
        pStmt->BindInt(8, month2);
        pStmt->BindInt(9, day2);
        pStmt->BindInt(10, hour2);
        pStmt->BindInt(11, minute2);
        pStmt->BindDouble(12, latitude);
        pStmt->BindDouble(13, longitude);
        pStmt->BindInt(14, volume);
        pStmt->BindInt(15, wifi);
        pStmt->BindString(16, memo);
    }
    pEnum = __pProfileDatabase->ExecuteStatementN(*pStmt);
    __pProfileDatabase->CommitTransaction();

    delete pStmt;
    delete pEnum;
    ListUpdate();
}
예제 #3
0
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;
	}
}