Is there a way to undo SQLite3 step call in C/C++?sqlite step backWhat are the differences between a pointer variable and a reference variable in C++?How can I profile C++ code running on Linux?The Definitive C++ Book Guide and ListWhat is the effect of extern “C” in C++?What is the “-->” operator in C++?Improve INSERT-per-second performance of SQLite?Easiest way to convert int to string in C++C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Why is reading lines from stdin much slower in C++ than Python?In sqlite3, is reset required after a failed call to step?

How to deal with my team leader who keeps calling me about project updates even though I am on leave for personal reasons?

My 15 year old son is gay. How do I express my feelings about this?

Social leper versus social leopard

Has my MacBook been hacked?

If the EU does not offer an extension to UK's Article 50 invocation, is the Benn Bill irrelevant?

I reverse the source code, you negate the output!

Who created the Lightning Web Component?

Wrong result by FindRoot

How can an attacker use robots.txt?

The quicker I go up, the sooner I’ll go down - Riddle

How to ask a man to not take up more than one seat on public transport while avoiding conflict?

Can the U.S. president make military decisions without consulting anyone?

Why are there two fundamental laws of logic?

Will Proving or Disproving of any of the following have effects on Chemistry in general?

Is there any reason nowadays to use a neon indicator lamp instead of an LED?

The 100 soldier problem

I feel like most of my characters are the same, what can I do?

How much damage can be done just by heating matter?

Do things made of adamantine rust?

How to check if system supports 64-bit PCIe decoding?

What is the need of methods like GET and POST in the HTTP protocol?

How do I improve in sight reading?

Leaving a job that I just took based on false promise of a raise. What do I tell future interviewers?

Are there non JavaScript ways to hide HTML source code?



Is there a way to undo SQLite3 step call in C/C++?


sqlite step backWhat are the differences between a pointer variable and a reference variable in C++?How can I profile C++ code running on Linux?The Definitive C++ Book Guide and ListWhat is the effect of extern “C” in C++?What is the “-->” operator in C++?Improve INSERT-per-second performance of SQLite?Easiest way to convert int to string in C++C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?Why is reading lines from stdin much slower in C++ than Python?In sqlite3, is reset required after a failed call to step?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















The system I'm working with uses an SQLite3 database as a background log storage with each entry as a two-column entry : |time|data|. Replaying the log is as simple as preparing a statement to get all entries, and each sqlite3_step() call returns the data at time.



Since then, we've attempted to instrument specialized tools to advance and skip as we've needed. Now, we find ourselves in a situation where we need to go backwards by one or more entries. Is there a way without resetting and/or generating a new query to undo the entry-advancement that happens with sqlite3_step()?



sqlite3_reset() isn't an appropriate solution as this returns the database pointer back to the first entry in the database. I am looking to go back to the immediately previous entry of the last sqlite3_step() call.










share|improve this question





















  • 1





    Possible duplicate of sqlite step back

    – user1810087
    Mar 28 at 15:27






  • 1





    Save the data from the rows you've already seen in your data structure of choice, and use that to look at prior records.

    – Shawn
    Mar 28 at 15:41











  • For some of these, we're talking on the order of GB to TB of data; we didn't want to pre-read because of the overall slowdown and resource footprint for some of the tools using this data. With regard to the "sqlite step back" duplication: sqlite_reset() is not an option as it takes you back to the first entry in the database. I'm looking to go to the immediately previous-retrieved entry.

    – jhill515
    Mar 28 at 16:05

















0















The system I'm working with uses an SQLite3 database as a background log storage with each entry as a two-column entry : |time|data|. Replaying the log is as simple as preparing a statement to get all entries, and each sqlite3_step() call returns the data at time.



Since then, we've attempted to instrument specialized tools to advance and skip as we've needed. Now, we find ourselves in a situation where we need to go backwards by one or more entries. Is there a way without resetting and/or generating a new query to undo the entry-advancement that happens with sqlite3_step()?



sqlite3_reset() isn't an appropriate solution as this returns the database pointer back to the first entry in the database. I am looking to go back to the immediately previous entry of the last sqlite3_step() call.










share|improve this question





















  • 1





    Possible duplicate of sqlite step back

    – user1810087
    Mar 28 at 15:27






  • 1





    Save the data from the rows you've already seen in your data structure of choice, and use that to look at prior records.

    – Shawn
    Mar 28 at 15:41











  • For some of these, we're talking on the order of GB to TB of data; we didn't want to pre-read because of the overall slowdown and resource footprint for some of the tools using this data. With regard to the "sqlite step back" duplication: sqlite_reset() is not an option as it takes you back to the first entry in the database. I'm looking to go to the immediately previous-retrieved entry.

    – jhill515
    Mar 28 at 16:05













0












0








0








The system I'm working with uses an SQLite3 database as a background log storage with each entry as a two-column entry : |time|data|. Replaying the log is as simple as preparing a statement to get all entries, and each sqlite3_step() call returns the data at time.



Since then, we've attempted to instrument specialized tools to advance and skip as we've needed. Now, we find ourselves in a situation where we need to go backwards by one or more entries. Is there a way without resetting and/or generating a new query to undo the entry-advancement that happens with sqlite3_step()?



sqlite3_reset() isn't an appropriate solution as this returns the database pointer back to the first entry in the database. I am looking to go back to the immediately previous entry of the last sqlite3_step() call.










share|improve this question
















The system I'm working with uses an SQLite3 database as a background log storage with each entry as a two-column entry : |time|data|. Replaying the log is as simple as preparing a statement to get all entries, and each sqlite3_step() call returns the data at time.



Since then, we've attempted to instrument specialized tools to advance and skip as we've needed. Now, we find ourselves in a situation where we need to go backwards by one or more entries. Is there a way without resetting and/or generating a new query to undo the entry-advancement that happens with sqlite3_step()?



sqlite3_reset() isn't an appropriate solution as this returns the database pointer back to the first entry in the database. I am looking to go back to the immediately previous entry of the last sqlite3_step() call.







c++ c sqlite






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 16:11







jhill515

















asked Mar 28 at 15:14









jhill515jhill515

3614 silver badges14 bronze badges




3614 silver badges14 bronze badges










  • 1





    Possible duplicate of sqlite step back

    – user1810087
    Mar 28 at 15:27






  • 1





    Save the data from the rows you've already seen in your data structure of choice, and use that to look at prior records.

    – Shawn
    Mar 28 at 15:41











  • For some of these, we're talking on the order of GB to TB of data; we didn't want to pre-read because of the overall slowdown and resource footprint for some of the tools using this data. With regard to the "sqlite step back" duplication: sqlite_reset() is not an option as it takes you back to the first entry in the database. I'm looking to go to the immediately previous-retrieved entry.

    – jhill515
    Mar 28 at 16:05












  • 1





    Possible duplicate of sqlite step back

    – user1810087
    Mar 28 at 15:27






  • 1





    Save the data from the rows you've already seen in your data structure of choice, and use that to look at prior records.

    – Shawn
    Mar 28 at 15:41











  • For some of these, we're talking on the order of GB to TB of data; we didn't want to pre-read because of the overall slowdown and resource footprint for some of the tools using this data. With regard to the "sqlite step back" duplication: sqlite_reset() is not an option as it takes you back to the first entry in the database. I'm looking to go to the immediately previous-retrieved entry.

    – jhill515
    Mar 28 at 16:05







1




1





Possible duplicate of sqlite step back

– user1810087
Mar 28 at 15:27





Possible duplicate of sqlite step back

– user1810087
Mar 28 at 15:27




1




1





Save the data from the rows you've already seen in your data structure of choice, and use that to look at prior records.

– Shawn
Mar 28 at 15:41





Save the data from the rows you've already seen in your data structure of choice, and use that to look at prior records.

– Shawn
Mar 28 at 15:41













For some of these, we're talking on the order of GB to TB of data; we didn't want to pre-read because of the overall slowdown and resource footprint for some of the tools using this data. With regard to the "sqlite step back" duplication: sqlite_reset() is not an option as it takes you back to the first entry in the database. I'm looking to go to the immediately previous-retrieved entry.

– jhill515
Mar 28 at 16:05





For some of these, we're talking on the order of GB to TB of data; we didn't want to pre-read because of the overall slowdown and resource footprint for some of the tools using this data. With regard to the "sqlite step back" duplication: sqlite_reset() is not an option as it takes you back to the first entry in the database. I'm looking to go to the immediately previous-retrieved entry.

– jhill515
Mar 28 at 16:05












1 Answer
1






active

oldest

votes


















1

















Is there a way without resetting and/or generating a new query to undo the entry-advancement that happens with sqlite3_step()?




No, as of the current version (3.27.2), there is not. SQLite3 provides only forward-only result sets.



You seem to be aware already of the possibility of resetting a prepared statement via sqlite3_reset(), but I think you appreciate that this is not the same thing as stepping backward, even in combination with stepping forward through the results again, contrary to the speculation presented in answer to a similar question. Resetting abandons the current result set, and subsequently stepping the prepared statement again causes a new query to be performed, with those results being retrieved.



If you want to be able to access the data from a previous result row after stepping past it and without performing a new query, then you need to capture and retain it in some kind of local data structure. Depending on your needs, that might not have to be all the data you've read. On the other hand, if you have some other reason than re-reading the data for wanting the result set cursor to be moved backward then you'll need to find another way to achieve whatever purpose that is supposed to serve.






share|improve this answer

























  • Thank you for that. Yes, I did read the latest documentation, and when I couldn't find it, I speculated either it wasn't possible or I somehow missed it. Originally, I was hoping to avoid capturing previously read data. There were a handful of error cases created by such an approach (in our application, not with SQLite3 itself). But it looks unavoidable given the current requirements. Thank you for your insight!

    – jhill515
    Mar 29 at 0:51













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
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55401083%2fis-there-a-way-to-undo-sqlite3-step-call-in-c-c%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1

















Is there a way without resetting and/or generating a new query to undo the entry-advancement that happens with sqlite3_step()?




No, as of the current version (3.27.2), there is not. SQLite3 provides only forward-only result sets.



You seem to be aware already of the possibility of resetting a prepared statement via sqlite3_reset(), but I think you appreciate that this is not the same thing as stepping backward, even in combination with stepping forward through the results again, contrary to the speculation presented in answer to a similar question. Resetting abandons the current result set, and subsequently stepping the prepared statement again causes a new query to be performed, with those results being retrieved.



If you want to be able to access the data from a previous result row after stepping past it and without performing a new query, then you need to capture and retain it in some kind of local data structure. Depending on your needs, that might not have to be all the data you've read. On the other hand, if you have some other reason than re-reading the data for wanting the result set cursor to be moved backward then you'll need to find another way to achieve whatever purpose that is supposed to serve.






share|improve this answer

























  • Thank you for that. Yes, I did read the latest documentation, and when I couldn't find it, I speculated either it wasn't possible or I somehow missed it. Originally, I was hoping to avoid capturing previously read data. There were a handful of error cases created by such an approach (in our application, not with SQLite3 itself). But it looks unavoidable given the current requirements. Thank you for your insight!

    – jhill515
    Mar 29 at 0:51















1

















Is there a way without resetting and/or generating a new query to undo the entry-advancement that happens with sqlite3_step()?




No, as of the current version (3.27.2), there is not. SQLite3 provides only forward-only result sets.



You seem to be aware already of the possibility of resetting a prepared statement via sqlite3_reset(), but I think you appreciate that this is not the same thing as stepping backward, even in combination with stepping forward through the results again, contrary to the speculation presented in answer to a similar question. Resetting abandons the current result set, and subsequently stepping the prepared statement again causes a new query to be performed, with those results being retrieved.



If you want to be able to access the data from a previous result row after stepping past it and without performing a new query, then you need to capture and retain it in some kind of local data structure. Depending on your needs, that might not have to be all the data you've read. On the other hand, if you have some other reason than re-reading the data for wanting the result set cursor to be moved backward then you'll need to find another way to achieve whatever purpose that is supposed to serve.






share|improve this answer

























  • Thank you for that. Yes, I did read the latest documentation, and when I couldn't find it, I speculated either it wasn't possible or I somehow missed it. Originally, I was hoping to avoid capturing previously read data. There were a handful of error cases created by such an approach (in our application, not with SQLite3 itself). But it looks unavoidable given the current requirements. Thank you for your insight!

    – jhill515
    Mar 29 at 0:51













1














1










1










Is there a way without resetting and/or generating a new query to undo the entry-advancement that happens with sqlite3_step()?




No, as of the current version (3.27.2), there is not. SQLite3 provides only forward-only result sets.



You seem to be aware already of the possibility of resetting a prepared statement via sqlite3_reset(), but I think you appreciate that this is not the same thing as stepping backward, even in combination with stepping forward through the results again, contrary to the speculation presented in answer to a similar question. Resetting abandons the current result set, and subsequently stepping the prepared statement again causes a new query to be performed, with those results being retrieved.



If you want to be able to access the data from a previous result row after stepping past it and without performing a new query, then you need to capture and retain it in some kind of local data structure. Depending on your needs, that might not have to be all the data you've read. On the other hand, if you have some other reason than re-reading the data for wanting the result set cursor to be moved backward then you'll need to find another way to achieve whatever purpose that is supposed to serve.






share|improve this answer














Is there a way without resetting and/or generating a new query to undo the entry-advancement that happens with sqlite3_step()?




No, as of the current version (3.27.2), there is not. SQLite3 provides only forward-only result sets.



You seem to be aware already of the possibility of resetting a prepared statement via sqlite3_reset(), but I think you appreciate that this is not the same thing as stepping backward, even in combination with stepping forward through the results again, contrary to the speculation presented in answer to a similar question. Resetting abandons the current result set, and subsequently stepping the prepared statement again causes a new query to be performed, with those results being retrieved.



If you want to be able to access the data from a previous result row after stepping past it and without performing a new query, then you need to capture and retain it in some kind of local data structure. Depending on your needs, that might not have to be all the data you've read. On the other hand, if you have some other reason than re-reading the data for wanting the result set cursor to be moved backward then you'll need to find another way to achieve whatever purpose that is supposed to serve.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 28 at 21:09









John BollingerJohn Bollinger

96.5k8 gold badges48 silver badges91 bronze badges




96.5k8 gold badges48 silver badges91 bronze badges















  • Thank you for that. Yes, I did read the latest documentation, and when I couldn't find it, I speculated either it wasn't possible or I somehow missed it. Originally, I was hoping to avoid capturing previously read data. There were a handful of error cases created by such an approach (in our application, not with SQLite3 itself). But it looks unavoidable given the current requirements. Thank you for your insight!

    – jhill515
    Mar 29 at 0:51

















  • Thank you for that. Yes, I did read the latest documentation, and when I couldn't find it, I speculated either it wasn't possible or I somehow missed it. Originally, I was hoping to avoid capturing previously read data. There were a handful of error cases created by such an approach (in our application, not with SQLite3 itself). But it looks unavoidable given the current requirements. Thank you for your insight!

    – jhill515
    Mar 29 at 0:51
















Thank you for that. Yes, I did read the latest documentation, and when I couldn't find it, I speculated either it wasn't possible or I somehow missed it. Originally, I was hoping to avoid capturing previously read data. There were a handful of error cases created by such an approach (in our application, not with SQLite3 itself). But it looks unavoidable given the current requirements. Thank you for your insight!

– jhill515
Mar 29 at 0:51





Thank you for that. Yes, I did read the latest documentation, and when I couldn't find it, I speculated either it wasn't possible or I somehow missed it. Originally, I was hoping to avoid capturing previously read data. There were a handful of error cases created by such an approach (in our application, not with SQLite3 itself). But it looks unavoidable given the current requirements. Thank you for your insight!

– jhill515
Mar 29 at 0:51




















draft saved

draft discarded















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55401083%2fis-there-a-way-to-undo-sqlite3-step-call-in-c-c%23new-answer', 'question_page');

);

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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현