Re: [sqlite] Personal function and parameter evaluation.
On 1/6/2014 6:17 PM, trash Spam wrote: No, I did not mean anything special. This is an example. The query may not work there is no table so no type. Your use of sqlite3_value_text suggested that the function expected a string as a parameter. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Personal function and parameter evaluation.
No, I did not mean anything special. This is an example. The query may not work there is no table so no type. 2014/1/6 Igor Tandetnik> On 1/6/2014 3:33 PM, trash Spam wrote: > >> void myFunc( sqlite3_context* ctx, int nArgs, sqlite3_value** values ) >> { >> // >> const char* expr = (const char*)sqlite3_value_text( values[ 0 ] ): >> // >> } >> >> select >> myFunc( col1 + col2 ) >> ; >> >> The expression "col1 + col2" is evaluated when i call sqlite3_value_text >> or >> before the call of myFunc ? >> > > Before the call to myFunc. I'm pretty sure SQLite doesn't do lazy > evaluation here. > > Also, you probably meant "col1 || col2": '+' does not perform string > concatenation (unless you do intend to add two numbers, then have SQLite > convert the result to text). > -- > Igor Tandetnik > > ___ > 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
Re: [sqlite] Personal function and parameter evaluation.
On 1/6/2014 3:33 PM, trash Spam wrote: void myFunc( sqlite3_context* ctx, int nArgs, sqlite3_value** values ) { // const char* expr = (const char*)sqlite3_value_text( values[ 0 ] ): // } select myFunc( col1 + col2 ) ; The expression "col1 + col2" is evaluated when i call sqlite3_value_text or before the call of myFunc ? Before the call to myFunc. I'm pretty sure SQLite doesn't do lazy evaluation here. Also, you probably meant "col1 || col2": '+' does not perform string concatenation (unless you do intend to add two numbers, then have SQLite convert the result to text). -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Personal function and parameter evaluation.
Hi, void myFunc( sqlite3_context* ctx, int nArgs, sqlite3_value** values ) { // const char* expr = (const char*)sqlite3_value_text( values[ 0 ] ): // } select myFunc( col1 + col2 ) ; The expression "col1 + col2" is evaluated when i call sqlite3_value_text or before the call of myFunc ? Thank. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users