OK Dan, you have the solution. The count was including the terminating NULL char. Making it not include the NULL char fixed the problem.
Another question: For an empty result, should I return 0 or -1? And should the string be NULL or "" ? Bear in mind that its an empty result - not a NULL result. Thanks a million -brett Quoting Dan Kennedy > > > I'm trying to get the concat operator to work with my user-defined > function. This works fine: > > SELECT UPPER(FirstName) || ' ' || UPPER(LastName) FROM Employees > > But this doesn't work: > > SELECT FORMAT_DATE(login_time) || ' ' || FORMAT_TIME(login_time) > FROM Sessions > > I get only the formatted date - missing the formatted time. > FORMAT_DATE is my own user-defined function that returns text data > type. When you call sqlite3_result_text() to return the result, does your result string include a nul-terminator character? If so, that byte should not be included in the "number of bytes" parameter passed to result_text(). i.e. if you were doing: sqlite3_result_text(pContext, "abc", 4, ...) you might get the result you are describing. Dan. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users