Commit fe5d7417 authored by 9731301's avatar 9731301

add PicsEntity to addPics url in database

parent 1e1d10e3
......@@ -19,12 +19,12 @@ public interface DateNoreDAO {
@Insert
void insertDateNote(DateEntity dateEntity);
//delete data in database
@Delete
void deleteDateNote(DateEntity dateEntity);
@Update
void updateDateNote(DateEntity dateEntity);
//update data
@Query("UPDATE DateEntity SET date = :date , description = :description ,archived = :isarchived Where ID = :id")
void updateDate(String date , String description , boolean isarchived , int id);
}
......@@ -8,4 +8,5 @@ public abstract class NoteDataBase extends RoomDatabase {
public abstract NoteDAO noteDao();
public abstract DateNoreDAO dateNoreDAO();
public abstract PicsDao picsDao();
}
package com.example.mynotepad.MenuFeatures.AllNotes.DataBase;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import java.util.List;
public interface PicsDao {
// a method list type
@Query("SELECT * FROM PicsEntity")
List<DateEntity> getAllPicsNotes();
//insert data in database
@Insert
void insertPicsNote(PicsEntity picsEntity);
//delete data in database
@Delete
void deletePicsNote(DateEntity dateEntity);
//update data
@Query("UPDATE PicsEntity SET txt = :txt , url = :url ")
void updateDate(String txt , String url);
}
package com.example.mynotepad.MenuFeatures.AllNotes.DataBase;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
@Entity
public class PicsEntity {
@ColumnInfo(name = "url")
String url ;
@ColumnInfo(name = "txt")
String txt;
public PicsEntity(String url, String txt) {
this.url = url;
this.txt = txt;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getTxt() {
return txt;
}
public void setTxt(String txt) {
this.txt = txt;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment