On Tue, Mar 30, 2010 at 9:37 AM, Derek Cannon
<novellterminator / gmail.com> wrote:
>> If you have a relevant amount of data you should look into using a real
>> database to do the searching for you with appropriate indexes.
>
> Well this code is going to be in Rails, searching through a SQLite3
> database. Basically, I have a bunch of movies and my array will update
> as my collection grows, but when I tell it to add more movies to the
> database, I don't want it to add movies that already exist there. Is
> there an even better way to make sure a database entry doesn't exist?

Primary keys and unique indexes in the database ensure that you don't
have duplicated rows.
Are you using ActiveRecord? I don't really get what you say about "my
array will update".

In any case, if you have a database holding your data, don't traverse
an array with all the records to search for a duplicate before
inserting, use the DB facilities...

Jesus.