blib/lib/SPVM/Resource/SQLite.pm

filter: Statementstmt 100% 2 / 2 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 2 / 2 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary
1 package SPVM::Resource::SQLite;
2  
3 1 our $VERSION = "0.004";
4  
5 1 1;
6  
7 =head1 Name
8  
9 SPVM::Resource::SQLite - A resource that provides the SQLite header and source code.
10  
11 =head1 Description
12  
13 SPVM::Resource::SQLite in L<SPVM> is a L<resource|SPVM::Document::Resource> class for L<SQLite|https://www.sqlite.org/>.
14  
15 =head1 Usage
16  
17 MyClass.config:
18
19 my $config = SPVM::Builder::Config->new_c99;
20 $config->use_resource('Resource::SQLite');
21 $config;
22  
23 MyClass.c:
24  
25 #include "sqlite3.h"
26
27 int32_t SPVM__MyClass__test(SPVM_ENV* env, SPVM_VALUE* stack) {
28
29 const char* version = sqlite3_libversion();
30
31 return 0;
32 }
33  
34 =head1 Original Product
35  
36 L<SQLite|https://www.sqlite.org/>
37  
38 =head1 Original Product Version
39  
40 L<SQLite 3.45.1 (Amalgamation)|https://www.sqlite.org/download.html>
41  
42 =head1 Language
43  
44 C
45  
46 =head1 Language Standard
47  
48 C99
49  
50 =head1 Header Files
51  
52 =over 2
53  
54 =item * sqlite3.h
55  
56 =item * sqlite3ext.h
57  
58 =back
59  
60 =head1 Source Files
61  
62 =over 2
63  
64 =item * sqlite3.c
65  
66 =back
67  
68 =head1 Compiler Flags
69  
70 =over 2
71  
72 =item * -DSQLITE_THREADSAFE=1
73  
74 Enables multi-thread support.
75  
76 =item * -DSQLITE_ENABLE_COLUMN_METADATA
77  
78 Enables APIs that provide column metadata, required by many database drivers.
79  
80 =item * -DSQLITE_ENABLE_FTS5
81  
82 Enables the Full-Text Search engine version 5.
83  
84 =item * -DSQLITE_ENABLE_RTREE
85  
86 Enables the R*Tree index extension for spatial queries.
87  
88 =item * -DSQLITE_ENABLE_MATH_FUNCTIONS
89  
90 Enables built-in SQL math functions (sin, cos, log, sqrt, etc.).
91  
92 =item * -DSQLITE_ENABLE_JSON1
93  
94 Enables JSON functions for managing JSON data in SQL.
95  
96 =item * -DSQLITE_ENABLE_DBSTAT_VTAB
97  
98 Enables the dbstat virtual table to query database space usage.
99  
100 =item * -pthread
101  
102 Adds support for multithreading with the pthreads library.
103  
104 =back
105  
106 =head1 How to Create Resource
107  
108 =head2 Download
109  
110 mkdir -p .tmp
111 # Download SQLite 3.49.1 Amalgamation (Released in early 2025)
112 curl -L https://www.sqlite.org/2025/sqlite-amalgamation-3490100.zip -o .tmp/sqlite-amalgamation-3490100.zip
113 unzip .tmp/sqlite-amalgamation-3490100.zip -d .tmp/
114  
115 =head2 Extracting Source Files
116  
117 # Copy the amalgamation source file
118 cp .tmp/sqlite-amalgamation-3490100/sqlite3.c lib/SPVM/Resource/SQLite.native/src/
119  
120 =head2 Extracting Header Files
121  
122 # Copy the header files
123 cp .tmp/sqlite-amalgamation-3490100/sqlite3.h lib/SPVM/Resource/SQLite.native/include/
124 cp .tmp/sqlite-amalgamation-3490100/sqlite3ext.h lib/SPVM/Resource/SQLite.native/include/
125  
126 =head1 Repository
127  
128 L<SPVM::Resource::SQLite - Github|https://github.com/yuki-kimoto/SPVM-Resource-SQLite>
129  
130 =head1 Author
131  
132 Yuki Kimoto C<kimoto.yuki@gmail.com>
133  
134 =head1 Copyright & License
135  
136 Copyright (c) 2026 Yuki Kimoto
137  
138 MIT License
↑ Summary