added 2026-10-31 17:11:01
This commit is contained in:
@@ -5,3 +5,4 @@
|
|||||||
- [Gitea Create Repo API: Curl POST](/gitea-create-repo-api-curl-post.md)
|
- [Gitea Create Repo API: Curl POST](/gitea-create-repo-api-curl-post.md)
|
||||||
- [Mount LUKS drive to Windows Subsystem for Linux Bare](/mount-luks-drive-to-windwos-subsystem-for-linux-bare.md)
|
- [Mount LUKS drive to Windows Subsystem for Linux Bare](/mount-luks-drive-to-windwos-subsystem-for-linux-bare.md)
|
||||||
- [GOHUGO PWA SETUP](/gohugo-pwa-setup.md)
|
- [GOHUGO PWA SETUP](/gohugo-pwa-setup.md)
|
||||||
|
- [sqlite3 guide](/sqlite3-guide.md)
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# sqlite3 Guide
|
||||||
|
|
||||||
|
## Create Table
|
||||||
|
|
||||||
|
``` sql
|
||||||
|
CREATE TABLE IF NOT EXISTS config (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
user TEXT NOT NULL UNIQUE,
|
||||||
|
hashed_password TEXT NOT NULL
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Add Record to Table
|
||||||
|
|
||||||
|
``` sql
|
||||||
|
INSERT INTO config (user, hashed_password) VALUES ('abc', 'base64 hashed password');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Update Record
|
||||||
|
|
||||||
|
``` sql
|
||||||
|
UPDATE config SET user = 'def' WHERE user = 'abc';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Get All Records from Table
|
||||||
|
|
||||||
|
``` sql
|
||||||
|
SELECT * FROM config;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Get Specific Record Field based on User
|
||||||
|
|
||||||
|
``` sql
|
||||||
|
SELECT hashed_password FROM config WHERE user = 'abc';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Delete Record
|
||||||
|
|
||||||
|
``` sql
|
||||||
|
DELETE FROM config WHERE user = 'abc';
|
||||||
|
```
|
||||||
|
|
||||||
|
## View All Tables
|
||||||
|
|
||||||
|
``` sql
|
||||||
|
.tables
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user