Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8130931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:54:50+00:00 2026-06-06T08:54:50+00:00

I have made a SQLite application for my iPhone. When i test my SELECT

  • 0

I have made a SQLite application for my iPhone.
When i test my SELECT on my SQLite DB placed on my iMac everything works fine, but when on iPhone i get no rows returned.

SELECT ID, SAP_PART_NR, SAP_DESC, MOQ, INC, NLT, DISCOUNT_CODE, AD_EURO, AD_USD, OEM_EURO, OEM_USD FROM Component WHERE SAP_PART_NR LIKE '%AWM423%' LIMIT 200

Now the strange part

When i use the select below on the iPhone, one record returns with the SAP_PART_NR AWM42300V

SELECT ID, SAP_PART_NR, SAP_DESC, MOQ, INC, NLT, DISCOUNT_CODE, AD_EURO, AD_USD, OEM_EURO, OEM_USD FROM Component WHERE SAP_PART_NR LIKE '%AWM42%' LIMIT 200

Both selects returns a row (as they should), when tested on the iMac

Is it some kind of bug on the iPhone/SQlite ?

i’m not able to figure it out….All my hair has turned grey….:-(

Non working code (no rows selected)

-(void) searchDB:(NSString *)strSearch {

    NSString *wildcardSearch = [NSString stringWithFormat:@"%%%@%%", strSearch];

    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

    if(searchSTMT == nil) {
       const char *sql = "SELECT ID, SAP_PART_NR, SAP_DESC, MOQ, INC, NLT, DISCOUNT_CODE, AD_EURO, AD_USD, OEM_EURO, OEM_USD FROM Component WHERE SAP_PART_NR LIKE '%AWM4230%'";
        if(sqlite3_prepare_v2(database, sql, -1, &searchSTMT, NULL) != SQLITE_OK)
            NSAssert1(0, @"Error while creating view statement. '%s'", sqlite3_errmsg(database));
    }

    if(SQLITE_DONE != sqlite3_step(searchSTMT)) {

        while(sqlite3_step(searchSTMT) == SQLITE_ROW) {

            NSInteger primaryKey = sqlite3_column_int(searchSTMT, 0);
            Database *DatabaseObj = [[Database alloc] initWithPrimaryKey:primaryKey];
            DatabaseObj.sapPart = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 1)];
            DatabaseObj.sapDesc = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 2)];
            DatabaseObj.sapMOQ = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 3)];                
            DatabaseObj.sapINC = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 4)];                 
            DatabaseObj.sapNLT = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 5)];
            DatabaseObj.sapDISCOUNT = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 6)]; 

            DatabaseObj.oemEURO = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 7)];
            DatabaseObj.oemUSD = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 8)];    
            DatabaseObj.adEURO = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 9)];         
            DatabaseObj.adUSD = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchSTMT, 10)];                        

            [appDelegate.compArray addObject:DatabaseObj];
        }
    }
    else 
        NSAssert1(0, @"Error while getting the rows. '%s'", sqlite3_errmsg(database));

    //Reset the detail statement.
    sqlite3_reset(searchSTMT);

}

working code 1 row selected

+ (void) getInitialDataToDisplay:(NSString *)dbPath {<p>
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    sqlite3_stmt *selectstmt = NULL;

    if (sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK) {

       const char *sql = "SELECT ID, SAP_PART_NR, SAP_DESC, MOQ, INC, NLT, DISCOUNT_CODE, AD_EURO, AD_USD, OEM_EURO, OEM_USD FROM Component WHERE SAP_PART_NR LIKE '%AWM4230%'";

        if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) {

            while(sqlite3_step(selectstmt) == SQLITE_ROW) {

                NSInteger primaryKey = sqlite3_column_int(selectstmt, 0);
                Database *DatabaseObj = [[Database alloc] initWithPrimaryKey:primaryKey];
                DatabaseObj.sapPart = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 1)];
                DatabaseObj.sapDesc = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 2)];
                DatabaseObj.sapMOQ = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 3)];                
                DatabaseObj.sapINC = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 4)];                 
                DatabaseObj.sapNLT = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 5)];
                DatabaseObj.sapDISCOUNT = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 6)]; 
                //PRICES
                DatabaseObj.oemEURO = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 7)]; 
                DatabaseObj.oemUSD = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 8)];    
                DatabaseObj.adEURO = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 9)];         
                DatabaseObj.adUSD = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 10)];                      

                [appDelegate.compArray addObject:DatabaseObj];
            }
        }
    }
    else
        sqlite3_close(database); //Even though the open call failed, close the database connection to release all the memory.

    sqlite3_reset(selectstmt);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:54:52+00:00Added an answer on June 6, 2026 at 8:54 am

    Solved – look in the comments. I’m still not 100% sure why/how this solved it though..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have made a few multi activity database applications using sqlite, but i get
I am new in iphone development, and I have made a simple application for
I have a pre-made SQLite database that I am downloading from the net via
I have made this code to open a database(created in SQLite browser) stored in
I have made an application for IPad in objective C. In this I am
i have made an application having entity framewrok. It is wpf application, now it
I have made a cart and the cart has remove item button, but the
I have an application I'm porting from MSSQL and .NET to SQLite and Mono.
I have a Ruby 1.8.7 application that works correctly locally. To load it on
Say I have a multithreaded application made up of two separate threads and a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.