LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-04-2012, 04:12 AM   #1
batman4
Member
 
Registered: Jul 2012
Posts: 47

Rep: Reputation: Disabled
sending queries in sqlite3 database via c API


HI I want to send multiple queries through this program sqlite3_prepare() .pls help

Code:
#include <stdio.h>
#include "sqlite3.h"
int main(void) {
        sqlite3* db = 0;
        sqlite3_stmt* stmt = 0;
        int retcode;
        retcode = sqlite3_open("test.db", &db); /* Open a database named MyDB */
        if (retcode != SQLITE_OK){
                sqlite3_close(db);
                fprintf(stderr, "Could not open MyDB\n");
                return retcode;
        }
        else
            printf("connection established\n");

        retcode = sqlite3_prepare(db, "select * from abc", -1, &stmt, 0);
        if (retcode != SQLITE_OK)
        {
                sqlite3_close(db);
                fprintf(stderr, "Could not execute SELECT\n");
                return retcode;
}
return 0;
sqlite3_close();
}
 
Old 09-06-2012, 12:58 AM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
1. why do you use deprecated _prepare instead of _prepare_v2?
2. where is _step calling?
3. where is _finalize?
 
  


Reply

Tags
sqlite3



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there an api for receiving/sending faxes within a linux os? Benny7440 Linux - Software 3 04-27-2012 02:47 PM
LXer: Speed Up DPKG With TDPKG (Using A Tokyocabinet Or Sqlite3 Database) LXer Syndicated Linux News 0 03-17-2010 01:11 PM
Loop or check SQlite3 database continuously, when query found run script for first 3 Techno Guy Linux - Newbie 3 09-27-2009 07:46 PM
ORA-01219: database not open: queries allowed on fixed tables/views only linareja Linux - Software 2 10-13-2008 09:45 AM
LXer: Q&a: SAP Exec Fields Database Queries, Zings Oracle LXer Syndicated Linux News 0 12-11-2005 03:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration