Hi Michael,
I assume that you are somewhat familiar with C and SQL.
If you need SQL introduction (essential for using any SQL DB) I would
recommend: https://www.w3schools.com/sql/ and replicate the examples
using sqlite3 command line interface.
You will see plenty SQL examples how to count rows in a table or table
selection.
With that out of the way, here is the answer you are looking for in C:
1. Consider C code example here: https://www.sqlite.org/quickstart.html
2. main function: int main(int argc, char **argv) if you compile it and
call the resulting program from shell - it takes 2 parameters.
  So, example command line would look like: mySqlProgram sqlDbName
"sqlCommand"
3. Following on SQL the basics: Use that command to create DB, create
table, insert some data rows, etc.
4. Use the code from Jonas like this: mySqlProgram sqlDbName "SELECT
Count(*) FROM tblName"
Note: Replace sqlDbName and tblName as appropriate.
I hope it helps, Tomas
On Tue, 2017-03-21 at 22:56 -0700, Michael Christopher Robinson wrote:
> > Why don't you make the (sensor,timestamp) combination the primary
> > key
> > instead?
> > 
> Makes sense, how do I set the combination (sensor,timestamp) as the
> primary key in C code?  Note that I'm using sqlite3.h.
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to