Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

16. File and Database Lookups > MySQL and PostgreSQL

MySQL and PostgreSQL

MySQL and PostgreSQL are open source database packages whose queries are expressed in the SQL language. Handling aliases using MySQL could be configured like this:

system_aliases:
  driver = aliasfile
  query = select mailbox from userdata \
          where id='${quote_mysql:$local_part}'
  search_type = mysql

For PostgreSQL, the configuration is identical, except that mysql is replaced by pgsql wherever it appears.

If the result of the query contains more than one field, the data for each field in the row is returned, preceded by its name, so the result of the following:

select home,name from userdata where id='ph10'

might be:

home=/home/ph10 name="Philip Hazel"

Values containing spaces and empty values are double-quoted, with embedded quotes escaped by backslash.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint