{"id":37535643,"url":"https://github.com/kflu/sqlite3","last_synced_at":"2026-01-16T08:39:01.368Z","repository":{"id":147729630,"uuid":"45641425","full_name":"kflu/sqlite3","owner":"kflu","description":null,"archived":false,"fork":false,"pushed_at":"2015-11-05T21:48:32.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-09T12:21:29.793Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kflu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-05T21:45:59.000Z","updated_at":"2015-11-05T21:47:42.000Z","dependencies_parsed_at":"2023-04-12T04:16:26.454Z","dependency_job_id":null,"html_url":"https://github.com/kflu/sqlite3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kflu/sqlite3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kflu%2Fsqlite3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kflu%2Fsqlite3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kflu%2Fsqlite3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kflu%2Fsqlite3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kflu","download_url":"https://codeload.github.com/kflu/sqlite3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kflu%2Fsqlite3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-16T08:39:00.741Z","updated_at":"2026-01-16T08:39:01.344Z","avatar_url":"https://github.com/kflu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eSQLite Source Repository\u003c/h1\u003e\n\nThis repository contains the complete source code for the SQLite database\nengine.  Some test scripts are also include.  However, many other test scripts\nand most of the documentation are managed separately.\n\nIf you are reading this on a Git mirror someplace, you are doing it wrong.\nThe [official repository](https://www.sqlite.org/src/) is better.  Go there\nnow.\n\n## Compiling\n\nFirst create a directory in which to place\nthe build products.  It is recommended, but not required, that the\nbuild directory be separate from the source directory.  Cd into the\nbuild directory and then from the build directory run the configure\nscript found at the root of the source tree.  Then run \"make\".\n\nFor example:\n\n    tar xzf sqlite.tar.gz    ;#  Unpack the source tree into \"sqlite\"\n    mkdir bld                ;#  Build will occur in a sibling directory\n    cd bld                   ;#  Change to the build directory\n    ../sqlite/configure      ;#  Run the configure script\n    make                     ;#  Run the makefile.\n    make sqlite3.c           ;#  Build the \"amalgamation\" source file\n    make test                ;#  Run some tests (requires Tcl)\n\nSee the makefile for additional targets.\n\nThe configure script uses autoconf 2.61 and libtool.  If the configure\nscript does not work out for you, there is a generic makefile named\n\"Makefile.linux-gcc\" in the top directory of the source tree that you\ncan copy and edit to suit your needs.  Comments on the generic makefile\nshow what changes are needed.\n\n## Using MSVC\n\nOn Windows, all applicable build products can be compiled with MSVC.\nFirst open the command prompt window associated with the desired compiler\nversion (e.g. \"Developer Command Prompt for VS2013\").  Next, use NMAKE\nwith the provided \"Makefile.msc\" to build one of the supported targets.\n\nFor example:\n\n    mkdir bld\n    cd bld\n    nmake /f Makefile.msc TOP=..\\sqlite\n    nmake /f Makefile.msc sqlite3.c TOP=..\\sqlite\n    nmake /f Makefile.msc sqlite3.dll TOP=..\\sqlite\n    nmake /f Makefile.msc sqlite3.exe TOP=..\\sqlite\n    nmake /f Makefile.msc test TOP=..\\sqlite\n\nThere are several build options that can be set via the NMAKE command\nline.  For example, to build for WinRT, simply add \"FOR_WINRT=1\" argument\nto the \"sqlite3.dll\" command line above.  When debugging into the SQLite\ncode, adding the \"DEBUG=1\" argument to one of the above command lines is\nrecommended.\n\nSQLite does not require [Tcl](http://www.tcl.tk/) to run, but a Tcl installation\nis required by the makefiles (including those for MSVC).  SQLite contains\na lot of generated code and Tcl is used to do much of that code generation.\nThe makefiles also require AWK.\n\n## Source Code Tour\n\nMost of the core source files are in the **src/** subdirectory.  But\nsrc/ also contains files used to build the \"testfixture\" test harness;\nthose file all begin with \"test\".  And src/ contains the \"shell.c\" file\nwhich is the main program for the \"sqlite3.exe\" command-line shell and\nthe \"tclsqlite.c\" file which implements the bindings to SQLite from the\nTcl programming language.  (Historical note:  SQLite began as a Tcl\nextension and only later escaped to the wild as an independent library.)\n\nTest scripts and programs are found in the **test/** subdirectory.\nThere are other test suites for SQLite (see\n[How SQLite Is Tested](http://www.sqlite.org/testing.html))\nbut those other test suites are\nin separate source repositories.\n\nThe **ext/** subdirectory contains code for extensions.  The\nFull-text search engine is in **ext/fts3**.  The R-Tree engine is in\n**ext/rtree**.  The **ext/misc** subdirectory contains a number of\nsmaller, single-file extensions, such as a REGEXP operator.\n\nThe **tool/** subdirectory contains various scripts and programs used\nfor building generated source code files or for testing or for generating\naccessory programs such as \"sqlite3_analyzer(.exe)\".\n\n### Generated Source Code Files\n\nSeveral of the C-language source files used by SQLite are generated from\nother sources rather than being typed in manually by a programmer.  This\nsection will summarize those automatically-generated files.  To create all\nof the automatically-generated files, simply run \"make target\u0026#95;source\".\nThe \"target\u0026#95;source\" make target will create a subdirectory \"tsrc/\" and\nfill it with all the source files needed to build SQLite, both\nmanually-edited files and automatically-generated files.\n\nThe SQLite interface is defined by the **sqlite3.h** header file, which is\ngenerated from src/sqlite.h.in, ./manifest.uuid, and ./VERSION.  The\n[Tcl script](http://www.tcl.tk) at tool/mksqlite3h.tcl does the conversion.\nThe manifest.uuid file contains the SHA1 hash of the particular check-in\nand is used to generate the SQLITE\\_SOURCE\\_ID macro.  The VERSION file\ncontains the current SQLite version number.  The sqlite3.h header is really\njust a copy of src/sqlite.h.in with the source-id and version number inserted\nat just the right spots. Note that comment text in the sqlite3.h file is\nused to generate much of the SQLite API documentation.  The Tcl scripts\nused to generate that documentation are in a separate source repository.\n\nThe SQL language parser is **parse.c** which is generate from a grammar in\nthe src/parse.y file.  The conversion of \"parse.y\" into \"parse.c\" is done\nby the [lemon](./doc/lemon.html) LALR(1) parser generator.  The source code\nfor lemon is at tool/lemon.c.  Lemon uses a\ntemplate for generating its parser.  A generic template is in tool/lempar.c,\nbut SQLite uses a slightly modified template found in src/lempar.c.\n\nLemon also generates the **parse.h** header file, at the same time it\ngenerates parse.c. But the parse.h header file is\nmodified further (to add additional symbols) using the ./addopcodes.awk\nAWK script.\n\nThe **opcodes.h** header file contains macros that define the numbers\ncorresponding to opcodes in the \"VDBE\" virtual machine.  The opcodes.h\nfile is generated by the scanning the src/vdbe.c source file.  The\nAWK script at ./mkopcodeh.awk does this scan and generates opcodes.h.\nA second AWK script, ./mkopcodec.awk, then scans opcodes.h to generate\nthe **opcodes.c** source file, which contains a reverse mapping from\nopcode-number to opcode-name that is used for EXPLAIN output.\n\nThe **keywordhash.h** header file contains the definition of a hash table\nthat maps SQL language keywords (ex: \"CREATE\", \"SELECT\", \"INDEX\", etc.) into\nthe numeric codes used by the parse.c parser.  The keywordhash.h file is\ngenerated by a C-language program at tool mkkeywordhash.c.\n\n### The Amalgamation\n\nAll of the individual C source code and header files (both manually-edited\nand automatically-generated) can be combined into a single big source file\n**sqlite3.c** called \"the amalgamation\".  The amalgamation is the recommended\nway of using SQLite in a larger application.  Combining all individual\nsource code files into a single big source code file allows the C compiler\nto perform more cross-procedure analysis and generate better code.  SQLite\nruns about 5% faster when compiled from the amalgamation versus when compiled\nfrom individual source files.\n\nThe amalgamation is generated from the tool/mksqlite3c.tcl Tcl script.\nFirst, all of the individual source files must be gathered into the tsrc/\nsubdirectory (using the equivalent of \"make target_source\") then the\ntool/mksqlite3c.tcl script is run to copy them all together in just the\nright order while resolving internal \"#include\" references.\n\nThe amalgamation source file is more than 100K lines long.  Some symbolic\ndebuggers (most notably MSVC) are unable to deal with files longer than 64K\nlines.  To work around this, a separate Tcl script, tool/split-sqlite3c.tcl,\ncan be run on the amalgamation to break it up into a single small C file\ncalled **sqlite3-all.c** that does #include on about five other files\nnamed **sqlite3-1.c**, **sqlite3-2.c**, ..., **sqlite3-5.c**.  In this way,\nall of the source code is contained within a single translation unit so\nthat the compiler can do extra cross-procedure optimization, but no\nindividual source file exceeds 32K lines in length.\n\n## How It All Fits Together\n\nSQLite is modular in design.\nSee the [architectural description](http://www.sqlite.org/arch.html)\nfor details. Other documents that are useful in\n(helping to understand how SQLite works include the\n[file format](http://www.sqlite.org/fileformat2.html) description,\nthe [virtual machine](http://www.sqlite.org/vdbe.html) that runs\nprepared statements, the description of\n[how transactions work](http://www.sqlite.org/atomiccommit.html), and\nthe [overview of the query planner](http://www.sqlite.org/optoverview.html).\n\nUnfortunately, years of effort have gone into optimizating SQLite, both\nfor small size and high performance.  And optimizations tend to result in\ncomplex code.  So there is a lot of complexity in the SQLite implementation.\n\nKey files:\n\n  *  **sqlite.h.in** - This file defines the public interface to the SQLite\n     library.  Readers will need to be familiar with this interface before\n     trying to understand how the library works internally.\n\n  *  **sqliteInt.h** - this header file defines many of the data objects\n     used internally by SQLite.\n\n  *  **parse.y** - This file describes the LALR(1) grammer that SQLite uses\n     to parse SQL statements, and the actions that are taken at each step\n     in the parsing process.\n\n  *  **vdbe.c** - This file implements the virtual machine that runs\n     prepared statements.  There are various helper files whose names\n     begin with \"vdbe\".  The VDBE has access to the vdbeInt.h header file\n     which defines internal data objects.  The rest of SQLite interacts\n     with the VDBE through an interface defined by vdbe.h.\n\n  *  **where.c** - This file analyzes the WHERE clause and generates\n     virtual machine code to run queries efficiently.  This file is\n     sometimes called the \"query optimizer\".  It has its own private\n     header file, whereInt.h, that defines data objects used internally.\n\n  *  **btree.c** - This file contains the implementation of the B-Tree\n     storage engine used by SQLite.\n\n  *  **pager.c** - This file contains the \"pager\" implementation, the\n     module that implements transactions.\n\n  *  **os_unix.c** and **os_win.c** - These two files implement the interface\n     between SQLite and the underlying operating system using the run-time\n     pluggable VFS interface.\n\n  *  **shell.c** - This file is not part of the core SQLite library.  This\n     is the file that, when linked against sqlite3.a, generates the\n     \"sqlite3.exe\" command-line shell.\n\n  *  **tclsqlite.c** - This file implements the Tcl bindings for SQLite.  It\n     is not part of the core SQLite library.  But as most of the tests in this\n     repository are written in Tcl, the Tcl language bindings are important.\n\nThere are many other source files.  Each has a suscinct header comment that\ndescribes its purpose and role within the larger system.\n\n\n## Contacts\n\nThe main SQLite webpage is [http://www.sqlite.org/](http://www.sqlite.org/)\nwith geographically distributed backup servers at\n[http://www2.sqlite.org/](http://www2.sqlite.org) and\n[http://www3.sqlite.org/](http://www3.sqlite.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkflu%2Fsqlite3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkflu%2Fsqlite3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkflu%2Fsqlite3/lists"}