1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/sqlite
2023-01-11 11:58:55 +02:00
..
orm.v checker: disallow using builtin type names for const names (#16599) 2022-12-06 15:44:25 +02:00
README.md ci: fix failing v check-md vlib/sqlite/README.md 2022-07-07 13:05:05 +03:00
result_code.v sqlite: add a sqlite.is_error() helper (#15964) 2022-10-04 10:03:59 +03:00
sqlite_orm_test.v orm,sqlite,mysql,pg: cleanup import v.ast, using typeof[Type]() 2022-12-07 13:40:46 +02:00
sqlite_test.v cgen: allow ORM to work with DB aliases (#16939) 2023-01-11 11:58:55 +02:00
sqlite_vfs_lowlevel_test.v vfmt: change all '$expr' to '${expr}' (#16428) 2022-11-15 16:53:13 +03:00
sqlite.v vfmt: change all '$expr' to '${expr}' (#16428) 2022-11-15 16:53:13 +03:00
stmt.v db, json, time, term: change optional to result (#16201) 2022-10-26 11:26:28 +03:00
vfs_lowlevel.v vfmt: change all '$expr' to '${expr}' (#16428) 2022-11-15 16:53:13 +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 sqlite

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