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 7827213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:45:58+00:00 2026-06-02T09:45:58+00:00

I build in sqlite3 3 tables. When I’m doing the following SELECT command: select

  • 0

I build in sqlite3 3 tables. When I’m doing the following SELECT command:

select us.saleSpecificProduct,us.fAtMall,u.name,u.gender,st.storeName
  from UsersSale us,Users u,Stores st
 where u.userID=us.userID and st.storeID=us.saleStoreID order by us.saleID

It work ok in the shell, but if i put this statement in my iphone application I’m getting an error.

/*
 * read items from the database and store in itemw
 *
 */
-(void)readItems {

if (!database) return; // earlier problems

// build select statement
if (!selStmt)
{
  const char *sql =  "select us.saleSpecificProduct,us.fAtMall,u.name,u.gender,st.storeName from UsersSale us,Users u,Stores st where u.userID=us.userID and st.storeID=us.saleStoreID order by us.saleID"; 
      if (sqlite3_prepare_v2(database, sql, -1, &selStmt, NULL) != SQLITE_OK)
    {
        selStmt = nil;
    }

When I execute the application I get error in “sqlite3_prepare_v2”
}

What is wrong?

  • 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-02T09:46:00+00:00Added an answer on June 2, 2026 at 9:46 am

    Maybe try putting your parameters inside single quotes

    So something like:

    WHERE u.userID = 'us.userID' AND st.storeID = 'us.saleStoreID' ORDER BY us.saleID
    

    Also you should make use of bindings to get safe statements:

    e.g.

    NSString *strGet = @" . . . WHERE u.userID = ? AND st.storeID = ? ORDER BY us.saleID"
    
    if(sqlite_prepare_v2(...) == SQLITE_OK)
    {
        sqlite3_bind_int(stmtGet, 1, us.userID);
        sqlite3_bind_int(stmtGet, 2, us.saleStoreID);
    
        while(sqlite3_step(stmtGet) == SQLITE_ROW)
        {
            DatabaseDataObject *myDataObj = [[DatabaseDataObject alloc] init];
    
            myDataObj.objID = sqlite3_column_int(0);
            myDataObj.postcode = sqlite3_column_int(1);
    
            // add to parameter array of objects
            [myArr addObject:myDataObj];
    
            [myDataObj release];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I build a query with this format with a sqlite3 database? CREATE
I'm doing a data format conversion from Program A's CSV format to Program B's
How do you prevent SQLite3 from not indexing certain key words, or stop-words, during
UPDATED Finally I used this way to get filtered result. SELECT * FROM statuses
I need to build a SQLite table that will consist of the following columns:
I'm interested in getting the SQLite database containing browsing history from the built in
I build up an array of strings with string[] parts = string.spilt( ); And
I build websites for a small-ish media company. Unfortunately, around 45-50% of our client
My build process consists of Qt's qmake Makefile generator and the typical make utility
Our build process uses Visual Studios 2003 link.exe for linking. On one machine we're

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.