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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:11:06+00:00 2026-06-13T13:11:06+00:00

I’m having some unexpected results with the data i’m inserting or replacing into my

  • 0

I’m having some unexpected results with the data i’m inserting or replacing into my sqlite database. To trouble shoot the problem I’m trying to get a full print out of the prepared sqlite3_stmt (statement) in the below code.

What I would like to do is something like this, but I know it doesn’t work:

if (sqlite3_step(statement) == SQLITE_DONE) {
            NSLog(@"%@", statement);

Is there anyway to accomplish this?

Thanks!!

sqlite3_stmt *statement;
const char *dbPath = [databasePath UTF8String];

if (true) {

    ListingsObject *temp = (ListingsObject *) DatabaseObject;

    if (sqlite3_open(dbPath, &conyDB) == SQLITE_OK) {

        const char *insertReplaceStmt = "INSERT OR REPLACE INTO listings (id, association_id, name, email, phone, toll_free_phone, fax, website, street, city, state, zipcode, county, bio, featured, hours, lat, lng, updated, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

        if (sqlite3_prepare_v2(conyDB, insertReplaceStmt, -1, &statement, NULL) == SQLITE_OK) {
            sqlite3_bind_text(statement, 1, [temp._id UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 2, [temp.associationId UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 3, [temp.name UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 4, [temp.email UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 5, [temp.phone UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 6, [temp.tollFreePhone UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 7, [temp.fax UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 8, [temp.website UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 9, [temp.street UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 10, [temp.city UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 11, [temp.state UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 12, [temp.zipcode UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 13, [temp.county UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 14, [temp.bio UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 15, [temp.featured UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 16, [temp.hours UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 17, [temp.lat UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 18, [temp.lng UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 19, [temp.updated UTF8String], -1, SQLITE_TRANSIENT);
            sqlite3_bind_text(statement, 20, [temp.status UTF8String], -1, SQLITE_TRANSIENT);

        }
        if (sqlite3_step(statement) == SQLITE_DONE) {
            NSLog(@"Insert or Replace to Listing Table successful Listing = %@", temp.name);

        }else {
            NSLog(@"Failed to add to Listing table Listing = %@", temp.name);
        }
        sqlite3_finalize(statement);
    }
 sqlite3_close(conyDB);

UPDATE:
I haven’t found an answer to this question. But I needed to move on so I ended up just constructing a string with NSLog(); as below for each one of my tables I had to check:

NSLog(@"     INSERT OR REPLACE INTO listings (id, association_id, name, email, phone, toll_free_phone, fax, website, street, city, state, zipcode, county, bio, featured, hours, lat, lng, updated, status) VALUES (\"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\")", temp._id, temp.associationId, temp.name, temp.email, temp.phone, temp.tollFreePhone, temp.fax
                  , temp.website, temp.street, temp.city, temp.state, temp.zipcode, temp.county, temp.bio, temp.featured, temp.hours, temp.lat, temp.lng, temp.updated, temp.status);
  • 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-13T13:11:07+00:00Added an answer on June 13, 2026 at 1:11 pm

    I did not find any standard method to this, so I made my own:

    -(NSMutableString*) sqlite3StmtToString:(sqlite3_stmt*) statement
    {
        NSMutableString *s = [NSMutableString new];
        [s appendString:@"{\"statement\":["];
        for (int c = 0; c < sqlite3_column_count(statement); c++){
            [s appendFormat:@"{\"column\":\"%@\",\"value\":\"%@\"}",[NSString stringWithUTF8String:(char*)sqlite3_column_name(statement, c)],[NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, c)]];
            if (c < sqlite3_column_count(statement) - 1)
                [s appendString:@","];
        }
        [s appendString:@"]}"];
        return s;
    }
    

    You call it like this:

    NSLog(@"%@",[self sqlite3StmtToString:statement]);
    

    Observation: I did it in same class because I call this with self but you can do in any class

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

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.