Hi all.

I have the following table to keep a count of the number of 
times files are downloaded from my website:

CREATE TABLE "file_downloads"
  (
  "record_id" INTEGER PRIMARY KEY,

  "filename" char(60),

  "dl_count" INTEGER

   /* PRIMARY KEY  ("record_id") */
);


The select statement to get the current download count for a 
file is:

SELECT *
from file_downloads
where filename = "$dl_file";

And the update statement to update the dl_count column is:

UPDATE file_downloads set
dl_count = "$new_count"
where filename = "$dl_file";

Would this be an efficient way of doing things?

I don't expect to be keeping track of more than 200 files 
for downloading.

I was wondering if it is possible to setup the filename 
column as a UNIQUE PRIMARY KEY on a TEXT column. Is that 
possible? I don't need FTS capabilities, just want to make 
the filename column a UNIQUE column, so there is only one 
row with that particular filename.

Kind Regards,

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to