亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? book.m

?? This is an example application that shows how to use a SQLlite DB to display information on an iPhon
?? M
字號:
/*     File: Book.m Abstract: The Book class manages the in-memory representation of information about a single book.    Version: 1.9  Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms.  If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software.  In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple.  Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated.  The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.  IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  Copyright (C) 2008 Apple Inc. All Rights Reserved.  */#import "Book.h"// Static variables for compiled SQL queries. This implementation choice is to be able to share a one time// compilation of each query across all instances of the class. Each time a query is used, variables may be bound// to it, it will be "stepped", and then reset for the next usage. When the application begins to terminate,// a class method will be invoked to "finalize" (delete) the compiled queries - this must happen before the database// can be closed.static sqlite3_stmt *insert_statement = nil;static sqlite3_stmt *init_statement = nil;static sqlite3_stmt *delete_statement = nil;static sqlite3_stmt *hydrate_statement = nil;static sqlite3_stmt *dehydrate_statement = nil;@implementation Book// Finalize (delete) all of the SQLite compiled queries.+ (void)finalizeStatements {    if (insert_statement) {        sqlite3_finalize(insert_statement);        insert_statement = nil;    }    if (init_statement) {        sqlite3_finalize(init_statement);        init_statement = nil;    }    if (delete_statement) {        sqlite3_finalize(delete_statement);        delete_statement = nil;    }    if (hydrate_statement) {        sqlite3_finalize(hydrate_statement);        hydrate_statement = nil;    }    if (dehydrate_statement) {        sqlite3_finalize(dehydrate_statement);        dehydrate_statement = nil;    }}// Creates the object with primary key and title is brought into memory.- (id)initWithPrimaryKey:(NSInteger)pk database:(sqlite3 *)db {    if (self = [super init]) {        primaryKey = pk;        database = db;        // Compile the query for retrieving book data. See insertNewBookIntoDatabase: for more detail.        if (init_statement == nil) {            // Note the '?' at the end of the query. This is a parameter which can be replaced by a bound variable.            // This is a great way to optimize because frequently used queries can be compiled once, then with each            // use new variable values can be bound to placeholders.            const char *sql = "SELECT title FROM book WHERE pk=?";            if (sqlite3_prepare_v2(database, sql, -1, &init_statement, NULL) != SQLITE_OK) {                NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(database));            }        }        // For this query, we bind the primary key to the first (and only) placeholder in the statement.        // Note that the parameters are numbered from 1, not from 0.        sqlite3_bind_int(init_statement, 1, primaryKey);        if (sqlite3_step(init_statement) == SQLITE_ROW) {            self.title = [NSString stringWithUTF8String:(char *)sqlite3_column_text(init_statement, 0)];        } else {            self.title = @"No title";        }        // Reset the statement for future reuse.        sqlite3_reset(init_statement);        dirty = NO;    }    return self;}- (void)insertIntoDatabase:(sqlite3 *)db {    database = db;    // This query may be performed many times during the run of the application. As an optimization, a static    // variable is used to store the SQLite compiled byte-code for the query, which is generated one time - the first    // time the method is executed by any Book object.    if (insert_statement == nil) {        static char *sql = "INSERT INTO book (title) VALUES(?)";        if (sqlite3_prepare_v2(database, sql, -1, &insert_statement, NULL) != SQLITE_OK) {            NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(database));        }    }    sqlite3_bind_text(insert_statement, 1, [title UTF8String], -1, SQLITE_TRANSIENT);    int success = sqlite3_step(insert_statement);    // Because we want to reuse the statement, we "reset" it instead of "finalizing" it.    sqlite3_reset(insert_statement);    if (success == SQLITE_ERROR) {        NSAssert1(0, @"Error: failed to insert into the database with message '%s'.", sqlite3_errmsg(database));    } else {        // SQLite provides a method which retrieves the value of the most recently auto-generated primary key sequence        // in the database. To access this functionality, the table should have a column declared of type         // "INTEGER PRIMARY KEY"        primaryKey = sqlite3_last_insert_rowid(database);    }    // All data for the book is already in memory, but has not be written to the database    // Mark as hydrated to prevent empty/default values from overwriting what is in memory    hydrated = YES;}- (void)dealloc {    [title release];    [author release];    [copyright release];    [super dealloc];}- (void)deleteFromDatabase {    // Compile the delete statement if needed.    if (delete_statement == nil) {        const char *sql = "DELETE FROM book WHERE pk=?";        if (sqlite3_prepare_v2(database, sql, -1, &delete_statement, NULL) != SQLITE_OK) {            NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(database));        }    }    // Bind the primary key variable.    sqlite3_bind_int(delete_statement, 1, primaryKey);    // Execute the query.    int success = sqlite3_step(delete_statement);    // Reset the statement for future use.    sqlite3_reset(delete_statement);    // Handle errors.    if (success != SQLITE_DONE) {        NSAssert1(0, @"Error: failed to delete from database with message '%s'.", sqlite3_errmsg(database));    }}// Brings the rest of the object data into memory. If already in memory, no action is taken (harmless no-op).- (void)hydrate {    // Check if action is necessary.    if (hydrated) return;    // Compile the hydration statement, if needed.    if (hydrate_statement == nil) {        const char *sql = "SELECT author, copyright FROM book WHERE pk=?";        if (sqlite3_prepare_v2(database, sql, -1, &hydrate_statement, NULL) != SQLITE_OK) {            NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(database));        }    }    // Bind the primary key variable.    sqlite3_bind_int(hydrate_statement, 1, primaryKey);    // Execute the query.    int success =sqlite3_step(hydrate_statement);    if (success == SQLITE_ROW) {        char *str = (char *)sqlite3_column_text(hydrate_statement, 0);        self.author = (str) ? [NSString stringWithUTF8String:str] : @"";        self.copyright = [NSDate dateWithTimeIntervalSince1970:sqlite3_column_double(hydrate_statement, 1)];    } else {        // The query did not return         self.author = @"Unknown";        self.copyright = [NSDate date];    }    // Reset the query for the next use.    sqlite3_reset(hydrate_statement);    // Update object state with respect to hydration.    hydrated = YES;}// Flushes all but the primary key and title out to the database.- (void)dehydrate {    if (dirty) {        // Write any changes to the database.        // First, if needed, compile the dehydrate query.        if (dehydrate_statement == nil) {            const char *sql = "UPDATE book SET title=?, author=?, copyright=? WHERE pk=?";            if (sqlite3_prepare_v2(database, sql, -1, &dehydrate_statement, NULL) != SQLITE_OK) {                NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_errmsg(database));            }        }        // Bind the query variables.        sqlite3_bind_text(dehydrate_statement, 1, [title UTF8String], -1, SQLITE_TRANSIENT);        sqlite3_bind_text(dehydrate_statement, 2, [author UTF8String], -1, SQLITE_TRANSIENT);        sqlite3_bind_double(dehydrate_statement, 3, [copyright timeIntervalSince1970]);        sqlite3_bind_int(dehydrate_statement, 4, primaryKey);        // Execute the query.        int success = sqlite3_step(dehydrate_statement);        // Reset the query for the next use.        sqlite3_reset(dehydrate_statement);        // Handle errors.        if (success != SQLITE_DONE) {            NSAssert1(0, @"Error: failed to dehydrate with message '%s'.", sqlite3_errmsg(database));        }        // Update the object state with respect to unwritten changes.        dirty = NO;    }    // Release member variables to reclaim memory. Set to nil to avoid over-releasing them     // if dehydrate is called multiple times.    [author release];    author = nil;    [copyright release];    copyright = nil;    [data release];    data = nil;    // Update the object state with respect to hydration.    hydrated = NO;}#pragma mark Properties// Accessors implemented below. All the "get" accessors simply return the value directly, with no additional// logic or steps for synchronization. The "set" accessors attempt to verify that the new value is definitely// different from the old value, to minimize the amount of work done. Any "set" which actually results in changing// data will mark the object as "dirty" - i.e., possessing data that has not been written to the database.// All the "set" accessors copy data, rather than retain it. This is common for value objects - strings, numbers, // dates, data buffers, etc. This ensures that subsequent changes to either the original or the copy don't violate // the encapsulation of the owning object.- (NSInteger)primaryKey {    return primaryKey;}- (NSString *)title {    return title;}- (void)setTitle:(NSString *)aString {    if ((!title && !aString) || (title && aString && [title isEqualToString:aString])) return;    dirty = YES;    [title release];    title = [aString copy];}- (NSString *)author {    return author;}- (void)setAuthor:(NSString *)aString {    if ((!author && !aString) || (author && aString && [author isEqualToString:aString])) return;    dirty = YES;    [author release];    author = [aString copy];}- (NSDate *)copyright {    return copyright;}- (void)setCopyright:(NSDate *)aDate {    if ((!copyright && !aDate) || (copyright && aDate && [copyright isEqualToDate:aDate])) return;    dirty = YES;    [copyright release];    copyright = [aDate copy];}@end

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
蜜臀av亚洲一区中文字幕| 日韩三级免费观看| 久草中文综合在线| 蜜桃一区二区三区在线观看| 从欧美一区二区三区| 成人午夜激情影院| 777午夜精品视频在线播放| 欧美一级黄色大片| 一级日本不卡的影视| 午夜一区二区三区视频| 亚洲猫色日本管| 天天av天天翘天天综合网色鬼国产| 国产成人免费xxxxxxxx| 色综合色狠狠综合色| 欧美日韩一区不卡| 2017欧美狠狠色| 亚洲美女视频一区| 高潮精品一区videoshd| 91香蕉视频污在线| 91精品国产色综合久久久蜜香臀| www国产精品av| 蜜臀99久久精品久久久久久软件 | 国产女人18水真多18精品一级做| 国产精品无圣光一区二区| 亚洲欧美激情视频在线观看一区二区三区 | 亚洲午夜久久久久久久久久久 | 欧美福利一区二区| 国产欧美日韩卡一| 国内精品在线播放| 在线免费观看日韩欧美| 精品久久一区二区三区| 一区二区三区四区视频精品免费| 成人福利视频在线看| 欧美一区二区三区精品| 石原莉奈在线亚洲二区| caoporen国产精品视频| 欧美一区二区三区视频在线观看| 亚洲成人中文在线| 国产麻豆精品在线观看| www.66久久| 亚洲美女电影在线| 欧美午夜不卡视频| 亚洲色欲色欲www| 国产一本一道久久香蕉| 久久久久久久久久久电影| 三级一区在线视频先锋| 日韩欧美中文字幕公布| 韩国一区二区在线观看| 国产精品亲子乱子伦xxxx裸| 91麻豆蜜桃一区二区三区| 亚洲一二三专区| 91色porny在线视频| 亚洲伊人色欲综合网| 337p亚洲精品色噜噜狠狠| 麻豆91免费看| 综合亚洲深深色噜噜狠狠网站| 色94色欧美sute亚洲线路一ni| 国产欧美一区二区精品性色超碰| 不卡视频在线看| 亚洲国产精品嫩草影院| 91精品国产免费久久综合| 国产尤物一区二区| 亚洲精品自拍动漫在线| 91麻豆高清视频| 蜜臀国产一区二区三区在线播放 | 91影视在线播放| 亚洲成人资源在线| 国产亚洲综合av| 国产福利精品导航| 一区二区三区 在线观看视频| 日韩一级精品视频在线观看| 国产69精品一区二区亚洲孕妇| 亚洲精选免费视频| 久久久久久久综合狠狠综合| 日本久久精品电影| 国产精品91一区二区| 欧美精彩视频一区二区三区| 蜜臀va亚洲va欧美va天堂| 国产精品久久久久久久久搜平片| 国产成人av电影在线观看| 亚洲一级二级在线| 国产精品欧美极品| 日韩丝袜情趣美女图片| 色婷婷精品大在线视频| 国精产品一区一区三区mba桃花 | 欧美人体做爰大胆视频| 婷婷成人综合网| 国产精品蜜臀av| 欧美一区午夜视频在线观看| 色女孩综合影院| 国产精品小仙女| 蜜臀久久99精品久久久画质超高清| 自拍偷拍欧美精品| 中文幕一区二区三区久久蜜桃| 日韩欧美一区二区免费| 国产精品影音先锋| 三级成人在线视频| 一区二区久久久久| 中文字幕亚洲在| 欧美日韩成人综合在线一区二区| 国产成人av电影在线播放| 久久国产欧美日韩精品| 国产精品久久综合| 久久精品人人爽人人爽| 精品99久久久久久| 色综合久久99| 91在线视频在线| 日韩高清在线一区| 久久精品欧美一区二区三区麻豆 | 蜜臀av性久久久久蜜臀av麻豆| 亚洲一区视频在线观看视频| 亚洲丝袜精品丝袜在线| 中文字幕制服丝袜一区二区三区| 国产视频一区二区三区在线观看| 精品福利在线导航| 久久综合色之久久综合| 久久婷婷成人综合色| 久久综合丝袜日本网| 国产人成一区二区三区影院| 国产视频一区二区三区在线观看| 久久久久久亚洲综合影院红桃| 国产日本欧美一区二区| 国产精品嫩草99a| 亚洲欧美另类综合偷拍| 亚洲综合偷拍欧美一区色| 香蕉成人啪国产精品视频综合网| 亚洲午夜激情av| 美女爽到高潮91| 国产一区二区三区在线观看免费| 国产一区二区视频在线| www.日韩av| 欧美在线|欧美| 欧美一区二区免费视频| 久久色在线视频| 中文字幕在线一区二区三区| 亚洲激情图片qvod| 日韩高清不卡在线| 国产精品一二二区| 色香蕉成人二区免费| 欧美剧情电影在线观看完整版免费励志电影 | 精品一区二区三区在线播放| 精彩视频一区二区三区| 不卡在线观看av| 欧美精品久久久久久久久老牛影院| 日韩视频免费观看高清完整版| 国产午夜亚洲精品午夜鲁丝片| 中文字幕日本不卡| 日韩高清不卡在线| 亚洲成人激情社区| 国内成人自拍视频| 欧洲色大大久久| 久久久久久久久久久久电影| 一卡二卡三卡日韩欧美| 国产中文字幕一区| 欧美性感一类影片在线播放| 337p日本欧洲亚洲大胆色噜噜| 国产精品福利一区| 九九**精品视频免费播放| 91麻豆免费视频| 欧美精品一区二区三区四区 | 日韩午夜激情免费电影| 国产精品久久精品日日| 奇米色一区二区| 日本不卡高清视频| 99精品国产视频| 精品99一区二区三区| 亚洲va国产天堂va久久en| 成人性色生活片免费看爆迷你毛片| 欧美三级日本三级少妇99| 欧美国产一区二区| 美女免费视频一区| 欧美自拍偷拍一区| 国产精品免费网站在线观看| 久久国产精品第一页| 欧美猛男男办公室激情| 综合网在线视频| 丁香一区二区三区| 欧美精品一区二区三区很污很色的| 亚洲一区二区在线免费观看视频 | 国产精品欧美久久久久一区二区| 美女视频一区二区| 欧美一区二区三区免费视频| 亚洲乱码中文字幕综合| av一区二区久久| 久久久久国产精品人| 久久99久久久久久久久久久| 欧美日韩一区二区不卡| 一区二区三区高清不卡| av欧美精品.com| 国产精品美日韩| 懂色av一区二区夜夜嗨| 国产三级一区二区| 国产精品1区2区| 久久久久久夜精品精品免费| 久久精品国产第一区二区三区| 51午夜精品国产| 日本一区中文字幕| 欧美一级免费大片| 另类小说综合欧美亚洲| 日韩精品一区二区在线|