Changeset 167
- Timestamp:
- 03/09/07 02:53:45 (2 years ago)
- Files:
-
- dmp/trunk/Bridge/Bridge.cs (modified) (1 diff)
- dmp/trunk/daap-sharp/BridgeDatabase.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dmp/trunk/Bridge/Bridge.cs
r164 r167 363 363 this.ServerAdded(this, new ServerStatusEventArgs(newServer.Name, true)); 364 364 } 365 else { //Connection failed366 this.ServerAdded(this, new ServerStatusEventArgs(newServer.Name, false));367 }365 } 366 else { //Connection failed 367 this.ServerAdded(this, new ServerStatusEventArgs(newServer.Name, false)); 368 368 } 369 369 } dmp/trunk/daap-sharp/BridgeDatabase.cs
r154 r167 246 246 /// <returns>The libary ID if it's in the database, -1 otherwise</returns> 247 247 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; 249 251 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; 257 253 258 254 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 { 264 263 databaseConnection.Close(); 265 }266 264 //} 265 int libId = (int)longLibId; 267 266 return libId; 268 267 }
