-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/02/12 01:47, Steinar Midtskogen wrote:
> OK.  But then I wont have an SQL interface for accessing interpolated 
> data.  It's acceptable.  An SQL interface is mostly a "nice to have", 
> so I could do some quick queries in SQL instead of having to write C 
> code for it.

Making SQL functions that call your C code will do the trick.

Also do you know how easy it is to add a SQL shell to your C code?  Read a
line of input and call sqlite3_complete on it.  If not complete, read
another line appending to earlier line and call sqlite3_complete again.
Rinse and repeat until you have a complete line then prepare, step and
output whatever it returns.

> So, if I go for that approach, you'd recommend that I add functions, 
> such as "reading", and if I want a mean temperature, I should add a 
> function "mean" and not try to change what AVG will do?

Functions you add to SQLite do not have to work on tables mentioned in the
query.  The doc is a little confusing:

  http://www.sqlite.org/c3ref/create_function.html

You need to implement the xFunc callback which is like main() in taking a
count of arguments and their values.  Once decoded just call your existing
C function.

Only you know the nature of missing data, how often it is missing, the
calculations you want to do and how all this affects the final conclusions
you are generating from the data.  (You could also fix the data generator
to synthesize missing values rather than trying to fix it later.)

If you are working with shorter periods (eg a day) then you can also
create temporary tables putting in the missing values.

But if you absolutely need every value to be present for arbitrary SQL
queries then virtual tables will pretty much be the only transparent thing.

Roger


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk8yxmUACgkQmOOfHg372QTN/gCguW0ld/UZxFmjVcLMGFMt88ip
Hz0AoMbgJFwoNXw5DvwLFPe02WCh2Ok1
=C71Q
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to