I can't spot what I'm doing wrong here, maybe somebody else can see it ...

I define a function:

static void sqliteTimeToHms(sqlite3_context *context, int argc, sqlite3_value 
**argv)
{
        sqlite3_result_text(context, "0:00:00", 8, NULL);
}

Then call

rc = sqlite3_create_function16(db, L"TimeToHms", 1, SQLITE_ANY, NULL, 
&sqliteTimeToHms, NULL, NULL);

Which returns SQLITE_OK, then later I have this query

wstring testSql = L" select TimeToHms(time)"
L" from meta_data_master"
L" where meta_data_master.id <= 100";

And try to execute it:

sqlite3_prepare16_v2(db, &testSql[0] ,-1, &pStmt,&pzTail);

And get the error message "no such function: TimeToHms"

I'm not sure where to even look ... I think I have tried every possible 
combination of 16-bit chars versus UTF-8 both in the result_text function and 
in the create_function function, plus using lower case both in the function 
creation and in the SQL ... 

But I'm not sure if that's even relevant;  the DB doesn't seem to even be 
finding the function, so it seems like it must be something more basic I am 
doing wrong.  (I thought maybe if I was passing in 16-bit text and had defined 
the function to take something different, SQLITE might not match the call up 
with the function at all.)

Does anybody see anything wrong with how I've done things?  Is it possible that 
a wrong match of text encoding to function would cause "no such function", or 
would it rather just give me garbled results?


Thanks for any help

-- 
Joe Cosby
http://joecosby.com/ 
To see a World in a Grain of Sand
  And Heaven in a Wild Flower
Hold Infinity in the palm of your hand
  And Eternity in an hour
- William Blake

:: Currently listening to O Fortuna, 1937, by Orff, from "Carmina Burana"
_________________________________________________________________
Shed those extra pounds with MSN and The Biggest Loser!
http://biggestloser.msn.com/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to