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

  • Home
  • SEARCH
  • 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 7768587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:57:06+00:00 2026-06-01T15:57:06+00:00

My code is: const char *sqlInsertString; sqlite3_stmt *addStatement; sqlInsertString=sqlite3_mprintf(insert into AnimalTable(name,propertyID,animalID,breed,dateofbirth,sex,notes,imageData) values (‘%s’,’%s’,’%s’,’%s’,’%s’,’%s’,’%s’,’%d’),nameString,propertyString,animalidString,breedString,dateofbirth,sexString,notesString,imageData); if

  • 0

My code is:

const char *sqlInsertString;
sqlite3_stmt *addStatement;
sqlInsertString=sqlite3_mprintf("insert into AnimalTable(name,propertyID,animalID,breed,dateofbirth,sex,notes,imageData) values" "('%s','%s','%s','%s','%s','%s','%s','%d')",nameString,propertyString,animalidString,breedString,dateofbirth,sexString,notesString,imageData);
    if (sqlite3_open([sqlFile UTF8String],&database)==SQLITE_OK) {
        sqlite3_prepare_v2(database, sqlInsertString, -1, &addStatement, NULL);
        if (sqlite3_step(addStatement)==SQLITE_DONE) {
            sqlite3_bind_blob(addStatement, 1, [imageData bytes], [imageData length], NULL);
            sqlite3_finalize(addStatement);
            NSLog(@"Data saved");

        }
        else
            NSLog(@"Some Error occurred");
    }

    sqlite3_close(database);

I guess I am doing something wrong, cant figure it out.
Its showing some error occurred msg, whenever i add data to sqlite.
And also getting exception NSInternalInconsistencyException no such table:AnimalTable.
But AnimalTable exist and when i execute the query in sqlmanager it runs properly.

  • 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-01T15:57:07+00:00Added an answer on June 1, 2026 at 3:57 pm

    Following code is use for the storing the blob type of data store,

    May this helping to you

     if(sqlite3_prepare_v2(database, sqlInsertQry, -1, &compiledStmt, NULL) == SQLITE_OK ){
                    for (NSDictionary *dObj in arForData) {
                         sqlite3_bind_blob(compiledStmt,1,[[dObj valueForKey:@"NotiData"] bytes],[[dObj valueForKey:@"NotiData"] length],NULL);
                        PUT_Date(2,@"fireDate");
    
    
                        NSUInteger err = sqlite3_step(compiledStmt);
                        if (err != SQLITE_DONE){
                            //NSLog(@"error while binding %d %s",err, sqlite3_errmsg(database));
                            //NSLog(@"%@",dObj);
                        }
                        sqlite3_reset(compiledStmt);
                    }
                    sqlite3_finalize(compiledStmt);     
                } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this code: const char* someFun() { // ... some stuff return Some text!!
I used this code: const char *propName = property_getName(property); NSString *propertyName = [NSString stringWithCString:propName];
i have the following code below: const char* timeformat = %Y-%m-%d %H:%M:%S; const int
In code: struct Rep { const char* my_data_; Rep* my_left_; Rep* my_right_; Rep(const char*);
Having code: Date::Date(const char* day, const char* month, const char* year):is_leap__(false) { my_day_ =
Here is my code: void subroutine(const char *message) { printf(message); } And here is
I have the following: classA::FuncA() { ... code FuncB(); ... code } classA::FuncB(const char
In the below code snippet can i replace char * to const char *
ERROR CODE: CList<CString,const char*> test; ERROR INFO: ECLIPSE / UBUNTU 10 /home/latyas/workspace/CList/Debug/../test.cpp:7: undefined reference
Suppose we have the following method (it is in c code): const char *bitap_search(const

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.