How to handle sqlite3_exec error in C while deleting the database?How to list the tables in a SQLite database file that was opened with ATTACH?Improve INSERT-per-second performance of SQLite?tried “DROP TABLE/DROP TABLE IF EXISTS tablename”, but got a SQLITE_LOCKED, instead of SQLITE_DONEHow to delete or add column in SQLITE?SQLite “PRIMARY KEY must be unique” while concurrent SELECT queryOptimize Bulk insert performance in sqlite iphoneWhich gcc options reduce code size?printf and string storage optimizationWriting programs to cope with I/O errors causing lost writes on LinuxWhat is the better way of handling Sqlite3 CORRUPT error (11) in C program?
Caro-Kann c4-c5 push
The answer is a girl's name (my future granddaughter) - can anyone help?
What are one's options when facing religious discrimination at the airport?
Knights and Knaves: What does C say?
A word that refers to saying something in an attempt to anger or embarrass someone into doing something that they don’t want to do?
Does Bank Manager's discretion still exist in Mortgage Lending
Why do Russians sometimes spell "жирный" (fatty) as "жырный"?
Why most footers have a background color as a divider of section?
Could Boris Johnson face criminal charges for illegally proroguing Parliament?
How to interpret the challenge rating of creatures?
How to transcribe an arpeggiated 4-note chord to be playable on a violin?
Should I be an author on another PhD student's paper if I went to their meetings and gave advice?
What does "execute a hard copy" mean?
Is "weekend warrior" derogatory?
How closely correlated is culture to geography?
Everyone Gets a Window Seat
Booting Ubuntu from USB drive on MSI motherboard -- EVERYTHING fails
Avoiding dust scattering when you drill
How do my husband and I get over our fear of having another difficult baby?
Garage door sticks on a bolt
Missing quartile in boxplot
Are there types of animals that can't make the trip to space? (physiologically)
Is there a pattern for handling conflicting function parameters?
Isn't the detector always measuring, and thus always collapsing the state?
How to handle sqlite3_exec error in C while deleting the database?
How to list the tables in a SQLite database file that was opened with ATTACH?Improve INSERT-per-second performance of SQLite?tried “DROP TABLE/DROP TABLE IF EXISTS tablename”, but got a SQLITE_LOCKED, instead of SQLITE_DONEHow to delete or add column in SQLITE?SQLite “PRIMARY KEY must be unique” while concurrent SELECT queryOptimize Bulk insert performance in sqlite iphoneWhich gcc options reduce code size?printf and string storage optimizationWriting programs to cope with I/O errors causing lost writes on LinuxWhat is the better way of handling Sqlite3 CORRUPT error (11) in C program?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I am trying to clear the database after printing the records from the database.But while clearing the database, few times sqlite3_exec is giving an error, due to which database is not getting cleared. I would like to know how to handle these kind of scenarios.
When there is any error while clearing the database, i retry to clear the database one more time. This is one option. I am looking for any other option which i can use for my logic.
errstr = 0;
rc = sqlite3_exec(test_db, "DELETE FROM EMP_TABLE WHERE id = 2", 0, 0, &errstr);
if (rc != SQLITE_OK)
printf("removing record Fails %sn", errstr);
sqlite3_free(errstr);
errstr = 0;
rc = sqlite3_exec(test_db, "VACUUM;", 0, 0, &errstr);
if (rc != SQLITE_OK)
printf("vacuum Fails: %sn", errstr);
sqlite3_free(errstr);
Whenever sqlite3_exec fails, how do i retry to clear database in a optimized way instead of calling same sqlite3_exec once again.
c sqlite
|
show 1 more comment
I am trying to clear the database after printing the records from the database.But while clearing the database, few times sqlite3_exec is giving an error, due to which database is not getting cleared. I would like to know how to handle these kind of scenarios.
When there is any error while clearing the database, i retry to clear the database one more time. This is one option. I am looking for any other option which i can use for my logic.
errstr = 0;
rc = sqlite3_exec(test_db, "DELETE FROM EMP_TABLE WHERE id = 2", 0, 0, &errstr);
if (rc != SQLITE_OK)
printf("removing record Fails %sn", errstr);
sqlite3_free(errstr);
errstr = 0;
rc = sqlite3_exec(test_db, "VACUUM;", 0, 0, &errstr);
if (rc != SQLITE_OK)
printf("vacuum Fails: %sn", errstr);
sqlite3_free(errstr);
Whenever sqlite3_exec fails, how do i retry to clear database in a optimized way instead of calling same sqlite3_exec once again.
c sqlite
Why does it fail?
– Shawn
Mar 28 at 21:41
Not sure, the reason of fail. I haven't debugged the sqlite3 API
– scott
Mar 28 at 22:56
You print out an error message...
– Shawn
Mar 28 at 23:24
Setup a callback error log function and print the error code/message: sqlite.org/errlog.html. So you know what happened and find a solution for the specific error code/message.
– andreaplanet
Mar 29 at 2:05
sure.. I will put the callback function and debug. Whenever there is an error can i retry to delete the data from the database.
– scott
Mar 29 at 15:12
|
show 1 more comment
I am trying to clear the database after printing the records from the database.But while clearing the database, few times sqlite3_exec is giving an error, due to which database is not getting cleared. I would like to know how to handle these kind of scenarios.
When there is any error while clearing the database, i retry to clear the database one more time. This is one option. I am looking for any other option which i can use for my logic.
errstr = 0;
rc = sqlite3_exec(test_db, "DELETE FROM EMP_TABLE WHERE id = 2", 0, 0, &errstr);
if (rc != SQLITE_OK)
printf("removing record Fails %sn", errstr);
sqlite3_free(errstr);
errstr = 0;
rc = sqlite3_exec(test_db, "VACUUM;", 0, 0, &errstr);
if (rc != SQLITE_OK)
printf("vacuum Fails: %sn", errstr);
sqlite3_free(errstr);
Whenever sqlite3_exec fails, how do i retry to clear database in a optimized way instead of calling same sqlite3_exec once again.
c sqlite
I am trying to clear the database after printing the records from the database.But while clearing the database, few times sqlite3_exec is giving an error, due to which database is not getting cleared. I would like to know how to handle these kind of scenarios.
When there is any error while clearing the database, i retry to clear the database one more time. This is one option. I am looking for any other option which i can use for my logic.
errstr = 0;
rc = sqlite3_exec(test_db, "DELETE FROM EMP_TABLE WHERE id = 2", 0, 0, &errstr);
if (rc != SQLITE_OK)
printf("removing record Fails %sn", errstr);
sqlite3_free(errstr);
errstr = 0;
rc = sqlite3_exec(test_db, "VACUUM;", 0, 0, &errstr);
if (rc != SQLITE_OK)
printf("vacuum Fails: %sn", errstr);
sqlite3_free(errstr);
Whenever sqlite3_exec fails, how do i retry to clear database in a optimized way instead of calling same sqlite3_exec once again.
c sqlite
c sqlite
asked Mar 28 at 20:46
scottscott
205 bronze badges
205 bronze badges
Why does it fail?
– Shawn
Mar 28 at 21:41
Not sure, the reason of fail. I haven't debugged the sqlite3 API
– scott
Mar 28 at 22:56
You print out an error message...
– Shawn
Mar 28 at 23:24
Setup a callback error log function and print the error code/message: sqlite.org/errlog.html. So you know what happened and find a solution for the specific error code/message.
– andreaplanet
Mar 29 at 2:05
sure.. I will put the callback function and debug. Whenever there is an error can i retry to delete the data from the database.
– scott
Mar 29 at 15:12
|
show 1 more comment
Why does it fail?
– Shawn
Mar 28 at 21:41
Not sure, the reason of fail. I haven't debugged the sqlite3 API
– scott
Mar 28 at 22:56
You print out an error message...
– Shawn
Mar 28 at 23:24
Setup a callback error log function and print the error code/message: sqlite.org/errlog.html. So you know what happened and find a solution for the specific error code/message.
– andreaplanet
Mar 29 at 2:05
sure.. I will put the callback function and debug. Whenever there is an error can i retry to delete the data from the database.
– scott
Mar 29 at 15:12
Why does it fail?
– Shawn
Mar 28 at 21:41
Why does it fail?
– Shawn
Mar 28 at 21:41
Not sure, the reason of fail. I haven't debugged the sqlite3 API
– scott
Mar 28 at 22:56
Not sure, the reason of fail. I haven't debugged the sqlite3 API
– scott
Mar 28 at 22:56
You print out an error message...
– Shawn
Mar 28 at 23:24
You print out an error message...
– Shawn
Mar 28 at 23:24
Setup a callback error log function and print the error code/message: sqlite.org/errlog.html. So you know what happened and find a solution for the specific error code/message.
– andreaplanet
Mar 29 at 2:05
Setup a callback error log function and print the error code/message: sqlite.org/errlog.html. So you know what happened and find a solution for the specific error code/message.
– andreaplanet
Mar 29 at 2:05
sure.. I will put the callback function and debug. Whenever there is an error can i retry to delete the data from the database.
– scott
Mar 29 at 15:12
sure.. I will put the callback function and debug. Whenever there is an error can i retry to delete the data from the database.
– scott
Mar 29 at 15:12
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406594%2fhow-to-handle-sqlite3-exec-error-in-c-while-deleting-the-database%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406594%2fhow-to-handle-sqlite3-exec-error-in-c-while-deleting-the-database%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why does it fail?
– Shawn
Mar 28 at 21:41
Not sure, the reason of fail. I haven't debugged the sqlite3 API
– scott
Mar 28 at 22:56
You print out an error message...
– Shawn
Mar 28 at 23:24
Setup a callback error log function and print the error code/message: sqlite.org/errlog.html. So you know what happened and find a solution for the specific error code/message.
– andreaplanet
Mar 29 at 2:05
sure.. I will put the callback function and debug. Whenever there is an error can i retry to delete the data from the database.
– scott
Mar 29 at 15:12