Forgiving my reasons for doing this, it seems that every time I do, MediaMonkey hangs on the subsequent startup.
If I remove the tables I've created with a program like SQLite Maestro, MediaMonkey will startup again.
Maybe someone can instruct me as to what I'm doing wrong.
- Code: Select all
Function CheckTableExists (tableName)
Dim tableResult
Set tableResult = SDB.Database.OpenSQL("SELECT name FROM sqlite_master WHERE type='table' AND name='" + tableName + "'")
Dim found
found = False
While Not tableResult.EOF
found = True
WEnd
Set tableResult = Nothing
CheckTableExists = found
End Function
Sub EnsureSystemTablesExist
If Not CheckTableExists("SpadeAlbumCollections") Then
SDB.Database.ExecSql("CREATE TABLE SpadeAlbumCollections (ID integer PRIMARY KEY AUTOINCREMENT, Name text COLLATE IUNICODE)")
End If
If Not CheckTableExists("SpadeAlbumCollectionList") Then
SDB.Database.ExecSql("CREATE TABLE SpadeAlbumCollectionList (ID integer PRIMARY KEY AUTOINCREMENT, AlbumCollection_ID integer, Artist text COLLATE IUNICODE, Album text COLLATE IUNICODE, AlbumOrder integer, AlbumID integer)")
End If
End Sub
Sub OnStartUp()
EnsureSystemTablesExist
End Sub

