I am trying to store data in the created SQLite database. Here the code is below, I am storing urlStr in a database. Later, I am planning to store several URL strings in the database. I'm trying this as a sample now the problem is, after this code executed, no text is binding in the database.
- (zero) readMediaListFromDatabase {NSString * urlStr = @ "Property-Library: // Property / Asset? JPG ID = 1000000001 & amp; ext = JPG"; // Setup database object sqlite3 * database; // Set some globals database name = @ "MediaList.sqlite"; // Find the path of the document directory and add the database name NSArray * documentPaths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString * DocumentsDIR = [DocumentPath ObjectAntIndex: 0]; Databasepath = [document drink stringpacecpaint: database name]; // Users open database from filesetite (sqlite3_open ([databasePath UTF8String], & database) == SQLITE_OK) {// Set SQL statement and compile it for fast access / / / table name is a mediaist - & Gt; Create the table "Medialist" ("ID" VARAR, "Pathal" VARCHAR) const char * sqlStatement = "Choose from MediList *"; Sqlite3_stmt * Compiled Statement; {Sqlite3_step (compiled state) == SQLITE_ROW} {// Read results in the loop and feeds array (sqlite3_prepare_v2 (database, sqlStatement, -1, and compiled location, zero) == SQLITE_OK) {// Data from row / NSString * aMediaData = [NSString stringWithUTF8String: (four *) sqlite3_column_text (compiled location, 1)]; // NSLog (@ "Amadeadata:% @", AmediaData); } // Full Success = sqlite3_step (compiled location); // NSLog (@ "sqlite3_step:% d", success); // Enter the URL path in the database const char * sql = "Enter the medialist (pathURL) values (?)"; If (sqlite3_prepare_v2 (database, SQL, -1, and compiled location, zero)! = SQLITE_OK) {NSLOG (@ "Error creation before SQLite binding data:% s", sqlite3_errmsg (database)); } Sqlite3_bind_text (compiled locale, 1, [urlStr UTF8 string], -1, SQLITE_TRANSIENT); } // Memory Release compiled from sqlite3_finalize (compiled Statement); } Sqlite3_close (database); }
When I debug the code, there is no error, it is coming up to sqlite3_bind_text and also executing that line. Can correct me, what I do, here I am doing wrong, why is not it binding the text in the database?
Thank you!
I think that you are not actually executing queries
( But in fact, you want to use core data for it!) sqlite3_step (sqlite3_stmt *); / html>
Comments
Post a Comment