{"id":293,"date":"2010-10-27T22:39:01","date_gmt":"2010-10-27T20:39:01","guid":{"rendered":"http:\/\/www.albertopasca.it\/whiletrue\/?p=293"},"modified":"2018-05-25T17:10:22","modified_gmt":"2018-05-25T15:10:22","slug":"objective-c-use-database-with-sql-lite","status":"publish","type":"post","link":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/","title":{"rendered":"[Objective-C] Use database with sql (lite)"},"content":{"rendered":"<p>Here a simple tutorial to use\u00a0<strong>SQLite in Objective-C<\/strong>\u00a0to make complex iphone|ipad applications that uses a\u00a0<em>database<\/em>!<\/p>\n<p>First of all, you\u00a0<em>NEED<\/em>\u00a0to\u00a0<a href=\"http:\/\/www.mozilla-europe.org\/it\/firefox\/\"><strong>download Firefox<\/strong><\/a>, after that you need to download and install\u00a0<strong>SQLite Manager<\/strong>\u00a0<em>Add On for Firefox<\/em>\u00a0<a href=\"http:\/\/addons.mozilla.org\/en-US\/firefox\/addon\/5817\/\">from here<\/a>.<br \/>\nThe plugin will be used later\u2026<\/p>\n<p><!--more--><\/p>\n<p>Now, create a new project and\u00a0<em>import SQLite library<\/em>. Generally it is located here:<\/p>\n<blockquote><p>\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/SDKs\/iPhoneOS.X.X.X.sdk\/usr\/lib\/libsqlite3.dylib<\/p><\/blockquote>\n<p><center><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.albertopasca.it\/temp\/frameworks.png\" alt=\"Firefox!\" \/><\/center><br \/>\nIn your header file, you need t add the import and create\u00a0<em>sqlite3<\/em>\u00a0class in your interface:<\/p>\n<p>[code lang=&#8221;java&#8221; autolinks=&#8221;false&#8221; collapse=&#8221;false&#8221; firstline=&#8221;1&#8243; gutter=&#8221;true&#8221; htmlscript=&#8221;false&#8221; light=&#8221;false&#8221; padlinenumbers=&#8221;false&#8221; smarttabs=&#8221;true&#8221; tabsize=&#8221;4&#8243; toolbar=&#8221;false&#8221;]#import &lt;sqlite3 .h&gt;<br \/>\n[&#8230;]<br \/>\nsqlite3\u00a0*database;[\/code]<\/p>\n<p>I show only three method that uses the db,\u00a0<strong>SELECT<\/strong>,\u00a0<strong>DELETE<\/strong>,\u00a0<strong>INSERT<\/strong>.<\/p>\n<p><strong>READ DATA (like SELECT * FROM XXX)<\/strong><\/p>\n<p>[code lang=&#8221;java&#8221; autolinks=&#8221;false&#8221; collapse=&#8221;false&#8221; firstline=&#8221;1&#8243; gutter=&#8221;true&#8221; htmlscript=&#8221;false&#8221; light=&#8221;false&#8221; padlinenumbers=&#8221;false&#8221; smarttabs=&#8221;true&#8221; tabsize=&#8221;4&#8243; toolbar=&#8221;false&#8221;]-\u00a0(NSMutableArray*)\u00a0readDataFromDatabase<br \/>\n{<br \/>\n  dataArray \u00a0=\u00a0[[NSMutableArray\u00a0alloc]\u00a0init];<br \/>\n  dataStored\u00a0=\u00a0[[NSMutableDictionary\u00a0alloc]\u00a0init];<\/p>\n<p>  NSString\u00a0*name;<br \/>\n  NSString\u00a0*address;<\/p>\n<p>  NSArray\u00a0*paths\u00a0=\u00a0NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,\u00a0YES);<br \/>\n  NSString\u00a0*documentsDirectory\u00a0=\u00a0[paths objectAtIndex:0];<br \/>\n  NSString\u00a0*path\u00a0=\u00a0[documentsDirectory stringByAppendingPathComponent:@&quot;MyDB.sqlite&quot;];<\/p>\n<p>  if\u00a0(sqlite3_open([path UTF8String],\u00a0&amp;amp;database)\u00a0==\u00a0SQLITE_OK)\u00a0{<br \/>\n    const\u00a0char\u00a0*sql\u00a0=\u00a0&quot;SELECT * FROM tabella&quot;;<br \/>\n    sqlite3_stmt\u00a0*statement;<br \/>\n    if\u00a0(sqlite3_prepare_v2(database, sql,\u00a0-1,\u00a0&amp;amp;statement,\u00a0NULL)\u00a0==\u00a0SQLITE_OK)\u00a0{<br \/>\n      while\u00a0(sqlite3_step(statement)\u00a0==\u00a0SQLITE_ROW)\u00a0{<br \/>\n        name\u00a0=\u00a0\u00a0\u00a0[NSString\u00a0stringWithUTF8String:(char\u00a0*)sqlite3_column_text(statement,\u00a01)];<br \/>\n        address\u00a0=\u00a0[NSString\u00a0stringWithUTF8String:(char\u00a0*)sqlite3_column_text(statement,\u00a02)];<\/p>\n<p>        [dataStored setObject:name forKey:@&quot;name&quot;];<br \/>\n        [dataStored setObject:address forKey:@&quot;address&quot;];<\/p>\n<p>        [dataArray addObject:[dataStored copy]];<br \/>\n      }<br \/>\n    }<br \/>\n    sqlite3_finalize(statement);<br \/>\n  }<br \/>\n  sqlite3_close(database);<br \/>\n  [dataStored release];<\/p>\n<p>  return\u00a0dataArray;<br \/>\n}[\/code]<\/p>\n<p>In this method, that return a\u00a0<strong>NSMutableArray<\/strong>, I used a\u00a0<strong>NSMutableDictionary<\/strong>\u00a0(dataStored) and a\u00a0<strong>NSMutableArray<\/strong>\u00a0(dataArray).<br \/>\nNow we have a dataArray with lists of the select query!<\/p>\n<p><strong>DELETE DATA FROM xxx<\/strong><\/p>\n<p>[code lang=&#8221;java&#8221; autolinks=&#8221;false&#8221; collapse=&#8221;false&#8221; firstline=&#8221;1&#8243; gutter=&#8221;true&#8221; htmlscript=&#8221;false&#8221; light=&#8221;false&#8221; padlinenumbers=&#8221;false&#8221; smarttabs=&#8221;true&#8221; tabsize=&#8221;4&#8243; toolbar=&#8221;false&#8221;]-\u00a0(void)\u00a0deleteDataFromDatabase:(id)\u00a0data<br \/>\n{<br \/>\n  NSMutableDictionary\u00a0*d\u00a0=\u00a0data;<\/p>\n<p>  NSArray\u00a0*paths\u00a0=\u00a0NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,\u00a0YES);<br \/>\n  NSString\u00a0*documentsDirectory\u00a0=\u00a0[paths objectAtIndex:0];<br \/>\n  NSString\u00a0*path\u00a0=\u00a0[documentsDirectory stringByAppendingPathComponent:@&quot;MyDB.sqlite&quot;];<\/p>\n<p>  sqlite3_stmt\u00a0*delete_statment\u00a0=\u00a0nil;<br \/>\n  if\u00a0(sqlite3_open([path UTF8String],\u00a0&amp;amp;database)\u00a0==\u00a0SQLITE_OK)\u00a0{<br \/>\n    if\u00a0(delete_statment\u00a0==\u00a0nil)\u00a0{<br \/>\n      const\u00a0char\u00a0*sql\u00a0=\u00a0&quot;DELETE FROM tabella WHERE name=? AND address=?&quot;;<br \/>\n      if\u00a0(sqlite3_prepare_v2(database, sql,\u00a0-1,\u00a0&amp;amp;delete_statment,\u00a0NULL)\u00a0!=\u00a0SQLITE_OK)\u00a0{<br \/>\n        NSAssert1(0,\u00a0@&quot;Error: failed to prepare statement with message &#8216;%s&#8217;.&quot;, sqlite3_errmsg(database));<br \/>\n      }<br \/>\n    }<br \/>\n    sqlite3_bind_text(delete_statment,\u00a02,\u00a0[[d objectForKey:@&quot;name&quot;]\u00a0UTF8String],\u00a0-1, \u00a0SQLITE_TRANSIENT);<br \/>\n    sqlite3_bind_text(delete_statment,\u00a03,\u00a0[[d objectForKey:@&quot;address&quot;]\u00a0UTF8String],\u00a0-1, \u00a0SQLITE_TRANSIENT);<\/p>\n<p>    int\u00a0success\u00a0=\u00a0sqlite3_step(delete_statment);<\/p>\n<p>    if\u00a0(success\u00a0!=\u00a0SQLITE_DONE)\u00a0{<br \/>\n      NSAssert1(0,\u00a0@&quot;Error: failed to save priority with message &#8216;%s&#8217;.&quot;, sqlite3_errmsg(database));<br \/>\n    }\u00a0else\u00a0{<br \/>\n      sqlite3_reset(delete_statment);<br \/>\n    }<br \/>\n  }<br \/>\n  sqlite3_close(database);<br \/>\n}[\/code]<\/p>\n<p>Here, you can delete a value from db. (delete from tabella where x=0 and y=0). It accept ad method parameter an object, that is necessary a NSMutableDictionary (first row).<\/p>\n<p><strong>INSERT DATA<\/strong><\/p>\n<p>[code lang=&#8221;java&#8221; autolinks=&#8221;false&#8221; collapse=&#8221;false&#8221; firstline=&#8221;1&#8243; gutter=&#8221;true&#8221; htmlscript=&#8221;false&#8221; light=&#8221;false&#8221; padlinenumbers=&#8221;false&#8221; smarttabs=&#8221;true&#8221; tabsize=&#8221;4&#8243; toolbar=&#8221;false&#8221;]-\u00a0(void)\u00a0insertDataInDatabase:(NSString*)name address:(NSString*)address<br \/>\n{<br \/>\n  sqlite3_stmt\u00a0*insert_statement\u00a0=\u00a0nil;<br \/>\n  NSArray\u00a0*paths\u00a0=\u00a0NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,\u00a0YES);<br \/>\n  NSString\u00a0*documentsDirectory\u00a0=\u00a0[paths objectAtIndex:0];<br \/>\n  NSString\u00a0*path\u00a0=\u00a0[documentsDirectory stringByAppendingPathComponent:@&quot;MyDB.sqlite&quot;];<\/p>\n<p>  if\u00a0(sqlite3_open([path UTF8String],\u00a0&amp;amp;database)\u00a0==\u00a0SQLITE_OK)\u00a0{<br \/>\n    if\u00a0(insert_statement\u00a0==\u00a0nil)\u00a0{<br \/>\n      static\u00a0char\u00a0*sql\u00a0=\u00a0&quot;INSERT INTO tabella (name,address) VALUES(?,?)&quot;;<br \/>\n      if\u00a0(sqlite3_prepare_v2(database, sql,\u00a0-1,\u00a0&amp;amp;insert_statement,\u00a0NULL)\u00a0!=\u00a0SQLITE_OK)\u00a0{<br \/>\n        NSAssert1(0,\u00a0@&quot;Error: failed to prepare statement with message &#8216;%s&#8217;.&quot;, sqlite3_errmsg(database));<br \/>\n      }<\/p>\n<p>      sqlite3_bind_text(insert_statement,\u00a02,\u00a0[name UTF8String],\u00a0-1, \u00a0SQLITE_TRANSIENT\u00a0);<br \/>\n      sqlite3_bind_text(insert_statement,\u00a03,\u00a0[address UTF8String],\u00a0-1, SQLITE_TRANSIENT\u00a0);<br \/>\n    }<\/p>\n<p>    int\u00a0success\u00a0=\u00a0sqlite3_step(insert_statement);<\/p>\n<p>    sqlite3_reset(insert_statement);<br \/>\n    if\u00a0(success\u00a0!=\u00a0SQLITE_ERROR)\u00a0{<br \/>\n      NSLog(@&quot;error&quot;);<br \/>\n    }<br \/>\n  }<br \/>\n  sqlite3_finalize(insert_statement);<br \/>\n  sqlite3_close(database);<br \/>\n}[\/code]<\/p>\n<p>In this method you can add values to the table.<\/p>\n<p>First of all operations, you need call createEditableCopyOfDatabaseIfNeeded that locate (and copy to exec path) the db:<\/p>\n<p>[code lang=&#8221;java&#8221; autolinks=&#8221;false&#8221; collapse=&#8221;false&#8221; firstline=&#8221;1&#8243; gutter=&#8221;true&#8221; htmlscript=&#8221;false&#8221; light=&#8221;false&#8221; padlinenumbers=&#8221;false&#8221; smarttabs=&#8221;true&#8221; tabsize=&#8221;4&#8243; toolbar=&#8221;false&#8221;]-\u00a0(void)\u00a0createEditableCopyOfDatabaseIfNeeded<br \/>\n{<br \/>\n  BOOL\u00a0success;<br \/>\n  NSFileManager\u00a0*fileManager\u00a0=\u00a0[NSFileManager\u00a0defaultManager];<br \/>\n  NSError\u00a0*error;<br \/>\n  NSArray\u00a0*paths\u00a0=\u00a0NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,\u00a0YES);<br \/>\n  NSString\u00a0*documentsDirectory\u00a0=\u00a0[paths objectAtIndex:0];<br \/>\n  NSString\u00a0*writableDBPath\u00a0=\u00a0[documentsDirectory stringByAppendingPathComponent:@&quot;MyDB.sqlite&quot;];<br \/>\n  success\u00a0=\u00a0[fileManager fileExistsAtPath:writableDBPath];<br \/>\n  if\u00a0(success)\u00a0return;<br \/>\n  NSString\u00a0*defaultDBPath\u00a0=\u00a0[[[NSBundle\u00a0mainBundle]\u00a0resourcePath]\u00a0stringByAppendingPathComponent:@&quot;MyDB.sqlite&quot;];<br \/>\n  success\u00a0=\u00a0[fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&amp;amp;error];<br \/>\n  if\u00a0(!success)\u00a0{<br \/>\n    NSAssert1(0,\u00a0@&quot;Failed to create writable database file with message &#8216;%@&#8217;.&quot;,\u00a0[error localizedDescription]);<br \/>\n  }<br \/>\n}[\/code]<\/p>\n<p>It copy current .sqlite file in your device.<\/p>\n<p>Obviously,\u00a0<em>you can load MyDB.sqlite only a once<\/em>, open it and mantain it opened until you completed operations, but this is a\u00a0<em>stupid example<\/em>.<\/p>\n<p><strong>How works Firefox SQLite Manager plugin<\/strong>?<br \/>\n<img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.albertopasca.it\/temp\/sqlite.png\" alt=\"SQLite Firefox Plugin\" \/><br \/>\nIt\u2019s a\u00a0<em>simple GUI<\/em>\u00a0that is used to\u00a0<em>create a DB, insert\/edit\/query values<\/em>.<br \/>\nYou need to\u00a0<em>save db file and import in your project<\/em>.<\/p>\n<p><strong>Happy coding!<\/strong><\/p>\n<p>Rif:\u00a0<a href=\"http:\/\/www.albertopasca.it\/iphone+ipad+application+sviluppo+milano.html\">albertopasca.it<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here a simple tutorial to use\u00a0SQLite in Objective-C\u00a0to make complex iphone|ipad applications that uses a\u00a0database! First of all, you\u00a0NEED\u00a0to\u00a0download Firefox, after that you need to download and install\u00a0SQLite Manager\u00a0Add On for Firefox\u00a0from here. The plugin will be used later\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[167,355,356],"class_list":["post-293","post","type-post","status-publish","format-standard","hentry","category-generic","tag-objectivec","tag-sql","tag-sqlite"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Objective-C] Use database with sql (lite) - while (true) {\u00a0}<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Objective-C] Use database with sql (lite) - while (true) {\u00a0}\" \/>\n<meta property=\"og:description\" content=\"Here a simple tutorial to use\u00a0SQLite in Objective-C\u00a0to make complex iphone|ipad applications that uses a\u00a0database! First of all, you\u00a0NEED\u00a0to\u00a0download Firefox, after that you need to download and install\u00a0SQLite Manager\u00a0Add On for Firefox\u00a0from here. The plugin will be used later\u2026\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/\" \/>\n<meta property=\"og:site_name\" content=\"while (true) {\u00a0}\" \/>\n<meta property=\"article:published_time\" content=\"2010-10-27T20:39:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-05-25T15:10:22+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.albertopasca.it\/temp\/frameworks.png\" \/>\n<meta name=\"author\" content=\"Alberto Pasca\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@lupasca\" \/>\n<meta name=\"twitter:site\" content=\"@lupasca\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alberto Pasca\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/\"},\"author\":{\"name\":\"Alberto Pasca\",\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\"},\"headline\":\"[Objective-C] Use database with sql (lite)\",\"datePublished\":\"2010-10-27T20:39:01+00:00\",\"dateModified\":\"2018-05-25T15:10:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/\"},\"wordCount\":867,\"publisher\":{\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\"},\"image\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.albertopasca.it\\\/temp\\\/frameworks.png\",\"keywords\":[\"objectivec\",\"sql\",\"sqlite\"],\"articleSection\":[\"generic\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/\",\"url\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/\",\"name\":\"[Objective-C] Use database with sql (lite) - while (true) {\u00a0}\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.albertopasca.it\\\/temp\\\/frameworks.png\",\"datePublished\":\"2010-10-27T20:39:01+00:00\",\"dateModified\":\"2018-05-25T15:10:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/#primaryimage\",\"url\":\"http:\\\/\\\/www.albertopasca.it\\\/temp\\\/frameworks.png\",\"contentUrl\":\"http:\\\/\\\/www.albertopasca.it\\\/temp\\\/frameworks.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/objective-c-use-database-with-sql-lite\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Objective-C] Use database with sql (lite)\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#website\",\"url\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/\",\"name\":\"while (true) {\u00a0}\",\"description\":\"notes from a developer, tutorials, how-to, ideas\",\"publisher\":{\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\",\"name\":\"Alberto Pasca\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\",\"caption\":\"Alberto Pasca\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\"},\"description\":\"Software engineer @ Pirelli &amp; C. S.p.A. with a strong passion for mobile \uf8ff development, security, and connected things.\",\"sameAs\":[\"https:\\\/\\\/www.albertopasca.it\",\"albertopasca\",\"https:\\\/\\\/x.com\\\/lupasca\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Objective-C] Use database with sql (lite) - while (true) {\u00a0}","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/","og_locale":"en_US","og_type":"article","og_title":"[Objective-C] Use database with sql (lite) - while (true) {\u00a0}","og_description":"Here a simple tutorial to use\u00a0SQLite in Objective-C\u00a0to make complex iphone|ipad applications that uses a\u00a0database! First of all, you\u00a0NEED\u00a0to\u00a0download Firefox, after that you need to download and install\u00a0SQLite Manager\u00a0Add On for Firefox\u00a0from here. The plugin will be used later\u2026","og_url":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/","og_site_name":"while (true) {\u00a0}","article_published_time":"2010-10-27T20:39:01+00:00","article_modified_time":"2018-05-25T15:10:22+00:00","og_image":[{"url":"http:\/\/www.albertopasca.it\/temp\/frameworks.png","type":"","width":"","height":""}],"author":"Alberto Pasca","twitter_card":"summary_large_image","twitter_creator":"@lupasca","twitter_site":"@lupasca","twitter_misc":{"Written by":"Alberto Pasca","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/#article","isPartOf":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/"},"author":{"name":"Alberto Pasca","@id":"http:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac"},"headline":"[Objective-C] Use database with sql (lite)","datePublished":"2010-10-27T20:39:01+00:00","dateModified":"2018-05-25T15:10:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/"},"wordCount":867,"publisher":{"@id":"http:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac"},"image":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/#primaryimage"},"thumbnailUrl":"http:\/\/www.albertopasca.it\/temp\/frameworks.png","keywords":["objectivec","sql","sqlite"],"articleSection":["generic"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/","url":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/","name":"[Objective-C] Use database with sql (lite) - while (true) {\u00a0}","isPartOf":{"@id":"http:\/\/www.albertopasca.it\/whiletrue\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/#primaryimage"},"image":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/#primaryimage"},"thumbnailUrl":"http:\/\/www.albertopasca.it\/temp\/frameworks.png","datePublished":"2010-10-27T20:39:01+00:00","dateModified":"2018-05-25T15:10:22+00:00","breadcrumb":{"@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/#primaryimage","url":"http:\/\/www.albertopasca.it\/temp\/frameworks.png","contentUrl":"http:\/\/www.albertopasca.it\/temp\/frameworks.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.albertopasca.it\/whiletrue\/objective-c-use-database-with-sql-lite\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.albertopasca.it\/whiletrue\/"},{"@type":"ListItem","position":2,"name":"[Objective-C] Use database with sql (lite)"}]},{"@type":"WebSite","@id":"http:\/\/www.albertopasca.it\/whiletrue\/#website","url":"http:\/\/www.albertopasca.it\/whiletrue\/","name":"while (true) {\u00a0}","description":"notes from a developer, tutorials, how-to, ideas","publisher":{"@id":"http:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.albertopasca.it\/whiletrue\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac","name":"Alberto Pasca","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g","caption":"Alberto Pasca"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g"},"description":"Software engineer @ Pirelli &amp; C. S.p.A. with a strong passion for mobile \uf8ff development, security, and connected things.","sameAs":["https:\/\/www.albertopasca.it","albertopasca","https:\/\/x.com\/lupasca"]}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts\/293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/comments?post=293"}],"version-history":[{"count":2,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts\/293\/revisions"}],"predecessor-version":[{"id":843,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts\/293\/revisions\/843"}],"wp:attachment":[{"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/media?parent=293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/categories?post=293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/tags?post=293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}