siddse7en
siddse7en

Reputation: 111

How to use SQLITE -D_SQLITE_USER_AUTHENTICATION

I have downloaded the SQLITE amalgamation folder along with the entire source code.

Followed the steps mentioned here http://www.sqlite.org/src/doc/trunk/ext/userauth/user-auth.txt

Using the following command to build the sqlite3.exe

cl -D_SQLITE_USER_AUTHENTICATION shell.c sqlite3.c userauth.c -Fesqlite3.exe

But i can still open the database with sqlite3_open_v2. No authentication is required.

Upvotes: 3

Views: 4480

Answers (1)

siddse7en
siddse7en

Reputation: 111

Steps I followed to add User authentication

  1. Download the amalgamation and the src folder.

//Steps 2 and 3 cause i wanted just 1 source and header file.

  1. Copy userauth.c code to sqlite3.c
  2. Copy sqlite3userauth.h to sqlite3.h

  3. cl -DSQLITE_USER_AUTHENTICATION shell.c sqlite3.c -Fesqlite3.exe

  4. Now open the above executable(sqlite3.exe)
  5. Write the following commands .open Test.db PRAGMA writable_schema = 1 .user add User User123 1 //.user add Username Password IsAdmin
  6. Exit and open the db once again. It will need an authentication

Upvotes: 2

Related Questions