Re: [sqlite] SQLite - how to protect the data

2007-02-23 Thread Olaf Beckman Lapré
Hi, Why not just encrypt the file system or part of the disk where the database is situated? I use TrueCrypt, a free open-source program, for this and it works great and it's very fast. Unless you're doing hundreds of transactions per second, you'll hardly notice the performance loss (with

Re: [sqlite] (newbie) pictures in tables, what's the best way ?

2007-02-23 Thread Jay Sprenkle
On 2/23/07, Stef Mientki <[EMAIL PROTECTED]> wrote: hello, I've started with SQLite, because it's one of the first dbases with a local filessytem without authenciation. It looks great, compared to ini-files. Now I've a basic problem: I've a table, with 10 simple fields and 1 blob field,

[sqlite] SQLite - how to protect the data

2007-02-23 Thread mxs
Hi guys, I am quite new here and quite new to SQLite. I am shocked how small and fast this database is. So far I've been using MS Access for my little projects and I cannot wait to replace it with SQLite. Now, I have a question which I will have to deal with. One of the application I work on

Re: [sqlite] Re: Re: how to get field names of empty tables ?

2007-02-23 Thread Scott Hess
I think only the dot commands are special (.help, etc). Everything else is fair game. Best reference for what you can feed a prepare or exec is http://www.sqlite.org/lang.html . -scott On 2/23/07, Igor Tandetnik <[EMAIL PROTECTED]> wrote: Stef Mientki <[EMAIL PROTECTED]> wrote: > Igor

[sqlite] Re: Re: how to get field names of empty tables ?

2007-02-23 Thread Igor Tandetnik
Stef Mientki <[EMAIL PROTECTED]> wrote: Igor Tandetnik wrote: Stef Mientki <[EMAIL PROTECTED]> wrote: is there an SQL statement to get the field-names of empty tables ? PRAGMA table_info(tableName); I had seen that command, but I wrote something about that these commands could only be run

Re: [sqlite] Re: how to get field names of empty tables ?

2007-02-23 Thread Stef Mientki
Igor Tandetnik wrote: Stef Mientki <[EMAIL PROTECTED]> wrote: is there an SQL statement to get the field-names of empty tables ? PRAGMA table_info(tableName); Igor Tandetnik Thanks Igor, I had seen that command, but I wrote something about that these commands could only be run from the

Re: [sqlite] db design options

2007-02-23 Thread Joe Wilson
> Any suggestions? If you know that you will likely only perform per-site queries then you want all the readings for a given site contiguous in the database file (or files). You can accomplish that in many ways, as you've outlined. Hopefully your reading_id's always increase as time goes

Re: [sqlite] db design options

2007-02-23 Thread P Kishor
On 2/23/07, Dennis Cote <[EMAIL PROTECTED]> wrote: P Kishor wrote: > > > Most of the time I am looking at one site, so there is a speed gain by > not plowing through other sites' data. This is what is causing me to > pause before I rush forward. > If you have an index on the readings table by

[sqlite] Re: how to get field names of empty tables ?

2007-02-23 Thread Igor Tandetnik
Stef Mientki <[EMAIL PROTECTED]> wrote: is there an SQL statement to get the field-names of empty tables ? PRAGMA table_info(tableName); Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED]

[sqlite] how to get field names of empty tables ?

2007-02-23 Thread Stef Mientki
is there an SQL statement to get the field-names of empty tables ? thanks, Stef Mientki - To unsubscribe, send email to [EMAIL PROTECTED] -

Re: [sqlite] db design options

2007-02-23 Thread Dennis Cote
P Kishor wrote: Most of the time I am looking at one site, so there is a speed gain by not plowing through other sites' data. This is what is causing me to pause before I rush forward. If you have an index on the readings table by site_id (and perhaps timestamp) sqlite will use the index to

Re: [sqlite] db design options

2007-02-23 Thread P Kishor
On 2/23/07, Rich Shepard <[EMAIL PROTECTED]> wrote: On Fri, 23 Feb 2007, P Kishor wrote: .. > all is fine with this. However, there really is no relationship > between one site and another. You don't tell us the purpose of this exercise, but you might want to query for all sites that

Re: [sqlite] db design options

2007-02-23 Thread Rich Shepard
On Fri, 23 Feb 2007, P Kishor wrote: I want to store quite a bit of data about similar but different things... in this case, timestamped discharge and precipitation values from different sites. A simple schema would be CREATE TABLE sites ( site_id INTEGER PRIMARY KEY, lon

Re: [sqlite] db design options

2007-02-23 Thread John Stanton
If you have a limited need to create consolidated reports use separate DBs. Access will be faster because at best it is Onlog(n). The rows you don't access will slow it down, particularly if you are performing table scans such as with LIKE selections. You could make each DB the same name

[sqlite] db design options

2007-02-23 Thread P Kishor
I want to store quite a bit of data about similar but different things... in this case, timestamped discharge and precipitation values from different sites. A simple schema would be CREATE TABLE sites ( site_id INTEGER PRIMARY KEY, lon REAL, lat REAL,

Re: [sqlite] (newbie) pictures in tables, what's the best way ?

2007-02-23 Thread John Stanton
How about using one table - - Name TEXT - Birthdate REAL - Mimetype TEXT - Image BLOB The mimetype column tells you the image type (jpeg etc). One access would be SELECT Name Birthdate Mimetype FROM Yourtab. It would not access the BLOB. Stef Mientki wrote: Cesar Rodas

Re: [sqlite] (newbie) pictures in tables, what's the best way ?

2007-02-23 Thread Ken
This is a design question really so here are my recomendations. Persons - ID( an integer primary key ) - Name - Birthday - Picture Type ( your two digit type). Picture - ID (An integer Primary Key that matches the ID of persons). - image (blob)

Re: [sqlite] (newbie) pictures in tables, what's the best way ?

2007-02-23 Thread Stef Mientki
Cesar Rodas wrote: Save into a blob. thanks but that's not what I meant. I'll try to explain with an example: I want to create this database Persons - Name - Birthday - Picture Now when I want to view this database with a general database browser / manager, I'll first find out what

Re: [sqlite] (newbie) pictures in tables, what's the best way ?

2007-02-23 Thread Cesar Rodas
Save into a blob. here is a C example http://www.sqlite.org/cvstrac/wiki?p=BlobExample On 23/02/07, Stef Mientki <[EMAIL PROTECTED]> wrote: hello, I've started with SQLite, because it's one of the first dbases with a local filessytem without authenciation. It looks great, compared to

Re[2]: [sqlite] BLOB question

2007-02-23 Thread Teg
Hello Cesar, Friday, February 23, 2007, 11:19:23 AM, you wrote: CR> good idea!! i didn't think in this!! CR> On 23/02/07, Martin Jenkins <[EMAIL PROTECTED]> wrote: >> Cesar Rodas wrote: >> >while ( (n=fread(buff,Buffsize,1,file)) > 0) >> >{ >> >if (i>0) >> >*value =

[sqlite] (newbie) pictures in tables, what's the best way ?

2007-02-23 Thread Stef Mientki
hello, I've started with SQLite, because it's one of the first dbases with a local filessytem without authenciation. It looks great, compared to ini-files. Now I've a basic problem: I've a table, with 10 simple fields and 1 blob field, containing a (possibly large) image. Uptill now the

Re: [sqlite] BLOB question

2007-02-23 Thread Cesar Rodas
good idea!! i didn't think in this!! On 23/02/07, Martin Jenkins <[EMAIL PROTECTED]> wrote: Cesar Rodas wrote: >while ( (n=fread(buff,Buffsize,1,file)) > 0) >{ >if (i>0) >*value = realloc(*value, (i+1) * Buffsize); >memcpy(*value + (i * Buffsize), buff,

Re: [sqlite] BLOB question

2007-02-23 Thread John Stanton
I would make your routine more like this. It avoids the needless buffer shadowing you get by using fopen and also avoids unecessary mallocs. I haven't tested the code, it just presents the method. unsigned char *bp; int fd; long fsize; fd = open(path, O_RDWR);

Re: [sqlite] BLOB question

2007-02-23 Thread Martin Jenkins
Cesar Rodas wrote: while ( (n=fread(buff,Buffsize,1,file)) > 0) { if (i>0) *value = realloc(*value, (i+1) * Buffsize); memcpy(*value + (i * Buffsize), buff, Buffsize); *len += n; i++; } An afterthought, why don't you just stat the file and

Re: [sqlite] BLOB question

2007-02-23 Thread Cesar Rodas
Sorry I copy bad when I wanted to write "#define uchar unsigned char" but I did "#define uchar unsigned char *" On 23/02/07, Martin Jenkins <[EMAIL PROTECTED]> wrote: Cesar Rodas wrote: > #define uchar unsigned char * suggests it's a char but is in fact a pointer to a char so the signature

Re: [sqlite] BLOB question

2007-02-23 Thread Cesar Rodas
I found the answer!! http://www.sqlite.org/cvstrac/wiki?p=BlobExample thanks for you help too Wesley On 23/02/07, Cesar Rodas <[EMAIL PROTECTED]> wrote: #define E_IO_COULDNT_OPEN - 1 #define E_IO_ERRO -2 #define uchar unsigned char * int LoadFileContent(uchar *path, uchar ** value, long *

Re: [sqlite] about default file permission of SQLite database file

2007-02-23 Thread John Stanton
It would be better to make the create permission 0666. Then umask can restrict that permission and the user can get whatever permission required by the application. Joe Wilson wrote: --- "Shan, Zhe (Jay)" <[EMAIL PROTECTED]> wrote: I've tried umask, but it does not work for SQLite. Here

Re: [sqlite] about default file permission of SQLite database file

2007-02-23 Thread Martin Jenkins
Joe Wilson wrote: I can never remember the umask number's effect without experimentation DESCRIPTION umask sets the umask to mask & 0777. The umask is used by open(2) to set initial file permissions on a newly-created file. Specifically, permissions in the umask are turned off from

Re: [sqlite] BLOB question

2007-02-23 Thread Martin Jenkins
Cesar Rodas wrote: > #define uchar unsigned char * suggests it's a char but is in fact a pointer to a char so the signature of LoadFileContent is actually int LoadFileContent(unsigned char **path, unsigned char ***value, ... and that triggers my "three levels of indirection is usually an

Re: [sqlite] BLOB question

2007-02-23 Thread Wesley W. Terpstra
A couple of comments. On Feb 23, 2007, at 3:03 PM, Cesar Rodas wrote: while ( (n=fread(buff,Buffsize,1,file)) > 0) { if (i>0) *value = realloc(*value, (i+1) * Buffsize); memcpy(*value + (i * Buffsize), buff, Buffsize); *len += n; i++; } You are

Re: [sqlite] about default file permission of SQLite database file

2007-02-23 Thread Joe Wilson
--- "Shan, Zhe (Jay)" <[EMAIL PROTECTED]> wrote: > I've tried umask, but it does not work for SQLite. Here are the default permissions used with open()'s O_CREAT flag: src/os_os2.h:# define SQLITE_DEFAULT_FILE_PERMISSIONS 0600 src/os_unix.c:# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644 But

Re: [sqlite] BLOB question

2007-02-23 Thread Cesar Rodas
#define E_IO_COULDNT_OPEN - 1 #define E_IO_ERRO -2 #define uchar unsigned char * int LoadFileContent(uchar *path, uchar ** value, long * len) { #define Buffsize 1024*4 int n; long i=0; FILE *file; unsigned char buff[Buffsize]; if ( (file=fopen(path,"rb"))==0) {

[sqlite] BLOB question

2007-02-23 Thread Cesar Rodas
Does any one has a C code to save a binary file into a blob, and wants to share? Because i am getting an "segmentation fault" error from a file that I load into memory then I generate the query with a sqlite3_mprintf.. Thanks to all -- Cesar Rodas http://www.sf.net/projects/pagerank (The

Re: [sqlite] Precision of dates stores as Julian "real"

2007-02-23 Thread Ralf Junker
>> > So make the wiki available for download. ;) >> >> I would like this too. ;) >> >> Often I'm working without an internet connection and a having a local >> copy of the Wiki would be extremely useful. >> > >Been working on this for years. Literally. I just never seem to >find the time to