Log.java
2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* @(#)Log.java 1.4.4,26 custom 26/05/2010
*
* Built automatically by REVERSER
*/
package it.softecspa.fileproxy.db;
import it.softecspa.database.dbconnect.ConnectionManager;
import it.softecspa.database.dbconnect.DatabaseStatement;
import it.softecspa.database.dbconnect.NoRecordFoundException;
import it.softecspa.database.dbconnect.Query;
import it.softecspa.fileproxy.db.criterias.LogCriteria;
import it.softecspa.kahuna.sql.SqlWriter;
import java.sql.SQLException;
/**
* Customizable manager for table T000_LOG
* Class auto generated by REVERSER, version 1.4.4,26 custom
*
* @author il Vera
*/
public class Log extends it.softecspa.fileproxy.db.skins.LogSkin {
private static final UpdateType FLUSH = new UpdateType();
private static final UpdateType DELETE_BEFORE = new UpdateType();
public Log() {
super();
lockAutoincrementRetrieves=true;
}
/**
* Extract bean using key
*/
public Log(ConnectionManager cm, Integer id) throws NoRecordFoundException, SQLException {
super(cm, id);
}
/**
* Execute select * with criteria
* @throws SQLException if there is an error in your query
*/
public static Log[] select(LogCriteria criteria) throws SQLException {
SqlWriter sql = criteria.getSelect();
return (Log[])(new Log()).getRows(criteria.getConnectionManager(), sql.costruisciSelect());
}
/**
* Customizable update method
* @param updateType operation to execute
* @param dbs DatabaseStatement that perform operation
* @return number of update rows or new autoincrement id
* @throws SQLException if there is an error in your query
*/
public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException {
if (updateType == DELETE_BEFORE) {
SqlWriter sql = new SqlWriter();
sql.setTables(NAME);
sql.addWhere("d_record <= " + Query.toSQLDateTime(record));
return dbs.execute(sql.costruisciDelete());
}
if (updateType == FLUSH) {
return dbs.execute("TRUNCATE TABLE "+NAME);
}
// Insert here your custom code
return super.updateRecord(updateType, dbs);
}
public int deleteBefore(ConnectionManager cm) throws SQLException {
return updateRecord(cm, DELETE_BEFORE);
}
public static int flush(ConnectionManager cm) throws SQLException {
Log log = new Log();
return log.updateRecord(cm, FLUSH);
}
}