diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-11-17 21:56:18 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-11-17 21:56:18 +0100 |
commit | 014a6394e4268ee698f02aede381acc772abd20d (patch) | |
tree | 6fb631fbdf6f36cf749f151b7b7fcdf028fa4ea4 | |
parent | 0e19f080df49504d78fd6c9a2ce91b8819255818 (diff) |
Read user lines from database.
-rw-r--r-- | pg.pgc | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -252,7 +252,7 @@ void pg_users_get(int channel) { EXEC SQL BEGIN DECLARE SECTION; int channel_id = channel; VARCHAR nick[0x100]; - int id = 0, words, characters, kicks, kicked, monolog_lines, monologs, seen_first, seen_last; + int id = 0, words, characters, kicks, kicked, monolog_lines, monologs, seen_first, seen_last, index, lines; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE usercursor CURSOR FOR SELECT id, nick, words, characters, kicks, kicked, monolog_lines, monologs, seen_first, seen_last @@ -275,6 +275,22 @@ void pg_users_get(int channel) { user->monologs = monologs; user->seen_first = seen_first; user->seen_last = seen_last; + + EXEC SQL DECLARE userlinescursor CURSOR FOR SELECT time_index, lines FROM user_hours WHERE user_id = :id; + EXEC SQL OPEN userlinescursor; + EXEC SQL FETCH NEXT FROM userlinescursor INTO :index, :lines; + + if(iserror()) + goto pg_userlines_error; + + do { + user->lines[index] = lines; + EXEC SQL FETCH NEXT FROM userlinescursor INTO :index, :lines; + } while(!iserror()); + +pg_userlines_error: + EXEC SQL CLOSE userlinescursor; + EXEC SQL FETCH NEXT FROM usercursor INTO :id, :nick, :words, :characters, :kicks, :kicked, :monolog_lines, :monologs, :seen_first, :seen_last; } while(!iserror()); |