masakih

あれとこれコンバータ (プロジェクト終了)

  • R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoapythonrubywindowsphpgameguibathyscaphec翻訳omegatframework計画中(planning stage)twitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

あれとこれのコンバータ


Commit MetaInfo

Révisiona847337977809a42ffde6d8163ca254314ff88fa (tree)
l'heure2011-12-03 01:02:59
Auteurmasakih <masakih@user...>
Commitermasakih

Message de Log

お気に入りコンバート

Change Summary

Modification

--- a/BathyScapheDataConverter/BSDCAppDelegate.m
+++ b/BathyScapheDataConverter/BSDCAppDelegate.m
@@ -16,6 +16,7 @@
1616
1717 #import "BSBoardInformationObject.h"
1818 #import "BSThreadInformationObject.h"
19+#import "BSFavoriteObject.h"
1920
2021
2122 @implementation BSDCAppDelegate
@@ -87,6 +88,17 @@
8788 query = [[SQLiteReservedQuery alloc] initWithQuery:sql usingSQLiteDB:[[DatabaseManager defaultManager] databaseForCurrentThread]];
8889 return query;
8990 }
91+- (SQLiteReservedQuery *)sqlForInsertFav
92+{
93+ static SQLiteReservedQuery *query = nil;
94+ if(query) return query;
95+
96+ NSString *sql = [NSString stringWithFormat:@"INSERT INTO %@ (%@, %@) VALUES (?, ?);",
97+ FavoritesTableName,
98+ BoardIDColumn, ThreadIDColumn];
99+ query = [[SQLiteReservedQuery alloc] initWithQuery:sql usingSQLiteDB:[[DatabaseManager defaultManager] databaseForCurrentThread]];
100+ return query;
101+}
90102 - (void)convertBoards:(NSArray *)boards
91103 {
92104 DatabaseManager *dm = [DatabaseManager defaultManager];
@@ -197,8 +209,19 @@
197209 [pool release];
198210 [self updateTime];
199211
212+ pool = [[NSAutoreleasePool alloc] init];
200213 panel.message = @"Converting Favorites ...";
201214 // Fav
215+ DatabaseManager *dm = [DatabaseManager defaultManager];
216+ NSArray *favs = [cdm fetchDataForEntityName:@"Favorite"
217+ predicate:nil];
218+ for(BSFavoriteObject *fav in favs) {
219+// NSLog(@"%@", fav.thread.board.boardName);
220+ NSUInteger boardID = [dm boardIDForURLString:fav.thread.board.boardURL];
221+ SQLiteReservedQuery *query = [self sqlForInsertFav];
222+ [query cursorWithFormat:F_Int F_NSNumberOfInt,
223+ boardID, fav.thread.threadID];
224+ }
202225
203226 finish:
204227 [pool release];