# Sql Logic Error with sqlite\_modern\_cpp

**URL:** <https://discuss.zetetic.net/t/sql-logic-error-with-sqlite-modern-cpp/4031>\
**Category:** SQLCipher\
**Created:** [November 14, 2019, 8:56pm UTC](https://discuss.zetetic.net/t/sql-logic-error-with-sqlite-modern-cpp/4031 "2019-11-14T20:56:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hirobreak](https://avatars.discourse-cdn.com/v4/letter/h/7cd45c/32.png) [@Hirobreak](https://discuss.zetetic.net/u/Hirobreak)\
**Post date:** [November 14, 2019, 8:56pm UTC](https://discuss.zetetic.net/t/sql-logic-error-with-sqlite-modern-cpp/4031/1 "2019-11-14T20:56:47Z")

</div>

I’m having trouble opening an unencrypted sqlite database with sqlcipher. I recently integrated sqlcipher and for my app’s purpose I need to read and write some data before encrypting the database. I’m using sqlite\_modern\_cpp [https://github.com/SqliteModernCpp/sqlite\_modern\_cpp.git](https://github.com/SqliteModernCpp/sqlite_modern_cpp.git)

I successfully compiled sqlcipher as follows:

```auto
../configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/usr/lib/x86_64-linux-gnu/libcrypto.a"

```

And I’m initializing my database as follows:

```auto
sqlcipher_config config;
config.flags = OpenFlags::FULLMUTEX | OpenFlags::SHAREDCACHE | OpenFlags::READWRITE;
sqlcipher_database db(dbPath, config);

```

But when I try to initialize it I get the following error: SQL logic error

I’m using node-gyp to compile my executable and I’m stating libraries as follows:

```auto
"libraries": [
  "-pthread",
  "-ldl",
  "/usr/lib/x86_64-linux-gnu/libssl.a",
  "/usr/lib/x86_64-linux-gnu/libcrypto.a",
  "/usr/local/lib/libsqlcipher.a",
  "/usr/local/lib/libsignal-protocol-c.a",
  "/usr/lib/libcivetweb.so",
  "/usr/local/lib/libcjson.a",
  "/usr/local/lib/spdlog/libspdlog.a"
]

```

I’m running Ubuntu and libssl 1.1.0  
Any help will be much appreciated
