[Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Oleg Lapshin
Hello I download and run svn-2154 revision (after 2139) And I can't read all my mailboxes! Some `selects` (from dbmail-logs and my own): db.c,db_findmailbox: looking for mailbox with FQN [INBOX]. dbmysql.c,db_query: query [SELECT mailbox_idnr FROM dbmail_mailboxes WHERE lower(name)=lower('INBOX

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Oleg Lapshin
> Hello > > I download and run svn-2154 revision (after 2139) > > And I can't read all my mailboxes! > Some `selects` (from dbmail-logs and my own): I found my error: the `name` field in database was varbinary(100) type I dont' know why. I changed to varchar(100) and now all things work -- Oleg

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Aaron Stone
On Tue, 2006-06-06 at 11:30 +0400, Oleg Lapshin wrote: > > Hello > > > > I download and run svn-2154 revision (after 2139) > > > > And I can't read all my mailboxes! > > Some `selects` (from dbmail-logs and my own): > > I found my error: > the `name` field in database was varbinary(100) type > I d

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Aaron Stone
I think we can do it like this: mysql> select name from dbmail_mailboxes where binary name regexp '[lL][iI][sS][tT][eE][nN]/[uU][bB][uU][nN][tT][uU]'; +-+ | name| +-+ | Listen/Ubuntu | +-+ Horribly ugly, but

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Oleg Lapshin
> On Tue, 2006-06-06 at 11:30 +0400, Oleg Lapshin wrote: > > > Hello > > > > > > I download and run svn-2154 revision (after 2139) > > > > > > And I can't read all my mailboxes! > > > Some `selects` (from dbmail-logs and my own): > > > > I found my error: > > the `name` field in database was varbin

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Aaron Stone
On Tue, 2006-06-06 at 14:37 +0400, Oleg Lapshin wrote: > I attach mysqldump of dbmail_mailboxes with russian folders. > kmail created this folders as 'organizer folders' and I see they in russian. > They are: > Organizer/ There must be 8 bit characters there, because it cuts off. I'm still using

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Aaron Stone
On Tue, 2006-06-06 at 04:06 -0700, Aaron Stone wrote: > On Tue, 2006-06-06 at 14:37 +0400, Oleg Lapshin wrote: > > > I attach mysqldump of dbmail_mailboxes with russian folders. > > kmail created this folders as 'organizer folders' and I see they in russian. > > They are: > > Organizer/ Oleg, ple

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Oleg Lapshin
> On Tue, 2006-06-06 at 04:06 -0700, Aaron Stone wrote: > > On Tue, 2006-06-06 at 14:37 +0400, Oleg Lapshin wrote: > > > I attach mysqldump of dbmail_mailboxes with russian folders. > > > kmail created this folders as 'organizer folders' and I see they in > > > russian. They are: > > > Organizer/ >

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Aaron Stone
On Tue, 2006-06-06 at 16:47 +0400, Oleg Lapshin wrote: > > On Tue, 2006-06-06 at 04:06 -0700, Aaron Stone wrote: > > > > Oleg, please update to the latest SVN. This should work again. > > Aaron > > I have no problems with dbmail for a long time :) > It was error in _my_ database. > > If you did s

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Oleg Lapshin
> > I have no problems with dbmail for a long time :) > > It was error in _my_ database. > > > > If you did some improvements - this is good for all! > > Thanks. > > No, I broke it! > > Please makes sure that you can select mailboxes on the latest SVN. The > lower(name) was broken code and the mai

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Aaron Stone
On Tue, 2006-06-06 at 23:01 +0400, Oleg Lapshin wrote: > BINARY name REGEXP '[sS][eE][nN][tT]-mail' AND owner_idnr='2'] This should be [sS][eE][nN][tT]-[mM][aA][iI][lL]. My code to switch between base64 and normal parts of the utf7 is too naive. It should only switch into base64 mode with & and

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Oleg Lapshin
> > No, I broke it! > > Please makes sure that you can select mailboxes on the latest SVN. The > lower(name) was broken code and the mailbox column should be binary. I > think I fixed it with a new regexp match. > > The issue is that a mailbox name has *mixed* case sensitivity: > Peace/&BekF3AXVBd0

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Aaron Stone
On Tue, 2006-06-06 at 23:30 +0400, Oleg Lapshin wrote: > May be select must be in such form: > > mysql> SELECT mailbox_idnr,name FROM dbmail_mailboxes WHERE BINARY name > REGEXP '^[sS][eE][nN][tT]$' AND owner_idnr='2'; Oh duh, that should do it! Aaron

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Geo Carncross
Not all databases support REGEXP as an operator. LIKE is either case-insensitive, or can be made so with a (database-specific) operator on most databases. Moreover, LIKE can often take advantage of indexes. Consider for PostgreSQL: x ILIKE 'SENT' OR x ILIKE 'SENT_ITEMS' Consider LIKE fo

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Aaron Stone
On Tue, 2006-06-06 at 16:13 -0400, Geo Carncross wrote: > Not all databases support REGEXP as an operator. Everybody's got some keyword that performs this type of match. I added entries to the db_get_sql fragment function to grab the right operator. I also added a user function to dbsqlite.c, but

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-06 Thread Geo Carncross
On Tue, 2006-06-06 at 13:37 -0700, Aaron Stone wrote: > On Tue, 2006-06-06 at 16:13 -0400, Geo Carncross wrote: > > Not all databases support REGEXP as an operator. > > Everybody's got some keyword that performs this type of match. I added > entries to the db_get_sql fragment function to grab the

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-07 Thread Aaron Stone
On Tue, Jun 6, 2006, Geo Carncross said: > On Tue, 2006-06-06 at 13:37 -0700, Aaron Stone wrote: > You probably want REG_NOSUB|REG_EXTENDED as most of the other engines > use POSIX EXTENDED regular expressions, and not BASIC ones (which have > \( and \) and stuff backwards. Ok. It would also be g

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-07 Thread Geo Carncross
On Tue, 2006-06-06 at 22:08 +, Aaron Stone wrote: > > You also don't need to include sqlite3.h -- it's only using the SQLite2 > > API, even if the database format itself can be SQLite3. > > My understanding is that we need a whole new module, dbsqlite3.c, to make > the version 3 calls and to c

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-07 Thread Aaron Stone
On Tue, 2006-06-06 at 21:01 -0400, Geo Carncross wrote: > Not true. SQLite3 supports SQLite2's API. It just doesn't support the > database format. All functions get a 3 on the end for sqlite3. > > What's the migration path to get an existing SQLite 2.x database updated to > > SQLite > > 3.x? >

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-07 Thread Aaron Stone
On Tue, 2006-06-06 at 17:04 -0400, Geo Carncross wrote: > Likewise, you can use both LIKE and ILIKE together to get the various > parts, as in: PostgreSQL > x ILIKE 'SENT_ITEMS+__' AND x LIKE '__+xab414'; MySQL > x LIKE 'SENT_ITEMS+__' AND x LIKE BINARY '__+xab414'; SQLi

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-08 Thread Geo Carncross
On Wed, 2006-06-07 at 10:06 -0700, Aaron Stone wrote: > SQLite has lousy LIKE behavior: it's case insensitive for the US-ASCII > range, and case sensitive everywhere else. I noted a FIXME in > dbsqlite.c. I think we can't very well replace LIKE (because it might be needed elsewhere), but if we cou

Re: [Dbmail-dev] Strange things with case-insensitive mail-boxes and mysql

2006-06-08 Thread Aaron Stone
On Thu, 2006-06-08 at 12:31 -0400, Geo Carncross wrote: > Oh, and it'd serve another purpose- the database engine being put in a > bad locale or strange collating rules or whatnot... In the back of my mind, I was thinking that I need to force the specifically case insensitive LIKE's in MySQL to u