[PLUG] Raspbian sqlite project...

Cryptomonkeys.org louisk at cryptomonkeys.org
Thu Mar 23 00:12:22 UTC 2017


Ideally the database would be using a sequence for the ID. That way you don’t have to worry about it. You should be able to run an SQL query. I suspect what you need is here:
http://stackoverflow.com/questions/13083199/sqlite3-c-api-number-of-rows


> On Mar 21, 2017, at 11:01 PM, Michael Christopher Robinson <michael at robinson-west.com> wrote:
> 
> I'm wondering how to count the number of rows in the database I'm
> creating from a C program.  The database has a row number or Id that
> is the primary key.  I need to know how many rows there are to know the
> next row number so I can add more temperatures to the database.  I'm
> developing on a Raspberry Pi 3 Model B 2016.  I have six USB
> temperature sensors hooked up that I read from in a loop.  I generate a
> timestamp using time.h and step through the six sensors.  Each sensor
> has an internal temperature and an external temperature.
> 
> Table is like so:
> 
> id, sensor, timestamp, temp_inner, temp_outer.
> 
> With data types:
> 
> Integer, Integer, Integer, float, float.
> 
> If I can't get a row count in the C program, I have to pass it in every
> time I do another round of readings.  I'm using sqlite3.h for database
> access and manipulation.
> 
> I've been trying to answer this question on my own, but finding sample
> C code that does this is not proving to be easy.
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
> 
> 

--
Louis Kowolowski                                louisk at cryptomonkeys.org
Cryptomonkeys:                                   http://www.cryptomonkeys.com/

Making life more interesting for people since 1977

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.pdxlinux.org/pipermail/plug/attachments/20170322/8ce4a110/attachment.asc>


More information about the PLUG mailing list