Artikel

SQLite Inspect – Find misuse of SQLite – Alpha

SQLite is a great project but even with the nicest library you can make mistakes. I created a single-header inspection wrapper, to quickly and easily detect the most common issues with code using SQLite.

And since I know from experience that it would be a major pain to instrument your code by hand, I decided to make this work with just a single #include. Please note that this is a C++ header.

All you have to do is download and extract sqlite_inspect_amalgamation.h and store it in the same folder where sqlite3.h lives.

Then open sqlite3.h and append the following line:

#include "sqlite_inspect_amalgamation.h"

There. All done. Just compile and run.

By the way, you’ll also find a readme file with some additional explanation in the archive.

What SQLite-Inspect checks for

This is the list of currently supported checks.

Missing finalize calls for statements

The check will not only tell you that a statement wasn’t closed but also which statements they were.

Invalid/double finalize calls

In case sqlite3_finalize is called a second time on a statement or with some garbage pointer.

Failure to close DB

Usually the reason for this is at least one unclosed statement. The report will tell you which database could not be closed along with the given error code. If open statements prevented the close-operation you’ll also get a list of those statements.

Statistics overview

In addition to common errors you also get a report about executed statements and the number of times they were prepared. This should give you a good hint which statements should be handled by statement-caches.

SQLite-Inspect result file

By default a report named sqlite-inspect-report-{hex-value}.txt is automatically written into the working directory of the instrumented binary. The „random“ number at the end of the report is necessary to avoid collisions of reports when running code that has dynamic libraries which also uses SQLite.

Current state of the project

This is in a alpha stage, meaning that you might encounter bugs, insufficient documentation or code comments and overall chaoticness.

But hey, it’s plug and play. So there’s Lille risk in trying it and a good chance that it’ll work fine for you.

The most recent version is 0.7

Feedback appreciated

So if you find this interesting, give it a spin and please let me know your thoughts at inspect(funny a)thisdomain.

  • Kommentare deaktiviert für SQLite Inspect – Find misuse of SQLite – Alpha
  • Veröffentlicht in: Allgemein
Artikel

Nice way to stop/reduce trackers

There’s some discussion about the morality of using ad-blockers. Matter of fact, it’s not so much the mindbendingly annoying or downright scammy ads that annoy me the most. It’s the ruthless tracking that’s my problem. Strange enough, I’m still using Google Analytics for this site. Quite the double standard. I guess I’ll have to do something about this…

But back to the topic at hand. Here’s a a nice collection of sites to block. All wrapped up nice and tidy to be added to your hosts file.

It will also block Google Analytics and therefore the GA site itself, so keep that in mind if you’re trying to take a look at your sites stats. ;)

  • Kommentare deaktiviert für Nice way to stop/reduce trackers
  • Veröffentlicht in: Allgemein
Link

C++ Code Coverage Tool for Windows

The other day I was looking for a way to get easy coverage analysis for a C++ project. On Linux there’s gcov but on Windows there didn’t seem to be something like this. After some searching I came across OpenCppCoverage which looks quite good. Especially as it doesn’t require instrumentation.

  • Kommentare deaktiviert für C++ Code Coverage Tool for Windows
  • Veröffentlicht in: Allgemein