1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/db/sqlite
2023-08-07 09:00:03 +03:00
..
orm.v orm: allow inserting empty objects with db.sqlite (SQLite uses a slightly different SQL dialect) (#17334) 2023-02-16 11:34:16 +02:00
README.md
result_code.v
sqlite_orm_test.v orm: enforce that queries always return a Result, a query-resulting array can be used as a V array in place. (#17871) 2023-04-04 08:23:06 +03:00
sqlite_test.v db.sqlite: add exec_param_many and exec_param methods (#19071) 2023-08-07 09:00:03 +03:00
sqlite_vfs_lowlevel_test.v cgen: fix option unwrap from ovoid function (#18173) 2023-05-14 14:38:14 +03:00
sqlite.v db.sqlite: add exec_param_many and exec_param methods (#19071) 2023-08-07 09:00:03 +03:00
stmt.v checker: disallow struct int to ptr outside unsafe (#17923) 2023-04-13 07:38:21 +02:00
vfs_lowlevel.v cgen: fix option unwrap from ovoid function (#18173) 2023-05-14 14:38:14 +03:00

Description

sqlite is a thin wrapper for the SQLite library, which in turn is "a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine."

Install SQLite Dependency

Before you can use this module, you must first have the SQLite development library installed on your system.

Fedora 31:

sudo dnf -y install sqlite-devel

Ubuntu 20.04:

sudo apt install -y libsqlite3-dev

Windows:

  • Download the source zip from SQLite Downloads
  • Create a new sqlite subfolder inside v/thirdparty
  • Extract the zip into that folder

Performance Tips

When performing a large amount of database calls (i.e. INSERTS), significant performance increase can be obtained by controlling the synchronization and journal modes.

For instance:

import db.sqlite

db := sqlite.connect('foo.db') or { panic(err) }
db.synchronization_mode(sqlite.SyncMode.off)
db.journal_mode(sqlite.JournalMode.memory)