Ejemplo n.º 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;
}
Ejemplo n.º 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();
}