I'm having hard time to store and retrieve data with SQLite. Let's
assume I have this structure in my C code to hold my data

struct foo {
  long a;
  float b;
  char c[1024];
  int d;
}

so the SQL definition would be

CREATE TABLE foo
(
 a LONG;
 b FLOAT;
 c VARCHAR(1024);
 d INT;
);

In real life c[1024] does not hold a printable string but variable
length binary data and d tells the data length. Let's also assume I
have N records where some of the fields can be same.

{ 1, 1.0, "data1", 5 }
{ 1, 2.0, "data2", 5 }
{ 2, 1.0, "data3", 5 }
{ 2, 2.0, "data4", 5 }
{ 5, 6.0, "data5", 5 }

And here's the "dummy user" part, how should I read from and write to
the database? I want to execute

DELETE FROM foo WHERE b < ...
INSERT INTO foo VALUE (......)
SELECT * FROM foo WHERE a=... AND b=...
SELECT c,d FROM foo WHERE a=... AND b=...

I didn't find a _simple_ example for C to do all this...

PS. What is the best way to store IPv6 addresses?
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to