`memid` int(11) NOT NULL,
`domain` varchar(255) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `deleted` datetime DEFAULT NULL,
+ `modified` datetime NULL DEFAULT NULL,
+ `deleted` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `memid` (`memid`),
KEY `domain` (`domain`),
`id` int(11) NOT NULL AUTO_INCREMENT,
`memid` int(11) NOT NULL DEFAULT '0',
`email` varchar(255) NOT NULL DEFAULT '',
- `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `modified` datetime NULL DEFAULT NULL,
+ `deleted` datetime NULL DEFAULT NULL,
`hash` varchar(50) NOT NULL DEFAULT '',
`attempts` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
`csr_name` varchar(255) NOT NULL DEFAULT '',
`csr_type` enum('CSR', 'SPKAC') NOT NULL,
`crt_name` varchar(255) NOT NULL DEFAULT '',
- `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `revoked` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `expire` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `created` timestamp NULL DEFAULT NULL,
+ `modified` datetime NULL DEFAULT NULL,
+ `revoked` datetime NULL DEFAULT NULL,
+ `expire` datetime NULL DEFAULT NULL,
`renewed` tinyint(1) NOT NULL DEFAULT '0',
`disablelogin` int(1) NOT NULL DEFAULT '0',
`pkhash` char(40) DEFAULT NULL,
`location` varchar(255) NOT NULL DEFAULT '',
`date` varchar(255) NOT NULL DEFAULT '',
# date when assurance was entered
- `when` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `when` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
#?
- `expire` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `expire` datetime NULL DEFAULT NULL,
#?????????????????
`sponsor` int(11) NOT NULL DEFAULT '0',
# date when assurance was deleted (or 0)
- `deleted` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `deleted` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `from` (`from`),
KEY `to` (`to`),
private String hash = null;
private EmailAddress(int id) {
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT memid, email, hash FROM `emails` WHERE id=? AND deleted=0");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT memid, email, hash FROM `emails` WHERE id=? AND deleted is NULL");
ps.setInt(1, id);
GigiResultSet rs = ps.executeQuery();
}
public int getAssurancePoints() {
- GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("SELECT sum(points) FROM `notary` where `to`=? AND `deleted`=0");
+ GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("SELECT sum(points) FROM `notary` where `to`=? AND `deleted` is NULL");
query.setInt(1, getId());
GigiResultSet rs = query.executeQuery();
int points = 0;
}
public int getExperiencePoints() {
- GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("SELECT count(*) FROM `notary` where `from`=? AND `deleted`=0");
+ GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("SELECT count(*) FROM `notary` where `from`=? AND `deleted` is NULL");
query.setInt(1, getId());
GigiResultSet rs = query.executeQuery();
int points = 0;
}
public EmailAddress[] getEmails() {
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT id FROM emails WHERE memid=? AND deleted=0");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT id FROM emails WHERE memid=? AND deleted is NULL");
ps.setInt(1, getId());
GigiResultSet rs = ps.executeQuery();
rs.last();
}
public Certificate[] getCertificates() {
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT serial FROM certs WHERE memid=? AND revoked=0");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT serial FROM certs WHERE memid=? AND revoked IS NULL");
ps.setInt(1, getId());
GigiResultSet rs = ps.executeQuery();
rs.last();
public Assurance[] getReceivedAssurances() {
if (receivedAssurances == null) {
- GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("SELECT * FROM notary WHERE `to`=? AND deleted=0");
+ GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("SELECT * FROM notary WHERE `to`=? AND deleted IS NULL");
query.setInt(1, getId());
GigiResultSet res = query.executeQuery();
res.last();
public Assurance[] getMadeAssurances() {
if (madeAssurances == null) {
- GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("SELECT * FROM notary WHERE `from`=? AND deleted=0");
+ GigiPreparedStatement query = DatabaseConnection.getInstance().prepare("SELECT * FROM notary WHERE `from`=? AND deleted is NULL");
query.setInt(1, getId());
GigiResultSet res = query.executeQuery();
res.last();
private void tryAuthWithCertificate(HttpServletRequest req, X509Certificate x509Certificate) {
String serial = x509Certificate.getSerialNumber().toString(16).toUpperCase();
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `memid` FROM `certs` WHERE `serial`=? AND `disablelogin`='0' AND `revoked` = '0000-00-00 00:00:00'");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `memid` FROM `certs` WHERE `serial`=? AND `disablelogin`='0' AND `revoked` is NULL");
ps.setString(1, serial);
GigiResultSet rs = ps.executeQuery();
if (rs.next()) {
if (isFailed(out)) {
return false;
}
- GigiPreparedStatement q1 = DatabaseConnection.getInstance().prepare("select * from `emails` where `email`=? and `deleted`=0");
- GigiPreparedStatement q2 = DatabaseConnection.getInstance().prepare("select * from certOwners inner join users on users.id=certOwners.id where `email`=? and `deleted`=0");
+ GigiPreparedStatement q1 = DatabaseConnection.getInstance().prepare("select * from `emails` where `email`=? and `deleted` IS NULL");
+ GigiPreparedStatement q2 = DatabaseConnection.getInstance().prepare("select * from certOwners inner join users on users.id=certOwners.id where `email`=? and `deleted` IS NULL");
q1.setString(1, buildup.getEmail());
q2.setString(1, buildup.getEmail());
GigiResultSet r1 = q1.executeQuery();
if (assurer.getId() == target.getId()) {
throw new GigiApiException("You cannot assure yourself.");
}
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT 1 FROM `notary` where `to`=? and `from`=? AND `deleted`=0");
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT 1 FROM `notary` where `to`=? and `from`=? AND `deleted` IS NULL");
ps.setInt(1, target.getId());
ps.setInt(2, assurer.getId());
GigiResultSet rs = ps.executeQuery();