You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace .cusor/rules/sqlitecpp-skills-routing.mdc by AGENTS.md
It's much more generic and should be loaded by most AI agents out there,
but not by Github Copilot extensions in VS and Rider
Mention AGENTS.md and skills in the README.md
- SQLiteCpp is a C++11 RAII wrapper around SQLite3 C APIs
5
+
- Minimal dependencies: C++11 STL + SQLite3
6
+
- Cross-platform: Windows, Linux, macOS
7
+
- Thread-safe at SQLite multi-thread level
8
+
9
+
## Maintaining This Documentation
10
+
11
+
**IMPORTANT:** When the user explains how to do something, corrects your behavior, or points out errors:
12
+
1.**Update AGENTS.md** if the information is a universal constraint or best practice for SQLiteCpp, a correction to existing guidance in this file
13
+
2.**Update skills** if the information is Task-specific guidance (build, testing, documentation, etc.) a correction to existing skill content or a new process
14
+
**Goal:** Keep this documentation accurate and comprehensive so future sessions benefit from corrections and clarifications.
15
+
16
+
## Core Non-Negotiables (MUST Follow)
17
+
18
+
1.**RAII only**: Acquire resources in constructors, release in destructors
19
+
2.**Never throw in destructors**: Use `SQLITECPP_ASSERT()` instead
20
+
3.**C++11 core library**: C++14 only in VariadicBind.h and ExecuteMany.h
21
+
4.**Public API isolation**: Headers must NOT include sqlite3.h
22
+
5.**Export macros**: Public API must use `SQLITECPP_API` from SQLiteCppExport.h
23
+
6.**Threading constraint**: One Database/Statement/Column per thread
24
+
7.**Tests required**: New functionality must have tests in tests/
25
+
8.**Portability**: Code must work on Windows, Linux, and macOS
26
+
9.**Const correctness**: Use `const` for methods that don't modify object state, `const&` for read-only parameters
27
+
28
+
## Error Handling
29
+
- Throw `SQLite::Exception` for errors in throwing APIs
30
+
- Use `tryExec()`, `tryExecuteStep()`, `tryReset()` for error codes
31
+
- In destructors: use `SQLITECPP_ASSERT()` never throw
Thus this SQLiteCpp repository can be directly used as a Git submodule.
115
115
See the [SQLiteCpp_Example](https://github.com/SRombauts/SQLiteCpp_Example) side repository for a standalone "from scratch" example.
116
116
@@ -144,7 +144,7 @@ The SQLiteCpp port in vcpkg is kept up to date by Microsoft team members and com
144
144
145
145
#### Using SQLiteCpp on a system-wide installation
146
146
147
-
If you installed this package to your system, a `SQLiteCppConfig.cmake` file will be generated & installed to your system.
147
+
If you installed this package to your system, a `SQLiteCppConfig.cmake` file will be generated & installed to your system.
148
148
This file lets you link against the SQLiteCpp library for use in your Cmake project.
149
149
150
150
Here's an example of using this in your CMakeLists.txt
@@ -205,7 +205,7 @@ Arch Linux:
205
205
sudo pacman -Syu clang ninja
206
206
# install python and pip (required for meson)
207
207
sudo pacman -Syu python python-pip
208
-
# install meson
208
+
# install meson
209
209
pip install meson
210
210
```
211
211
@@ -224,7 +224,7 @@ for example you can build the library using the default options with:
224
224
225
225
```sh
226
226
# setup the build directory
227
-
meson setup builddir
227
+
meson setup builddir
228
228
# build sqlitecpp
229
229
meson compile -C builddir
230
230
```
@@ -276,6 +276,14 @@ You can:
276
276
- or turn off the `option(SQLITE_ENABLE_COLUMN_METADATA "Enable Column::getColumnOriginName(). Require support from sqlite3 library." ON)` in [CMakeFiles.txt](CMakeFiles.txt) (or other build system scripts)
277
277
- or turn on the `option(SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project." ON)` in [CMakeFiles.txt](CMakeFiles.txt)
278
278
279
+
### AI Coding Assistance
280
+
281
+
SQLiteCpp includes instructions for AI coding assistants:
282
+
-`/AGENTS.md`: base custom instructions for all tasks
283
+
-`/.claude/skills`: specialized skills covering specific subjects, workflow and processes
284
+
285
+
These files help AI assistants understand SQLiteCpp's coding standards, architecture, and best practices.
286
+
279
287
### Continuous Integration
280
288
281
289
This project is continuously tested under Ubuntu Linux with the gcc and clang compilers
@@ -315,28 +323,28 @@ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose b
315
323
or uncoment the line at the end of [build.sh](build.sh)
316
324
317
325
## Examples
318
-
### The first sample demonstrates how to query a database and get results:
326
+
### The first sample demonstrates how to query a database and get results:
319
327
320
328
```C++
321
329
try
322
330
{
323
331
// Open a database file
324
332
SQLite::Database db("example.db3");
325
-
333
+
326
334
// Compile a SQL query, containing one parameter (index 1)
327
335
SQLite::Statement query(db, "SELECT * FROM test WHERE size > ?");
328
-
336
+
329
337
// Bind the integer value 6 to the first parameter of the SQL query
330
338
query.bind(1, 6);
331
-
339
+
332
340
// Loop to execute the query step by step, to get rows of result
333
341
while (query.executeStep())
334
342
{
335
343
// Demonstrate how to get some typed column value
336
344
int id = query.getColumn(0);
337
345
const char* value = query.getColumn(1);
338
346
int size = query.getColumn(2);
339
-
347
+
340
348
std::cout << "row: " << id << ", " << value << ", " << size << std::endl;
341
349
}
342
350
}
@@ -375,8 +383,8 @@ catch (std::exception& e)
375
383
### The third sample shows how to manage a prepared statement with a transaction:
0 commit comments