Skip to content

Commit

Permalink
doc: sentence casing, toc, acknowledgements
Browse files Browse the repository at this point in the history
  • Loading branch information
nalgeon committed Aug 7, 2024
1 parent 23586f9 commit 83df42d
Show file tree
Hide file tree
Showing 16 changed files with 244 additions and 139 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# All the Missing SQLite Functions
# All the missing SQLite functions

SQLite has few functions compared to other database management systems. SQLite authors see this as a feature rather than a problem, because SQLite has an extension mechanism in place.

Expand Down Expand Up @@ -66,7 +66,7 @@ sqlite> .load ./sqlean
sqlite> select median(value) from generate_series(1, 99);
```

See [How to Install an Extension](docs/install.md) for usage with IDE, Python, JavaScript, etc.
See [How to install an extension](docs/install.md) for usage with IDE, Python, JavaScript, etc.

## Building from source

Expand Down
20 changes: 13 additions & 7 deletions docs/crypto.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# crypto: Hashing, Encoding and Decoding in SQLite
# crypto: Hashing, encoding and decoding in SQLite

Hashing, encoding and decoding functions.
The `sqlean-crypto` extension provides hashing, encoding and decoding functions.

[Hashing](#hashing-and-message-digest-functions)
[Encoding/decoding](#encoding-and-decoding-functions)
[Installation and usage](#installation-and-usage)

## Hashing and message digest functions

Expand Down Expand Up @@ -165,7 +169,7 @@ select crypto_decode('%2Fhello%3Ft%3D%28%E0%B2%A0_%E0%B2%A0%29', 'url');
-- /hello?t=(ಠ_ಠ)
```

## Installation and Usage
## Installation and usage

SQLite command-line interface:

Expand All @@ -174,8 +178,10 @@ sqlite> .load ./crypto
sqlite> select hex(crypto_md5('abc'));
```

See [How to Install an Extension](install.md) for usage with IDE, Python, etc.
See [How to install an extension](install.md) for usage with IDE, Python, etc.

[Download](https:/nalgeon/sqlean/releases/latest) the extension.

[Explore](https:/nalgeon/sqlean) other extensions.

[⬇️ Download](https:/nalgeon/sqlean/releases/latest)
[✨ Explore](https:/nalgeon/sqlean)
[🚀 Follow](https://antonz.org/subscribe/)
[Subscribe](https://antonz.org/subscribe/) to stay on top of new features.
34 changes: 23 additions & 11 deletions docs/define.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# define: User-Defined Functions in SQLite
# define: User-defined functions in SQLite

Write arbitrary functions in SQL (as opposed to [application-defined functions](https://sqlite.org/appfunc.html), which require programming in C, Python, or another language). Or even execute arbitrary SQL from a string.
The `sqlean-define` extension allows writing arbitrary functions in SQL (as opposed to [application-defined functions](https://sqlite.org/appfunc.html), which require programming in C, Python, or another language). Or even execute arbitrary SQL from a string.

Adapted from [statement_vtab.c](https:/0x09/sqlite-statement-vtab/blob/master/statement_vtab.c) by 0x09 and [eval.c](https://www.sqlite.org/src/file/ext/misc/eval.c) by D. Richard Hipp.
[Scalar Functions](#scalar-functions)
[Table-valued functions](#table-valued-functions)
[Arbitrary SQL statements](#arbitrary-sql-statements)
[Performance](#performance)
[Reference](#reference)
[Acknowledgements](#acknowledgements)
[Installation and usage](#installation-and-usage)

## Scalar Functions
## Scalar functions

`select define(NAME, BODY)`

Expand Down Expand Up @@ -85,7 +91,7 @@ sqlite> select sumn(5);
Parse error: no such function: sumn
```

## Table-Valued Functions
## Table-valued functions

`create virtual table NAME using define((BODY))`

Expand Down Expand Up @@ -155,7 +161,7 @@ sqlite> select * from strcut('one;two', ';');
Parse error: no such table: strcut
```

## Arbitrary SQL Statements
## Arbitrary SQL statements

`eval(SQL[, SEPARATOR])`

Expand Down Expand Up @@ -259,7 +265,11 @@ Executes arbitrary SQL and returns the result as string (if any).

Deletes a previously defined function (scalar or table-valued).

## Installation and Usage
## Acknowledgements

Adapted from [statement_vtab.c](https:/0x09/sqlite-statement-vtab/blob/master/statement_vtab.c) by 0x09 and [eval.c](https://www.sqlite.org/src/file/ext/misc/eval.c) by D. Richard Hipp.

## Installation and usage

SQLite command-line interface:

Expand All @@ -269,8 +279,10 @@ sqlite> select define('sumn', ':n * (:n + 1) / 2');
sqlite> select sumn(5);
```

See [How to Install an Extension](install.md) for usage with IDE, Python, etc.
See [How to install an extension](install.md) for usage with IDE, Python, etc.

[Download](https:/nalgeon/sqlean/releases/latest) the extension.

[Explore](https:/nalgeon/sqlean) other extensions.

[⬇️ Download](https:/nalgeon/sqlean/releases/latest)
[✨ Explore](https:/nalgeon/sqlean)
[🚀 Follow](https://antonz.org/subscribe/)
[Subscribe](https://antonz.org/subscribe/) to stay on top of new features.
26 changes: 19 additions & 7 deletions docs/fileio.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# fileio: Read and Write Files in SQLite
# fileio: Read and write files in SQLite

Access the file system directly from SQL. Partly based on the [fileio.c](https://sqlite.org/src/file/ext/misc/fileio.c) by D. Richard Hipp.
The `sqlean-fileio` extension provides means to access the file system directly from SQL.

[Reference](#reference)
[Acknowledgements](#acknowledgements)
[Installation and usage](#installation-and-usage)

## Reference

Main features:

Expand Down Expand Up @@ -248,7 +254,11 @@ lsdir = fileio_ls
lsmode = fileio_mode
```

## Installation and Usage
## Acknowledgements

Partly based on the [fileio.c](https://sqlite.org/src/file/ext/misc/fileio.c) by D. Richard Hipp.

## Installation and usage

SQLite command-line interface:

Expand All @@ -257,8 +267,10 @@ sqlite> .load ./fileio
sqlite> select fileio_read('whatever.txt');
```

See [How to Install an Extension](install.md) for usage with IDE, Python, etc.
See [How to install an extension](install.md) for usage with IDE, Python, etc.

[Download](https:/nalgeon/sqlean/releases/latest) the extension.

[Explore](https:/nalgeon/sqlean) other extensions.

[⬇️ Download](https:/nalgeon/sqlean/releases/latest)
[✨ Explore](https:/nalgeon/sqlean)
[🚀 Follow](https://antonz.org/subscribe/)
[Subscribe](https://antonz.org/subscribe/) to stay on top of new features.
32 changes: 21 additions & 11 deletions docs/fuzzy.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# fuzzy: Fuzzy String Matching and Phonetics in SQLite
# fuzzy: Fuzzy string matching and phonetics in SQLite

Fuzzy-matching helpers:
The `sqlean-fuzzy` extension provides fuzzy-matching helpers:

- Measure distance between two strings.
- Compute phonetic string code.
- Transliterate a string.

Adapted from [libstrcmp](https:/Rostepher/libstrcmp) by Ross Bayer and [spellfix.c](https://www.sqlite.org/src/file/ext/misc/spellfix.c) by D. Richard Hipp.
If you want a ready-to-use mechanism to search a large vocabulary for close matches, see the [spellfix](https://github.com/nalgeon/sqlean/issues/27#issuecomment-1002297477) extension instead.

If you want a ready-to-use mechanism to search a large vocabulary for close matches, see the [spellfix](https:/nalgeon/sqlean/issues/27#issuecomment-1002297477) extension.
[String distances](#string-distances)
[Phonetic codes](#phonetic-codes)
[Transliteration](#transliteration)
[Acknowledgements](#acknowledgements)
[Installation and usage](#installation-and-usage)

## String Distances
## String distances

These functions measure the distance between two strings.

Expand Down Expand Up @@ -97,7 +101,7 @@ select fuzzy_osadist('awesome', 'aewsme');
-- 3
```

## Phonetic Codes
## Phonetic codes

These functions compute phonetic string codes.

Expand Down Expand Up @@ -188,7 +192,11 @@ select fuzzy_translit('oh my 😅');
-- oh my ?
```

## Installation and Usage
## Acknowledgements

Adapted from [libstrcmp](https:/Rostepher/libstrcmp) by Ross Bayer and [spellfix.c](https://www.sqlite.org/src/file/ext/misc/spellfix.c) by D. Richard Hipp.

## Installation and usage

SQLite command-line interface:

Expand All @@ -197,8 +205,10 @@ sqlite> .load ./fuzzy
sqlite> select fuzzy_soundex('hello');
```

See [How to Install an Extension](install.md) for usage with IDE, Python, etc.
See [How to install an extension](install.md) for usage with IDE, Python, etc.

[Download](https:/nalgeon/sqlean/releases/latest) the extension.

[Explore](https:/nalgeon/sqlean) other extensions.

[⬇️ Download](https:/nalgeon/sqlean/releases/latest)
[✨ Explore](https:/nalgeon/sqlean)
[🚀 Follow](https://antonz.org/subscribe/)
[Subscribe](https://antonz.org/subscribe/) to stay on top of new features.
27 changes: 18 additions & 9 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# How to Install an Extension
# How to install an extension

The easiest way to try out `sqlean` extensions is to use the [pre-bundled shell](shell.md). But if you prefer to use the standard SQLite shell, IDEs or software APIs — read on.
The easiest way to try out Sqlean extensions is to use the [pre-bundled shell](shell.md). But if you prefer to use the standard SQLite shell, IDEs or software APIs — read on.

Examples below use the `stats` extension; you can specify any other supported extension. To load all extensions at once, use the single-file `sqlean` bundle.

## Download: manually
- [Download: Manually](#download-manually)
- [Download: Package manager](#download-package-manager)
- [Install: Command-line interface](#install-command-line-interface)
- [Install: GUI database browser](#install-gui-database-browser)
- [Install: Python](#install-python)
- [Install: Node.js](#install-nodejs)
- [Install: Browser JavaScript](#install-browser-javascript)
- [Install: Go](#install-go)

## Download: Manually

There are [precompiled binaries](https:/nalgeon/sqlean/releases/latest) for every OS:

Expand All @@ -18,7 +27,7 @@ Binaries are 64-bit and require a 64-bit SQLite version. If you are using SQLite

Other extensions are available for download from [sqlpkg.org](https://sqlpkg.org/).

## Download: package manager
## Download: Package manager

Personally, I'm not a fan of managing the extensions manually. I always tend to put them in different places and can't find them later. So I created [`sqlpkg`](https:/nalgeon/sqlpkg-cli) — a package manager for SQLite extensions.

Expand Down Expand Up @@ -184,14 +193,14 @@ import (
)

func main() {
sql.Register("sqlite3_with_extensions",
sql.Register("sqlite_ext",
&sqlite3.SQLiteDriver{
Extensions: []string{
`c:\Users\anton\sqlite\stats`,
},
})

db, err := sql.Open("sqlite3_with_extensions", ":memory:")
db, err := sql.Open("sqlite_ext", ":memory:")
db.Query("select median(value) from generate_series(1, 99)")
db.Close()
}
Expand All @@ -210,17 +219,17 @@ import (
)

func main() {
sql.Register("sqlite3_with_extensions",
sql.Register("sqlite_ext",
&sqlite3.SQLiteDriver{
Extensions: []string{
"/Users/anton/Downloads/stats",
},
})

db, err := sql.Open("sqlite3_with_extensions", ":memory:")
db, err := sql.Open("sqlite_ext", ":memory:")
db.Query("select median(value) from generate_series(1, 99)")
db.Close()
}
```

Note that we use the same identifier `sqlite3_with_extensions` in the `sql.Register` and `sql.Open`.
Note that we use the same identifier `sqlite_ext` in the `sql.Register` and `sql.Open`.
26 changes: 19 additions & 7 deletions docs/ipaddr.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# ipaddr: IP Address Manipulation in SQLite
# ipaddr: IP address manipulation in SQLite

Functions to manipulate IPs and subnets. Created by [Vincent Bernat](https:/vincentbernat).
The `sqlean-ipaddr` extension provides functions to manipulate IPs and subnets.

⚠️ This extension is not available on Windows.

[Reference](#reference)
[Acknowledgements](#acknowledgements)
[Installation and usage](#installation-and-usage)

## Reference

[contains](#ipcontains)
[family](#ipfamily)
[host](#iphost)
Expand Down Expand Up @@ -75,7 +81,11 @@ select ipnetwork('192.168.16.12/24');
-- 192.168.16.0/24
```

## Installation and Usage
## Acknowledgements

Contributed by [Vincent Bernat](https:/vincentbernat).

## Installation and usage

SQLite command-line interface:

Expand All @@ -84,8 +94,10 @@ sqlite> .load ./ipaddr
sqlite> select ipfamily('2001:db8::1');
```

See [How to Install an Extension](install.md) for usage with IDE, Python, etc.
See [How to install an extension](install.md) for usage with IDE, Python, etc.

[Download](https:/nalgeon/sqlean/releases/latest) the extension.

[Explore](https:/nalgeon/sqlean) other extensions.

[⬇️ Download](https:/nalgeon/sqlean/releases/latest)
[✨ Explore](https:/nalgeon/sqlean)
[🚀 Follow](https://antonz.org/subscribe/)
[Subscribe](https://antonz.org/subscribe/) to stay on top of new features.
19 changes: 12 additions & 7 deletions docs/math.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# math: Mathematics in SQLite

Common math functions for SQLite versions compiled without the `SQLITE_ENABLE_MATH_FUNCTIONS` flag.
Adapted from SQLite source code ([func.c](https://sqlite.org/src/file/src/func.c)).
The `sqlean-math` extension provides common math functions for SQLite versions compiled without the `SQLITE_ENABLE_MATH_FUNCTIONS` flag.

Provides following functions:

Expand All @@ -17,7 +16,11 @@ Provides following functions:

[Full description](https://sqlite.org/lang_mathfunc.html)

## Installation and Usage
## Acknowledgements

Adapted from SQLite source code ([func.c](https://sqlite.org/src/file/src/func.c)).

## Installation and usage

SQLite command-line interface:

Expand All @@ -26,8 +29,10 @@ sqlite> .load ./math
sqlite> select math_sqrt(9);
```

See [How to Install an Extension](install.md) for usage with IDE, Python, etc.
See [How to install an extension](install.md) for usage with IDE, Python, etc.

[Download](https:/nalgeon/sqlean/releases/latest) the extension.

[Explore](https:/nalgeon/sqlean) other extensions.

[⬇️ Download](https:/nalgeon/sqlean/releases/latest)
[✨ Explore](https:/nalgeon/sqlean)
[🚀 Follow](https://antonz.org/subscribe/)
[Subscribe](https://antonz.org/subscribe/) to stay on top of new features.
Loading

0 comments on commit 83df42d

Please sign in to comment.