@Igor: That's a good idea, taking the list out of a CVS formatted file and run 
that command

@Barefoot: Here are the instructions given me, which includes the schema you 
requested:

You get the schema of entry with:

.schema

sqlite> .schema
create table list (id integer primary key,owner_id integer not null default 
0,behavior integer not null default 1,entry text not null,regex boolean not 
null default 0,timestamp_last timestamp not null default 0,source integer not 
null default 0);
create table owner (id integer primary key,owner text);
create index list_entry_idx on list(entry);
create index list_owner_idx on list(owner_id);
create index list_regex_idx on list(regex);
create index owner_owner_idx on owner(owner);
sqlite>


You can do queries with:

select * from list;

1|0|1|white.com|0|1210870781|0

2|0|0|black.com|0|0|0

You can add entries with inserts from the command line.  You should be able to 
do it like this:

sqlite /var/local/database/dblist “insert into list (owner,behavior,entry) 
values(0,0,’newblacklistentry.com’) ”

The value for behavior is 0 for blacklist and 1 for whitelist.  Owner is always 
0 (for system) in your tests.

* Note the syntax he provided does not work straightaway. You can see how I 
tried with my SQL knowledge (not that great obviously) to make something out of 
the statement provided.

Thanks for the quick replies :) Appreciate it!
Carlo

----- Original Message ----
From: Igor Tandetnik <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Tuesday, May 20, 2008 7:27:08 AM
Subject: Re: [sqlite] Help with syntax

Carlo S. Marcelo <[EMAIL PROTECTED]>
wrote:
> Below is the syntax and error I received.
>
> [EMAIL PROTECTED] root]# sqlite
> /var/local/database/dblist "insert into
> list ('0,0,newblacklistentry1,com') values
> ('0,0,newblacklistentry1.com')"
> SQL error: table list has no column named
> 0,0,newblacklistentry1,com

This statement makes no sense. In the first pair of parens, you are 
supposed to provide a list of column names. In the second, a list of 
values. A new row is inserted, in which specified columns are set to 
specified values (and columns that were not mentioned, if any, take on 
their default values). Something like this:

insert into list(column1, column2, column3) values (0, 0, 
'newblacklistentry1.com');

> What I am trying to do here is create a script that
> will populate the database with a hundred thousand
> entries (no duplicates).

Perhaps you can use .import directive supported by sqlite command line 
shell. You need a file in CSV format, one row per record. Then just do

.import filename tablename

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



      
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to