lithium3

Check-in [c4f1cd36e1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:lithium-access_log: update the main table to refer to the string tables
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c4f1cd36e18b3c2ff4566e3d5605dc0e8d595b41
User & Date: nat 2017-01-26 20:46:00
Context
2017-05-29
21:39
lithium-dispatchers: make the new text replacement filter available check-in: 0106e2c1b7 user: nat tags: trunk
2017-01-26
20:46
lithium-access_log: update the main table to refer to the string tables check-in: c4f1cd36e1 user: nat tags: trunk
2017-01-25
20:18
lithium-access_log: insert string values into the dedicated tables check-in: 16ac076d4f user: nat tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/lithium-access_log.adb.

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













93
94
95
96
97
98
99

   SQLite_Error : exception;

   package Log_Queue is new Ada.Containers.Doubly_Linked_Lists (Log_Entry);

   Create_SQL : constant String := "CREATE TABLE IF NOT EXISTS access ("
     & "time NOT NULL DEFAULT CURRENT_TIMESTAMP, "
     & "peer_name TEXT, "
     & "method TEXT, "
     & "path TEXT, "
     & "http_version TEXT, "
     & "status_code INTEGER, "
     & "bytes INTEGER, "
     & "referrer TEXT, "
     & "user_agent TEXT, "
     & "cookies TEXT, "
     & "build_time REAL, "
     & "export_time REAL, "
     & "host TEXT, "
     & "real_ip TEXT, "
     & "forwarded_for TEXT);";











   Insert_SQL : constant String := "INSERT INTO access "
     & "(peer_name, method, path, http_version, status_code, bytes, referrer, "
     & "user_agent, cookies, build_time, export_time, "
     & "host, real_ip, forwarded_for) "
     & "VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14);";














   procedure Bind
     (Stmt : in out SQLite3.SQLite3_Statement;
      Values : in Log_Entry);
      --  Bind a log entry to the main insert statement

   procedure Bind







|
|
|
|


|
|
|


|
|
|
>
>
>
>
>
>
>
>
>
>





|
>
>
>
>
>
>
>
>
>
>
>
>
>







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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

   SQLite_Error : exception;

   package Log_Queue is new Ada.Containers.Doubly_Linked_Lists (Log_Entry);

   Create_SQL : constant String := "CREATE TABLE IF NOT EXISTS access ("
     & "time NOT NULL DEFAULT CURRENT_TIMESTAMP, "
     & "peer_name INTEGER, "
     & "method INTEGER, "
     & "path INTEGER, "
     & "http_version INTEGER, "
     & "status_code INTEGER, "
     & "bytes INTEGER, "
     & "referrer INTEGER, "
     & "user_agent INTEGER, "
     & "cookies INTEGER, "
     & "build_time REAL, "
     & "export_time REAL, "
     & "host INTEGER, "
     & "real_ip INTEGER, "
     & "forwarded_for INTEGER, "
     & "FOREIGN KEY (peer_name) REFERENCES peer_names(rowid), "
     & "FOREIGN KEY (method) REFERENCES methods(rowid), "
     & "FOREIGN KEY (path) REFERENCES paths(rowid), "
     & "FOREIGN KEY (http_version) REFERENCES http_versions(rowid), "
     & "FOREIGN KEY (referrer) REFERENCES referrers(rowid), "
     & "FOREIGN KEY (user_agent) REFERENCES user_agents(rowid), "
     & "FOREIGN KEY (cookies) REFERENCES cookies(rowid), "
     & "FOREIGN KEY (host) REFERENCES hosts(rowid), "
     & "FOREIGN KEY (real_ip) REFERENCES real_ips(rowid), "
     & "FOREIGN KEY (forwarded_for) REFERENCES forwarded_fors(rowid));";

   Insert_SQL : constant String := "INSERT INTO access "
     & "(peer_name, method, path, http_version, status_code, bytes, referrer, "
     & "user_agent, cookies, build_time, export_time, "
     & "host, real_ip, forwarded_for) "
     & "VALUES ("
     & "(SELECT rowid FROM peer_names WHERE value = ?1),"
     & "(SELECT rowid FROM methods WHERE value = ?2),"
     & "(SELECT rowid FROM paths WHERE value = ?3),"
     & "(SELECT rowid FROM http_versions WHERE value = ?4),"
     & "?5, ?6, "
     & "(SELECT rowid FROM referrers WHERE value = ?7),"
     & "(SELECT rowid FROM user_agents WHERE value = ?8),"
     & "(SELECT rowid FROM cookies WHERE value = ?9),"
     & "?10, ?11, "
     & "(SELECT rowid FROM hosts WHERE value = ?12),"
     & "(SELECT rowid FROM real_ips WHERE value = ?13),"
     & "(SELECT rowid FROM forwarded_fors WHERE value = ?14)"
     & ");";

   procedure Bind
     (Stmt : in out SQLite3.SQLite3_Statement;
      Values : in Log_Entry);
      --  Bind a log entry to the main insert statement

   procedure Bind