Hi,
Here's the path for the 'select distinct' problem. It's a patch against the
cvs version. However, I coded it against 0.8.3-1 release. If there's any
problems, let me know.
Also, I think I should point out that there are a couple of caveats when using
the sqlite3 driver, that I have mentioned in the code comments, but should
also be mentioned in the driver documentation.
1. When using a function as a result column (e.g. count(*) ), the opening
bracket MUST hug the function name. The function call MUST also be aliased.
2. When using am expression as a result column (e.g. count(*) + 6 ), the
entire expression MUST be enclosed in brackets and MUST be aliased.
Simple enough.
--
Kris Groves
Project Manager / Software Engineer mm-lab GmbH
Phone: +49 7154 827 323 Stammheimer Str. 10
Fax: +49 7154 827 350 D-70806 Kornwestheim
[EMAIL PROTECTED] www.mmlab.de
Domicile of Company: Kornwestheim, Germany
District Court - Court of Registration Stuttgart HRB 207257
Managing Directors: Bernd Herrmann, Lothar Krank,
Michael Meiser, Dr. Andreas Streit
Index: dbd_sqlite3.c
===================================================================
RCS file: /cvsroot/libdbi-drivers/libdbi-drivers/drivers/sqlite3/dbd_sqlite3.c,v
retrieving revision 1.27
diff -r1.27 dbd_sqlite3.c
88c88
< int getTables(char** tables, int index, const char* statement);
---
> int getTables(char** tables, int index, const char* statement, char* curr_table);
696a697
> int curr_table_index;
718c719
< It probably isn't a good idea to rely on this, but we will. */
---
> It probably isn't a good idea to rely on this, but we will.
720,727c721,733
< if ( strlen(curr_table) < 1 ) {
< //printf("not curr_table\n");
< table_count = getTables(tables,0,statement_copy);
< //printf("*********TABLELIST************\n");
< // for ( counter = 0 ; counter < table_count ; counter++) {
< // printf("%s\n",tables[counter]);
< // }
< }
---
> I knew it wasn't a good idea :( Select using distinct breaks the above assumptions.
> now we have to resolve the table name as well (if it is given). */
>
> /* We have to assume that curr_table is an alias.
> This call will resolve the curr_table if given
> */
> //printf("curr_table before getTables = %s\n",curr_table);
> table_count = getTables(tables,0,statement_copy,curr_table);
> //printf("curr_table after getTables = %s\n",curr_table);
> //printf("*********TABLELIST************\n");
> // for ( counter = 0 ; counter < table_count ; counter++) {
> // //printf("%s\n",tables[counter]);
> // }
1132c1138
< int getTables(char** tables, int index, const char* statement) {
---
> int getTables(char** tables, int index, const char* statement, char* curr_table) {
1225,1226c1231,1237
< //printf("skipping alias\n");
< // this word is an alias, ignore it
---
> // if this word matches what is currently in curr_table
> // then curr_table is an alias for the last found table
> //printf("++++ AS FLAG ++++ curr_table = %s , word = %s\n",curr_table,word);
> if ( strcmp(curr_table,word) == 0 ) {
> //printf("Setting curr_table\n",curr_table,word);
> strcpy(curr_table,tables[index - 1]);
> }
1227a1239
> //printf("++++ AS FLAG ++++ curr_table set to %s\n",curr_table);
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Libdbi-drivers-devel mailing list
Libdbi-drivers-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel