[sqlite] Bug (or feature?) Trailing comment becomes part of column name

2018-03-04 Thread petern
sqlite> .mode column
sqlite> SELECT sqlite_source_id()--sql_comment
   ...> ;
sqlite_source_id()--sql_comment


2018-01-22 18:45:57
0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2alt1

sqlite> SELECT sqlite_source_id()/*sql_comment*/
   ...> ;
sqlite_source_id()/*sql_comment*/


2018-01-22 18:45:57
0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2alt1

However, with column alias present, column name is as expected:

sqlite> SELECT sqlite_source_id()ssid/*sql_comment*/
   ...> ;
ssid


2018-01-22 18:45:57
0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2alt1
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Question about Practicality of Embedding SQLite on Cortex-M4 Processor

2018-03-04 Thread Fredrik Gustafsson
Hi,
from what I've understood you're making this way too complicated.

A database would need an index to be able to find the item you want to
mark as is_logged. However you are always logging and saving the data
in a certain order, so i BTree is just a waste of space (and code).

My proposal would be:

1 struct representing a data point
struct datapoint {
uint64_t timestamp;
uint8_t sensor_id;
uint8_t value;
}

And two pointer to keep track of your data on the flash:

uint8_t * next_insert_ptr
uint8_t * next_to_log_ptr

When you get a new datapoint, create it (pseudo code):
struct datapoint * dp = new_datapoint(time, sensor, value);
save_to_flash_at_address(dp, next_insert_ptr);
next_insert_ptr = increase_ptr(next_insert_ptr);

And when you're logging over bluetooth:
struct datapoint * dp = read_datapoint_from_flash(next_to_log_ptr);
log_to_phone_over_bluetooth(dp);
next_to_log_ptr = increase_ptr(next_to_log_ptr);

The details I haven't bothered with here is for example:
* don't log value that is ahead of next_insert_ptr
* cycle memory, when 8 gb is full, start again at 0 (or some address
  above your code)
-- 
Fredrik Gustafsson

phone: +46 733-608274
e-mail: iv...@iveqy.com
website: http://www.iveqy.com
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users