xref: /netbsd-src/external/ibm-public/postfix/dist/proto/SQLITE_README.html (revision 76c7fc5f6b13ed0b1508e6b313e88e59977ed78e)
1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2        "http://www.w3.org/TR/html4/loose.dtd">
3
4<html>
5
6<head>
7
8<title>Postfix SQLite Howto</title>
9
10<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
11
12</head>
13
14<body>
15
16<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix SQLite Howto</h1>
17
18<hr>
19
20<h2>Introduction</h2>
21
22<p> The Postfix sqlite map type allows you to hook up Postfix to a
23SQLite database. This implementation allows for multiple sqlite
24databases: you can use one for a virtual(5) table, one for an
25access(5) table, and one for an aliases(5) table if you want.  </p>
26
27<h2>Building Postfix with SQLite support</h2>
28
29<p> The Postfix SQLite client utilizes the sqlite3 library,
30which can be obtained from: </p>
31
32<blockquote>
33    <p> http://www.sqlite.org/ </p>
34</blockquote>
35
36<p> In order to build Postfix with sqlite map support, you will
37need to add to CCARGS the flags -DHAS_SQLITE and -I with the directory
38containing the sqlite header files, and you will need to add to
39AUXLIBS the directory and name of the sqlite3 library, plus the
40name of the standard POSIX thread library (pthread).  For example:
41</p>
42
43<blockquote>
44<pre>
45make -f Makefile.init makefiles \
46     'CCARGS=-DHAS_SQLITE -I/usr/local/include' \
47     'AUXLIBS_SQLITE=-L/usr/local/lib -lsqlite3 -lpthread'
48</pre>
49</blockquote>
50
51<p> Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_SQLITE.
52With Postfix 3.0 and later, the old AUXLIBS variable still supports
53building a statically-loaded SQLite database client, but only the new
54AUXLIBS_SQLITE variable supports building a dynamically-loaded or
55statically-loaded SQLite database client.  </p>
56
57<blockquote>
58
59<p> Failure to use the AUXLIBS_SQLITE variable will defeat the purpose
60of dynamic database client loading. Every Postfix executable file
61will have SQLITE database library dependencies. And that was exactly
62what dynamic database client loading was meant to avoid. </p>
63
64</blockquote>
65
66<p> Then, just run 'make'.</p>
67
68<h2>Using SQLite tables</h2>
69
70<p> Once Postfix is built with sqlite support, you can specify a
71map type in main.cf like this: </p>
72
73<blockquote>
74<pre>
75alias_maps = sqlite:/etc/postfix/sqlite-aliases.cf
76</pre>
77</blockquote>
78
79<p> The file /etc/postfix/sqlite-aliases.cf specifies lots of
80information telling Postfix how to reference the sqlite database.
81For a complete description, see the sqlite_table(5) manual page. </p>
82
83<h2>Example: local aliases </h2>
84
85<pre>
86#
87# sqlite config file for local(8) aliases(5) lookups
88#
89
90# Path to database
91dbpath = /some/path/to/sqlite_database
92
93# See sqlite_table(5) for details.
94query = SELECT forw_addr FROM mxaliases WHERE alias='%s' AND status='paid'
95</pre>
96
97<h2>Additional notes</h2>
98
99<p> The SQLite configuration interface setup allows for multiple
100sqlite databases: you can use one for a virtual table, one for an
101access table, and one for an aliases table if you want. </p>
102
103<h2>Credits</h2>
104
105<p> SQLite support was added with Postfix version 2.8. </p>
106
107<ul>
108
109<li>Implementation by Axel Steiner</li>
110<li>Documentation by Jesus Garcia Crespo</li>
111
112</ul>
113
114</body>
115
116</html>
117