[sqlite] error in sqlite3_extension_init
Excuse me for my stupid topic, but I am crazying to find error in program below. My output is: bash-3.1# gcc -shared labsinf.c -o inf.so labsinf.c:61: error: expected ';', ',' or ')' before '*' token The errror is for sqlit3_extension_init row, but I don't see strange things #include stdio.h #include stdlib.h #include string.h #include sqlite3ext.h SQLITE_EXTENSION_INIT1 void soundex(sqlite3_context* ctx, int nargs, sqlite3_value** values) { int i,j; char c,r; int d; int count; char* str2; char* result; int dim; const char* str; char ret[4]; str = sqlite3_value_text(values[0]); dim = strlen(str); for (i=0;idim;i++) str2[i] = str[i]; for (i=0;i=dim;i++) str2[i] = toupper(str2[i]); for (i=0;i=dim;i++) switch (str[i]) { case 'A': case 'E': case 'I': case 'O': case 'U': case 'H': case 'W': case 'Y': str2[i] = '0'; } for (i=1;idim;i++) switch (str2[i]) { case 'B': case 'F': case 'P': case 'V': str2[i] = '1'; break; case 'C': case 'G': case 'J': case 'K': case 'Q': case 'S': case 'X': case 'Z': str2[i] = '2'; break; case 'D': case 'T': str2[i] = '3'; break; case 'L': str2[i] = '4'; break; case 'M': case 'N': str2[i] = '5'; break; case 'R': str2[i] = '6'; break; } count=1; for (i=0;idim-1;i++) if (str2[i] != str2[i+1]) count++; result = malloc(count); j=0; for (i=0;idim-1;i++) if (str2[i] != str2[i+1]) { result[j]=str2[i]; j++; } for (i=0;i4;i++) printf(%c, result[i]); for (i=0;i4;i++) ret[i] = result[i]; printf(\n\n); sqlite3_result_text(ctx,ret, 4, SQLITE_TRANSIENT); } int sqlite3_extension_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_rountines *pApi) { SQLITE_EXTENSION_INIT2(pApi) sqlite3_create_function(db, soundex, 1, SQLITE_UTF8, NULL, soundex, NULL, NULL); return 0; } - Inviato da Yahoo! Mail. La casella di posta intelligente. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] error in sqlite3_extension_init
On Apr 12, 2008, at 12:36 AM, dark0s dark0s wrote: Excuse me for my stupid topic, but I am crazying to find error in program below. My output is: bash-3.1# gcc -shared labsinf.c -o inf.so labsinf.c:61: error: expected ';', ',' or ')' before '*' token The errror is for sqlit3_extension_init row, but I don't see strange things #include stdio.h #include stdlib.h #include string.h #include sqlite3ext.h SQLITE_EXTENSION_INIT1 void soundex(sqlite3_context* ctx, int nargs, sqlite3_value** values) { int i,j; char c,r; int d; int count; char* str2; char* result; int dim; const char* str; char ret[4]; str = sqlite3_value_text(values[0]); dim = strlen(str); for (i=0;idim;i++) str2[i] = str[i]; for (i=0;i=dim;i++) str2[i] = toupper(str2[i]); for (i=0;i=dim;i++) switch (str[i]) { case 'A': case 'E': case 'I': case 'O': case 'U': case 'H': case 'W': case 'Y': str2[i] = '0'; } for (i=1;idim;i++) switch (str2[i]) { case 'B': case 'F': case 'P': case 'V': str2[i] = '1'; break; case 'C': case 'G': case 'J': case 'K': case 'Q': case 'S': case 'X': case 'Z': str2[i] = '2'; break; case 'D': case 'T': str2[i] = '3'; break; case 'L': str2[i] = '4'; break; case 'M': case 'N': str2[i] = '5'; break; case 'R': str2[i] = '6'; break; } count=1; for (i=0;idim-1;i++) if (str2[i] != str2[i+1]) count++; result = malloc(count); j=0; for (i=0;idim-1;i++) if (str2[i] != str2[i+1]) { result[j]=str2[i]; j++; } for (i=0;i4;i++) printf(%c, result[i]); for (i=0;i4;i++) ret[i] = result[i]; printf(\n\n); sqlite3_result_text(ctx,ret, 4, SQLITE_TRANSIENT); } int sqlite3_extension_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_rountines *pApi) { That bit is wrong. ^^^ SQLITE_EXTENSION_INIT2(pApi) sqlite3_create_function(db, soundex, 1, SQLITE_UTF8, NULL, soundex, NULL, NULL); return 0; } - Inviato da Yahoo! Mail. La casella di posta intelligente. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] error in sqlite3_extension_init
But I don't understand where is the error in row below: int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_rountines *pApi) { Can some suggest me something? - #include stdio.h #include stdlib.h #include string.h #include sqlite3ext.h SQLITE_EXTENSION_INIT1 void soundex(sqlite3_context* ctx, int nargs, sqlite3_value** values) { int i,j; char c,r; int d; int count; char* str2; char* result; int dim; const char* str; char ret[4]; str = sqlite3_value_text(values[0]); dim = strlen(str); for (i=0;idim;i++) str2[i] = str[i]; for (i=0;i=dim;i++) str2[i] = toupper(str2[i]); for (i=0;i=dim;i++) switch (str[i]) { case 'A': case 'E': case 'I': case 'O': case 'U': case 'H': case 'W': case 'Y': str2[i] = '0'; } for (i=1;idim;i++) switch (str2[i]) { case 'B': case 'F': case 'P': case 'V': str2[i] = '1'; break; case 'C': case 'G': case 'J': case 'K': case 'Q': case 'S': case 'X': case 'Z': str2[i] = '2'; break; case 'D': case 'T': str2[i] = '3'; break; case 'L': str2[i] = '4'; break; case 'M': case 'N': str2[i] = '5'; break; case 'R': str2[i] = '6'; break; } count=1; for (i=0;idim-1;i++) if (str2[i] != str2[i+1]) count++; result = malloc(count); j=0; for (i=0;idim-1;i++) if (str2[i] != str2[i+1]) { result[j]=str2[i]; j++; } for (i=0;i4;i++) printf(%c, result[i]); for (i=0;i4;i++) ret[i] = result[i]; printf(\n\n); sqlite3_result_text(ctx,ret, 4, SQLITE_TRANSIENT); } int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_rountines *pApi) { SQLITE_EXTENSION_INIT2(pApi) sqlite3_create_function(db, soundex, 1, SQLITE_UTF8, NULL, soundex, NULL, NULL); return 0; } - Inviato da Yahoo! Mail. La casella di posta intelligente. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] error in sqlite3_extension_init
dark0s dark0s wrote: But I don't understand where is the error in row below: int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_rountines *pApi) { This is one of those groaners. :-) Compare these two lines. sqlite3_api_routines sqlite3_api_rountines ^ Note the extra character! Guess which one you were using. I looked at this for way too long, even after Dan had pointed it out. HTH Dennis Cote ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users