Commit 13052025
Old Photo Deleter .
This commit is contained in:
@@ -40,13 +40,32 @@ public class Sqlite {
|
||||
*/
|
||||
public void Insert(PhotoReviewClass pr){
|
||||
if (pr!=null){
|
||||
// System.out.println("Inserting PhotoReviewClass");
|
||||
// System.out.println(pr);
|
||||
Insert(pr.getPrefix(), pr.getFileLeft90(), pr.getFileLeft45(), pr.getFileCenter(), pr.getFileRight45(), pr.getFileRight90(), pr.getThumbLeft90(), pr.getThumbLeft45(), pr.getThumbCenter(), pr.getThumbRight45(), pr.getThumbRight90());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete PhotoReviewClass object from database
|
||||
* @param pr PhotoReviewClass objects
|
||||
*/
|
||||
public void Delete(PhotoReviewClass... pr){
|
||||
if (pr!=null && pr.length>0){
|
||||
try{
|
||||
Connection conn = GetConnection();
|
||||
if (conn != null){
|
||||
for (PhotoReviewClass photo : pr) {
|
||||
PreparedStatement stmt = conn.prepareStatement("DELETE FROM photos WHERE id = ?");
|
||||
stmt.setInt(1, photo.getId());
|
||||
stmt.execute();
|
||||
}
|
||||
conn.close();
|
||||
Logger.info("Data deleted successfully");
|
||||
} else Logger.info("Delete failed, connection is null");
|
||||
} catch (Exception e){
|
||||
Logger.error("Error deleting data: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all PhotoReviewClass object from database
|
||||
@@ -108,14 +127,6 @@ public class Sqlite {
|
||||
try{
|
||||
Connection conn = GetConnection();
|
||||
if (conn != null){
|
||||
// System.out.println("Inserting data");
|
||||
// System.out.println("prefix: "+prefix);
|
||||
// System.out.println("fileLeft90: "+fileLeft90);
|
||||
// System.out.println("fileLeft45: "+fileLeft45);
|
||||
// System.out.println("fileCenter: "+fileCenter);
|
||||
// System.out.println("fileRight45: "+fileRight45);
|
||||
// System.out.println("fileRight90: "+fileRight90);
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement("INSERT INTO photos (DateTime, Prefix, FileLeft90, FileLeft45, FileCenter, FileRight45, FileRight90, ThumbLeft90, ThumbLeft45, ThumbCenter, ThumbRight45, ThumbRight90 ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
stmt.setString(1, LocalDateTimeToString(LocalDateTime.now()));
|
||||
stmt.setString(2, ValidString(prefix)?prefix:"");
|
||||
|
||||
Reference in New Issue
Block a user