In the same vein as my previous post about lack of function acting as the "opposite" of strftime(), I'm wondering if it's not time to have a scanf() function as the opposite of printf().
In the olden days, SQLite didn't have table-valued eponymous-vtable "functions", so there was a technical reaon for having no scanf(). But nowadays, nothing prevents it, and it would be quite useful. Unless such vtable-functions need to have a fixed number of returned columns? To come back on that same text duration example, I thinking of something like this: create table vs (id number, elapsed text); select vs.id, vs.elapsed, f."$1"*(60*60)+f."$2"*60+f."$3"+(f."$4"/100.0) as sec from vs, scanf('%d:%d:%d.%d', elapsed) as f or perhaps if one could "name" the returned "tuple" create table vs (id number, elapsed text); select vs.id, vs.elapsed, f.hh*(60*60)+f.mm*60+f.ss+(f.cs/100.0) as sec from vs, scanf('%d:%d:%d.%d', elapsed, 'hh', 'mm', 'ss', 'cs') as f If as I fear, vtables need a "fixed" structure (columns and names), the only solution would be to return an array-type (a-la PostgreSQL), and/or have a small "protocol" to unpack elements from a tuple-like value. That's possible and efficient thanks to type/subtype and/or pointer types. Thoughts? --DD PS: Of course, in my use case, a more specialized strptime() [1] would be better IMHO. It's just that it made me think about printf/scanf, thus this post. [1] https://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users