[Dovecot] MySQL, map files
I'll try and break up my questions the other day about extdata that went unanswered into pieces in the hopes it will be more specific and clear.
In general, I am trying to figure out the syntax of the map statement and what is allowed in that statement. So, by map statement, I mean for example perhaps the dovecot-dict-expire.conf.ext file as shown in the doc. Is the syntax the same for the various types of files (quota vs expire)? Is there syntax to allow the specification of a different key? If so, where is this documented. I have an existing table I want to use, not the table shown in the doc.
The reason I am asking is I have seen web pages that reference all sorts of statements within the map statement, and I have no idea where they are documented. Specifically, I see an example here (which is LDAP), look in section 3:
http://dovecot.org/patches/1.2/ldap/HOWTO_dictldap+extdata.txt
You will see lots of statements, not sure which ones can be used for MySQL (instead of LDAP). So, would like to find a list of ALL valid syntax within the map.
----- Original Message -----
From: Steve Fatula <compconsultant@yahoo.com> To: Dovecot List <dovecot@dovecot.org> Cc: Sent: Thursday, September 8, 2011 6:52 PM Subject: [Dovecot] MySQL, map files
I'll try and break up my questions the other day about extdata that went unanswered into pieces in the hopes it will be more specific and clear.
In general, I am trying to figure out the syntax of the map statement and what is allowed in that statement. So, by map statement, I mean for example perhaps the dovecot-dict-expire.conf.ext file as shown in the doc. Is the syntax the same for the various types of files (quota vs expire)? Is there syntax to allow the specification of a different key? If so, where is this documented. I have an existing table I want to use, not the table shown in the doc.
The reason I am asking is I have seen web pages that reference all sorts of statements within the map statement, and I have no idea where they are documented. Specifically, I see an example here (which is LDAP), look in section 3:
http://dovecot.org/patches/1.2/ldap/HOWTO_dictldap+extdata.txt
You will see lots of statements, not sure which ones can be used for MySQL (instead of LDAP). So, would like to find a list of ALL valid syntax within the map.
I am guessing no one knows the answer then. Oh well, will have to give up on it then as it is un-documented.
On Thu, 2011-09-08 at 16:52 -0700, Steve Fatula wrote:
I'll try and break up my questions the other day about extdata that went unanswered into pieces in the hopes it will be more specific and clear.
In general, I am trying to figure out the syntax of the map statement and what is allowed in that statement. So, by map statement, I mean for example perhaps the dovecot-dict-expire.conf.ext file as shown in the doc. Is the syntax the same for the various types of files (quota vs expire)? Is there syntax to allow the specification of a different key? If so, where is this documented. I have an existing table I want to use, not the table shown in the doc.
They aren't really documented anywhere. Also I'm kind of hoping one day to replace the files anyway with a new syntax that allows mixed configuration of sql/file/other backends.
The dict configuration itself is anyway generic and works basically the same for expire/quota/others, except they use different keys (=different patterns when matching).
I'm not sure if there is any useful way to even explain how it works now. There is the example SQL configuration for expire and quota. Somewhere in wiki is example flat file config for them. There's really not much else you can do with them.
The reason I am asking is I have seen web pages that reference all sorts of statements within the map statement, and I have no idea where they are documented. Specifically, I see an example here (which is LDAP), look in section 3:
http://dovecot.org/patches/1.2/ldap/HOWTO_dictldap+extdata.txt
You will see lots of statements, not sure which ones can be used for MySQL (instead of LDAP).
That patch's mapping references to Pigeonhole's extdata plugin. If you install that plugin you can use SQL or flat file for the same maps.
So, would like to find a list of ALL valid syntax within the map.
Plugins can always add more maps.
----- Original Message -----
From: Timo Sirainen <tss@iki.fi> To: Steve Fatula <compconsultant@yahoo.com> Cc: Dovecot List <dovecot@dovecot.org> Sent: Monday, September 12, 2011 6:52 AM Subject: Re: [Dovecot] MySQL, map files
The reason I am asking is I have seen web pages that reference all sorts of statements within the map statement, and I have no idea where they are documented. Specifically, I see an example here (which is LDAP), look in section 3:
http://dovecot.org/patches/1.2/ldap/HOWTO_dictldap+extdata.txt
You will see lots of statements, not sure which ones can be used for MySQL (instead of LDAP).
That patch's mapping references to Pigeonhole's extdata plugin. If you install that plugin you can use SQL or flat file for the same maps.
Ok, so, now we get to the issue. What syntax can be used for the extdata plugin?
If I have an existing MySQL table with the structure:
username preference value
Username would be the dovecot user name. preference would be a constant, and, value is the variable I want to set via the extdata plugin. The primary key is username + preference (constant, in this case, say it's set to "POP3"). I want to use extdata to retrieve that value. Can it be done using extdata and MySQL map syntax, and if so, can you provide an example? Can I specify the query itself (i.e., select value from table t, another table at where....)
On Mon, 2011-09-12 at 11:23 -0700, Steve Fatula wrote:
http://dovecot.org/patches/1.2/ldap/HOWTO_dictldap+extdata.txt
You will see lots of statements, not sure which ones can be used for MySQL (instead of LDAP).
That patch's mapping references to Pigeonhole's extdata plugin. If you install that plugin you can use SQL or flat file for the same maps.
Ok, so, now we get to the issue. What syntax can be used for the extdata plugin?
If I have an existing MySQL table with the structure:
username preference value
Username would be the dovecot user name. preference would be a constant, and, value is the variable I want to set via the extdata plugin. The primary key is username + preference (constant, in this case, say it's set to "POP3"). I want to use extdata to retrieve that value. Can it be done using extdata and MySQL map syntax, and if so, can you provide an example? Can I specify the query itself (i.e., select value from table t, another table at where....)
Well, there are two fields that you need to map: responder_mode and responder_text (explained in the .txt file). Lets assume you have those two fields in an SQL table named responders. The maps would then be:
map { pattern = priv/responder_mode table = responders username_field = username value_field = responder_mode } map { pattern = priv/responder_text table = responders username_field = username value_field = responder_text }
You can change anything above except the patterns.
participants (2)
-
Steve Fatula
-
Timo Sirainen