Changeset 167

Show
Ignore:
Timestamp:
03/09/07 02:53:45 (2 years ago)
Author:
kbarnes3
Message:

Fixed the bridge so it properly rejoins servers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dmp/trunk/Bridge/Bridge.cs

    r164 r167  
    363363                                                this.ServerAdded(this, new ServerStatusEventArgs(newServer.Name, true)); 
    364364                                        } 
    365                                        else { //Connection failed 
    366                                                this.ServerAdded(this, new ServerStatusEventArgs(newServer.Name, false)); 
    367                                         } 
     365                                } 
     366                                else { //Connection failed 
     367                                        this.ServerAdded(this, new ServerStatusEventArgs(newServer.Name, false)); 
    368368                                } 
    369369                        } 
  • dmp/trunk/daap-sharp/BridgeDatabase.cs

    r154 r167  
    246246                /// <returns>The libary ID if it's in the database, -1 otherwise</returns> 
    247247                public int getLibraryIdForName(string libName) { 
    248                         IDbCommand cmd = databaseConnection.CreateCommand(); 
     248                        string commandText = "SELECT id FROM libraries WHERE name = @name"; 
     249                        SQLiteCommand command = new SQLiteCommand(commandText, this.databaseConnection); 
     250                        command.Parameters.Add("name", DbType.String).Value = libName; 
    249251                         
    250                         cmd.CommandText = "SELECT id FROM libraries WHERE name = ?"; 
    251                         IDataParameter serverName = cmd.CreateParameter(); 
    252                         cmd.Parameters.Add(serverName); 
    253  
    254                         serverName.Value=libName; 
    255                          
    256                         int libId = -1; 
     252                        long longLibId = -1; 
    257253 
    258254                        databaseConnection.Open(); 
    259                         try{ 
    260                                 libId = (int)cmd.ExecuteScalar(); 
    261                         }  
    262                         catch(Exception e) {} 
    263                         finally { 
     255//                      try{ 
     256                                object scalar = command.ExecuteScalar(); 
     257                                if (scalar != null) { 
     258                                        longLibId = (long)scalar; 
     259                                } 
     260                        //}  
     261                        //catch {} 
     262                        //finally { 
    264263                        databaseConnection.Close(); 
    265                        
    266  
     264                        //
     265                        int libId = (int)longLibId; 
    267266                        return libId; 
    268267                }