Inserting, update and deleteting a database under conditions
- From: Nikos <nikos1337@xxxxxxxxx>
- Date: Wed, 9 Jan 2008 05:17:48 -0800 (PST)
Hello, i'am trying to perl code the following ideas i have commented
as remarks but my attempts were fruitless.
Its complicated and although i tried to work some code, my code does
not do what the remarks say.
#===============================================================================
my @files = glob "$ENV{'DOCUMENT_ROOT'}/data/text/*.txt";
my @menu_files = map m{([^/]+)\.txt}, @files;
my @dbfiles = $db->do( 'SELECT title, body FROM articles' );
my $replace = $db->prepare( 'INSERT INTO article (title, body) VALUES
(?, ?)' );
foreach ( @menu_files ) {
#Check every filename(item in @menu_files) as well as its content
to see if is already inserted in table articles under columns title
and body
#============ INSERT NEW FILENAMES & CONTENTS INTO DATABASE IF ANY
=============
#If filename and content dont already exist in the db then do
insert them
#===== UPDATE THE DB ENTRY IF THERE IS A MODIFICATION IN A FILES
CONTENTS =====
#If filename exists in the db under column title but its content is
different from the database's content then update column body in the
db
#======== DELETE ANY DB ENTRY OF A FILENAME THATDOESNT EXIST ANY
MORE =========
#Delete all db records that doesnt have a corresponding filename in
the hdd
}
.
- Follow-Ups:
- Re: Inserting, update and deleteting a database under conditions
- From: smallpond
- Re: Inserting, update and deleteting a database under conditions
- Prev by Date: Re: problem when submitting a string through a form
- Next by Date: Re: "Enter this obfuscated code before submitting" help needed (CGI)
- Previous by thread: FAQ 7.16 How do I create a static variable?
- Next by thread: Re: Inserting, update and deleteting a database under conditions
- Index(es):