Thanks for the tips. I think I've narrowed down my problem to a DBI:ADO
issue and this bit of code


def tmf_insert_new_file(name, length, creation_time, directory_name,
extension, fullname, is_read_only, last_access_time, last_write_time,
filetype, parent_directory)

   strInsert = " SET NOCOUNT ON INSERT INTO tblMasterFiles ([Name],
[Length], [CreationTime], [DirectoryName], [Extension], [FullName],
[IsReadOnly], [LastAccessTime], [LastWriteTime],  [FileType],
[ParentDirectory]) VALUES ('#{name}', '#{length}', '#{creation_time}',
'#{directory_name}', '#{extension}', '#{fullname}', '#{is_read_only}',
'#{last_access_time}', '#{last_write_time}', '#{filetype}',
'#{parent_directory}'); SELECT @@IDENTITY As myKey"

    myKey = ""

     @dbh.execute(strInsert) do |sth|
        myKey = sth.fetch_all
     end

    @dbh.commit()

    return myKey.to_s


    rescue DBI::DatabaseError => e
     puts "An error occurred in tmf_insert_new_file"
     puts "Error code: #{e.err}"
     puts "Error message: #{e.errstr}"

  end


I was able to get some improvements by initializing the database handle
when the class is instantiated as an instance variable and setting
NonBlocking to true in the connection string. But I am still missing
inserts. For example, I dragged a folder with 218 file/directories and
got 180 inserted in the db. So we are still missing 38. But it is
better than just getting 1 inserted.



Jan Svitok wrote:
> On 12/28/06, Jan Svitok <jan.svitok / gmail.com> wrote:
> Sorry, my kbd went wrong :(
>
> > On 12/27/06, lrlebron / gmail.com <lrlebron / gmail.com> wrote:
> > > I have created a script to monitor a directory and update a database
> >
> > Hi, don't know the solution, just a small off-topic hint:
> >
> > you can write this
> >
> > >           myMatch = @excluded_dirs.select{|e| fullname.include?e}
> > >           if myMatch.length == 0
> >
> > as
> >               unless @excluded_dirs.any?{|e| fullname.include?e}
> >
> > and this
> > >           if not @excluded_files == nil and @excluded_files.length > 0
> >
> >               if not @excluded_files.nil? and not @excluded_files.empty?
> > or
>                   unless @excluded_files.nil? or @excluded_files.empty?