Re: [Banshee-List] banshee r2992 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Database src/Core/Hyena/Hyena.Data.Sqlite



On Jan 18, 2008 9:47 PM,  <scottp svn gnome org> wrote:
> +        public int IndexOf (int id)
> +        {
> +            select_single_command.ApplyValues (id);
> +            using (IDataReader target_reader = connection.ExecuteReader (select_single_command)) {
> +                if (!target_reader.Read ()) {
> +                    return -1;
> +                }
> +                int target = target_reader.GetInt32 (0);
> +                using (IDataReader first_reader = connection.ExecuteReader (select_first_command)) {
> +                    return first_reader.Read () ? first_reader.GetInt32 (0) - target : -1;
> +                }
> +            }
> +        }

Looking good, Scott.  One thing though: let's only execute (and store
the result of) select_first_command within the Reload method.  Let's
rename id to itemId too.

Gabriel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]