Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 06-29-2011, 02:26 AM   #1 (permalink)
Registered Member
 
ManWithMask's Avatar
 
Join Date: Mar 2010
Location: Stellenbosch, South Africa
Posts: 88
ManWithMask is on a distinguished road
Send a message via Skype™ to ManWithMask
Cool SQLite3 select returns error 26

I have an app that has been doing a SQLite3 select statement perfectly before I upgraded to Xcode 4. I have not changed anything.

Somehow it now says that my SQLite3 database is no longer a database (returns error 26), yet I am able to open and edit it in Base 2.1 (895).

Does anyone know please if anything in Xcode 4 was deprecated, which would cause this to happen?

Here is my select method:

Code:
if (sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK) {
		
	
		//*Get key
		NSMutableDictionary		*newbusinessData = [NewBusiness getData];//Call my Singleton
		int AgeNBKey = [[newbusinessData objectForKey:@"AgeNB"] integerValue];
		NSLog(@"AgeNBKey: %i:",AgeNBKey);
		
		NSString *s = [NSString stringWithFormat:@"SELECT Rate from PremiumRates WHERE AgeNB = %i", AgeNBKey];
		NSLog(@"s: %@",s);
		
		const char *sql = [s cStringUsingEncoding:NSASCIIStringEncoding];
		sqlite3_stmt *selectstmt;
		
		int num = sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL);
		if(num == SQLITE_OK) {
			NSLog( @"Error LOG: %s", sqlite3_errmsg(database) );

		}else{
			NSLog(@"num:%d", num);//if 26 then File opened that is not a database file 
		}
				
		if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) {
			
			while(sqlite3_step(selectstmt) == SQLITE_ROW) {
				
				NSInteger queryKey = sqlite3_column_int(selectstmt, 0);
				PremiumRates  *manObj = [[PremiumRates alloc] initWithPrimaryKey:queryKey];
				
				manObj.Rate = [[NSDecimalNumber alloc] initWithDouble:sqlite3_column_double(selectstmt, 0)];	
				
				manObj.isDirty = NO;
				
				[newbusinessData setValue: manObj.Rate forKey:@"PremiumRate"];
				//Write to Plist
				NSString *plistPath = [NewBusiness getPath];//Call my Singleton
				[newbusinessData writeToFile:plistPath atomically:YES];
				[manObj release];
				
			
			}
		}
	}
		else
			sqlite3_close(database); //Even though the open call failed, close the database connection to release all the memory.
}
__________________
iPhone Apps: Who SAid™, iFRICA™, iFA™, iReceipt™,eCash™
ManWithMask is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 383
18 members and 365 guests
Absentia, AyClass, Diligent, dre, givensur, hussain1982, jbro, jPuzzle, momolgtm, Newbie123, Paul10, revg, sacha1996, skog, skrew88, taylor202, tomtom100
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,643
Threads: 94,110
Posts: 402,858
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Diligent
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:44 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0