Renamed 'use' database column as that is a keyword in MySQL.

Reported by Stefan Tomas.
This commit is contained in:
Tobias Brunner 2011-09-01 09:57:03 +02:00
parent d0e1b237be
commit f35578acb1
3 changed files with 10 additions and 10 deletions

View File

@ -53,7 +53,7 @@ METHOD(simaka_provider_t, get_triplet, bool,
snprintf(buf, sizeof(buf), "%Y", id);
query = this->db->query(this->db,
"select rand, sres, kc from triplets where id = ? order by use",
"select rand, sres, kc from triplets where id = ? order by used",
DB_TEXT, buf, DB_BLOB, DB_BLOB, DB_BLOB);
if (query)
{
@ -82,7 +82,7 @@ METHOD(simaka_provider_t, get_triplet, bool,
else
{
this->db->execute(this->db, NULL,
"update triplets set use = ? where id = ? and rand = ?",
"update triplets set used = ? where id = ? and rand = ?",
DB_UINT, time(NULL), DB_TEXT, buf,
DB_BLOB, chunk_create(rand, SIM_RAND_LEN));
}
@ -102,7 +102,7 @@ METHOD(simaka_provider_t, get_quintuplet, bool,
snprintf(buf, sizeof(buf), "%Y", id);
query = this->db->query(this->db, "select rand, res, ck, ik, autn "
"from quintuplets where id = ? order by use", DB_TEXT, buf,
"from quintuplets where id = ? order by used", DB_TEXT, buf,
DB_BLOB, DB_BLOB, DB_BLOB, DB_BLOB, DB_BLOB);
if (query)
{
@ -137,7 +137,7 @@ METHOD(simaka_provider_t, get_quintuplet, bool,
else
{
this->db->execute(this->db, NULL,
"update quintuplets set use = ? where id = ? and rand = ?",
"update quintuplets set used = ? where id = ? and rand = ?",
DB_UINT, time(NULL), DB_TEXT, buf,
DB_BLOB, chunk_create(rand, AKA_RAND_LEN));
}

View File

@ -1,7 +1,7 @@
DROP TABLE IF EXISTS triplets;
CREATE TABLE triplets (
id TEXT NOT NULL,
use INTEGER NOT NULL,
used INTEGER NOT NULL,
rand BLOB NOT NULL,
sres BLOB NOT NULL,
kc BLOB NOT NULL
@ -10,7 +10,7 @@ CREATE TABLE triplets (
DROP TABLE IF EXISTS quintuplets;
CREATE TABLE quintuplets (
id TEXT NOT NULL,
use INTEGER NOT NULL,
used INTEGER NOT NULL,
rand BLOB NOT NULL,
autn BLOB NOT NULL,
ck BLOB NOT NULL,

View File

@ -2,23 +2,23 @@ DELETE FROM triplets;
DELETE FROM quintuplets;
INSERT INTO triplets
(id, use, rand, sres, kc) VALUES
(id, used, rand, sres, kc) VALUES
('moon@strongswan.org', 0,
X'00112233445566778899AABBCCDDEEFF', X'01234567', X'0123456789ABCDEF'
);
INSERT INTO triplets
(id, use, rand, sres, kc) VALUES
(id, used, rand, sres, kc) VALUES
('moon@strongswan.org', 0,
X'112233445566778899AABBCCDDEEFF00', X'12345678', X'123456789ABCDEF0'
);
INSERT INTO triplets
(id, use, rand, sres, kc) VALUES
(id, used, rand, sres, kc) VALUES
('moon@strongswan.org', 0,
X'2233445566778899AABBCCDDEEFF0011', X'23456789', X'23456789ABCDEF01'
);
INSERT INTO quintuplets
(id, use, rand, autn, ck, ik, res) VALUES
(id, used, rand, autn, ck, ik, res) VALUES
('moon@strongswan.org', 0,
X'00112233445566778899AABBCCDDEEFF',
X'112233445566778899AABBCCDDEEFF00',