Skip to content

Commit d80ccd4

Browse files
committed
append row with values intermediate
1 parent 2953cd6 commit d80ccd4

File tree

5 files changed

+171
-77
lines changed

5 files changed

+171
-77
lines changed

examples/Uno_and_above/Uno_and_above.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void loop() {
147147
break;
148148
}
149149
if (num_entries) {
150-
res = uls_append_new_row(&ctx);
150+
res = uls_append_row(&ctx);
151151
if (res)
152152
break;
153153
delay(dly);

examples/Uno_and_above_Binary_Search/Uno_and_above_Binary_Search.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void loop() {
147147
break;
148148
}
149149
if (num_entries) {
150-
res = uls_append_new_row(&ctx);
150+
res = uls_append_row(&ctx);
151151
if (res)
152152
break;
153153
delay(dly);

src/test_ulog_sqlite.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
Testing program for Sqlite Micro Logger
33
4-
Sqlite Micro Logger is a Fast, Lean and Mean
5-
Sqlite database logger targetting low memory systems such as Microcontrollers.
4+
Sqlite Micro Logger is a Fast and Lean
5+
Sqlite database logger targetting low RAM systems such as Microcontrollers.
66
77
This Library can work on systems that have as little as 2kb,
88
such as the ATMega328 MCU. It is available for the Arduino platform.
@@ -85,12 +85,12 @@ int flush_fn(struct uls_write_context *ctx) {
8585

8686
int test_multilevel(char *filename) {
8787

88-
int32_t page_size = 512;
88+
int32_t page_size = 65536;
8989
byte buf[page_size];
9090
struct uls_write_context ctx;
9191
ctx.buf = buf;
9292
ctx.col_count = 5;
93-
ctx.page_size_exp = 9;
93+
ctx.page_size_exp = 16;
9494
ctx.max_pages_exp = 0;
9595
ctx.page_resv_bytes = 0;
9696
ctx.read_fn = read_fn;
@@ -106,8 +106,6 @@ int test_multilevel(char *filename) {
106106
uls_write_init(&ctx);
107107
int32_t max_rows = 1000000;
108108
for (int32_t i = 0; i < max_rows; i++) {
109-
double d = i;
110-
d /= 2;
111109
gettimeofday(&tv, NULL);
112110
t = localtime(&tv.tv_sec);
113111
t->tm_year += 1900;
@@ -135,19 +133,26 @@ int test_multilevel(char *filename) {
135133
txt[20] = '0' + (tv.tv_usec / 100000) % 10;
136134
txt[21] = '0' + (tv.tv_usec / 10000) % 10;
137135
txt[22] = '0' + (tv.tv_usec / 1000) % 10;
138-
uls_set_col_val(&ctx, 0, ULS_TYPE_TEXT, txt, 23);
139136
int32_t ival = i - max_rows / 2;
140-
uls_set_col_val(&ctx, 1, ULS_TYPE_INT, &ival, sizeof(ival));
141-
uls_set_col_val(&ctx, 2, ULS_TYPE_REAL, &d, sizeof(d));
142-
d = rand();
143-
d /= 1000;
144-
uls_set_col_val(&ctx, 3, ULS_TYPE_REAL, &d, sizeof(d));
137+
double d1 = i;
138+
d1 /= 2;
139+
double d2 = rand();
140+
d2 /= 1000;
145141
int txt_len = rand() % 10;
142+
char txt1[11];
146143
for (int j = 0; j < txt_len; j++)
147-
txt[j] = 'a' + (char)(rand() % 26);
144+
txt1[j] = 'a' + (char)(rand() % 26);
145+
/*uint8_t types[] = {ULS_TYPE_TEXT, ULS_TYPE_INT, ULS_TYPE_REAL, ULS_TYPE_REAL, ULS_TYPE_TEXT};
146+
void *values[] = {txt, &ival, &d1, &d2, txt1};
147+
uint16_t lengths[] = {23, sizeof(ival), sizeof(d1), sizeof(d2), txt_len};
148+
uls_append_row_with_values(&ctx, types, (const void **) values, lengths);*/
149+
uls_set_col_val(&ctx, 0, ULS_TYPE_TEXT, txt, 23);
150+
uls_set_col_val(&ctx, 1, ULS_TYPE_INT, &ival, sizeof(ival));
151+
uls_set_col_val(&ctx, 2, ULS_TYPE_REAL, &d1, sizeof(d1));
152+
uls_set_col_val(&ctx, 3, ULS_TYPE_REAL, &d2, sizeof(d2));
148153
uls_set_col_val(&ctx, 4, ULS_TYPE_TEXT, txt, txt_len);
149154
if (i < max_rows - 1)
150-
uls_append_new_row(&ctx);
155+
uls_append_row(&ctx);
151156
}
152157
if (uls_finalize(&ctx)) {
153158
printf("Error during finalize\n");
@@ -182,11 +187,10 @@ int test_basic(char *filename) {
182187
uls_set_col_val(&ctx, 2, ULS_TYPE_TEXT, "How", 3);
183188
uls_set_col_val(&ctx, 3, ULS_TYPE_TEXT, "Are", 3);
184189
uls_set_col_val(&ctx, 4, ULS_TYPE_TEXT, "You", 3);
185-
uls_append_new_row(&ctx);
190+
uls_append_row(&ctx);
186191
uls_set_col_val(&ctx, 0, ULS_TYPE_TEXT, "I", 1);
187192
uls_set_col_val(&ctx, 1, ULS_TYPE_TEXT, "am", 2);
188193
uls_set_col_val(&ctx, 2, ULS_TYPE_TEXT, "fine", 4);
189-
//uls_set_col_val(&ctx, 3, ULS_TYPE_TEXT, "Suillus bovinus, the Jersey cow mushroom, is a pored mushroom in the family Suillaceae. A common fungus native to Europe and Asia, it has been introduced to North America and Australia. It was initially described as Boletus bovinus by Carl Linnaeus in 1753, and given its current binomial name by Henri François Anne de Roussel in 1806. It is an edible mushroom, though not highly regarded. The fungus grows in coniferous forests in its native range, and pine plantations elsewhere. It is sometimes parasitised by the related mushroom Gomphidius roseus. S. bovinus produces spore-bearing mushrooms, often in large numbers, each with a convex grey-yellow or ochre cap reaching up to 10 cm (4 in) in diameter, flattening with age. As in other boletes, the cap has spore tubes extending downward from the underside, rather than gills. The pore surface is yellow. The stalk, more slender than those of other Suillus boletes, lacks a ring. (Full article...)", 953);
190194
uls_set_col_val(&ctx, 3, ULS_TYPE_TEXT, "thank", 5);
191195
uls_set_col_val(&ctx, 4, ULS_TYPE_TEXT, "you", 3);
192196
if (uls_finalize(&ctx)) {
@@ -290,7 +294,7 @@ int append_records(int argc, char *argv[], struct uls_write_context *ctx) {
290294
return -4;
291295
}
292296
if (i < argc - 1) {
293-
if (uls_append_new_row(ctx)) {
297+
if (uls_append_row(ctx)) {
294298
printf("Error during add col\n");
295299
return -5;
296300
}

0 commit comments

Comments
 (0)