Skip to content

Commit

Permalink
3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
niinivaa committed Nov 16, 2021
1 parent 1b5d5e6 commit d04d3a8
Show file tree
Hide file tree
Showing 5 changed files with 779 additions and 754 deletions.
33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,29 @@ http://olliNiinivaara.github.io/SQLiteral/

`nimble install sqliteral`

## 2.0.2 Release notes (2021-09-20)
* logs every statement preparation only once (instead of from every thread)
* more realistic example
## 3.0.0 Release notes (2021-11-16)
* new implementation for Text values (see various toDb -procs)
* nimble file typo fix

## Example

```nim
import sqliteral
const Schema = """
CREATE TABLE IF NOT EXISTS Example(count INTEGER NOT NULL);
INSERT INTO Example(rowid, count) VALUES(1, 1)
ON CONFLICT(rowid) DO UPDATE SET count=count+100
"""
const CountColumn = 0
const Schema = "CREATE TABLE IF NOT EXISTS Example(string TEXT NOT NULL)"
type SqlStatements = enum
Increment = "UPDATE Example SET count=count+1 WHERE rowid = ?"
Select = "SELECT count FROM Example WHERE rowid = ?"
SelectAll = "SELECT count FROM Example"
Upsert = """INSERT INTO Example(rowid, string) VALUES(1, ?)
ON CONFLICT(rowid) DO UPDATE SET string = ?"""
SelectAll = "SELECT string FROM Example"
var db: SQLiteral
proc operate() =
echo "count=",db.getTheInt(Select, 1)
db.transaction: db.exec(Increment, 1)
for row in db.rows(SelectAll): echo row.getInt(CountColumn)
when not defined(release):
db.setLogger(proc(db: SQLiteral, msg: string, code: int) = echo msg)
proc operate(i: string) =
let view: DbValue = i.toDb(3, 7) # zero-copy view into string
db.transaction: db.exec(Upsert, view, view)
for row in db.rows(SelectAll): echo row.getCString(0)
db.openDatabase("example.db", Schema)
db.prepareStatements(SqlStatements)
operate()
var input = "012INPUT89"
operate(input)
db.close()
```
120 changes: 116 additions & 4 deletions docs/nimdoc.out.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Modified by Boyd Greenfield and narimiran
--primary-background: #fff;
--secondary-background: ghostwhite;
--third-background: #e8e8e8;
--info-background: #50c050;
--warning-background: #c0a000;
--error-background: #e04040;
--border: #dde;
--text: #222;
--anchor: #07b;
Expand All @@ -32,13 +35,18 @@ Modified by Boyd Greenfield and narimiran
--escapeSequence: #c4891b;
--number: #252dbe;
--literal: #a4255b;
--program: #6060c0;
--option: #508000;
--raw-data: #a4255b;
}

[data-theme="dark"] {
--primary-background: #171921;
--secondary-background: #1e202a;
--third-background: #2b2e3b;
--info-background: #008000;
--warning-background: #807000;
--error-background: #c03000;
--border: #0e1014;
--text: #fff;
--anchor: #8be9fd;
Expand All @@ -57,6 +65,8 @@ Modified by Boyd Greenfield and narimiran
--escapeSequence: #bd93f9;
--number: #bd93f9;
--literal: #f1fa8c;
--program: #9090c0;
--option: #90b010;
--raw-data: #8be9fd;
}

Expand Down Expand Up @@ -224,6 +234,12 @@ select:focus {
}

/* Docgen styles */

:target {
border: 2px solid #B5651D;
border-style: dotted;
}

/* Links */
a {
color: var(--anchor);
Expand Down Expand Up @@ -378,6 +394,7 @@ h2 {
margin-top: 2em; }

h2.subtitle {
margin-top: 0em;
text-align: center; }

h3 {
Expand Down Expand Up @@ -491,6 +508,45 @@ hr {
border: 0;
border-top: 1px solid #aaa; }

hr.footnote {
width: 25%;
border-top: 0.15em solid #999;
margin-bottom: 0.15em;
margin-top: 0.15em;
}
div.footnote-group {
margin-left: 1em; }
div.footnote-label {
display: inline-block;
min-width: 1.7em;
}

div.option-list {
border: 0.1em solid var(--border);
}
div.option-list-item {
padding-left: 12em;
padding-right: 0;
padding-bottom: 0.3em;
padding-top: 0.3em;
}
div.odd {
background-color: var(--secondary-background);
}
div.option-list-label {
margin-left: -11.5em;
margin-right: 0em;
min-width: 11.5em;
display: inline-block;
vertical-align: top;
}
div.option-list-description {
width: calc(100% - 1em);
padding-left: 1em;
padding-right: 0;
display: inline-block;
}

blockquote {
font-size: 0.9em;
font-style: italic;
Expand All @@ -499,7 +555,7 @@ blockquote {
border-left: 5px solid #bbc;
}

.pre {
.pre, span.tok {
font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace;
font-weight: 500;
font-size: 0.85em;
Expand All @@ -510,6 +566,12 @@ blockquote {
border-radius: 4px;
}

span.tok {
border: 1px solid #808080;
padding-bottom: 0.1em;
margin-right: 0.2em;
}

pre {
font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace;
color: var(--text);
Expand Down Expand Up @@ -561,6 +623,7 @@ table.line-nums-table {
.line-nums-table td.blob-line-nums pre {
color: #b0b0b0;
-webkit-filter: opacity(75%);
filter: opacity(75%);
text-align: right;
border-color: transparent;
background-color: transparent;
Expand Down Expand Up @@ -609,6 +672,34 @@ table.borderless td, table.borderless th {
The right padding separates the table cells. */
padding: 0 0.5em 0 0 !important; }

.admonition {
padding: 0.3em;
background-color: var(--secondary-background);
border-left: 0.4em solid #7f7f84;
margin-bottom: 0.5em;
-webkit-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2);
-moz-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2);
box-shadow: 0 5px 8px -6px rgba(0,0,0,.2);
}
.admonition-info {
border-color: var(--info-background);
}
.admonition-info-text {
color: var(--info-background);
}
.admonition-warning {
border-color: var(--warning-background);
}
.admonition-warning-text {
color: var(--warning-background);
}
.admonition-error {
border-color: var(--error-background);
}
.admonition-error-text {
color: var(--error-background);
}

.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 !important; }
Expand Down Expand Up @@ -768,9 +859,6 @@ span.classifier {
span.classifier-delimiter {
font-weight: bold; }

span.option {
white-space: nowrap; }

span.problematic {
color: #b30000; }

Expand Down Expand Up @@ -850,6 +938,29 @@ span.Preprocessor {
span.Directive {
color: #252dbe; }

span.option {
font-weight: bold;
font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace;
color: var(--option);
}

span.Prompt {
font-weight: bold;
color: red; }

span.ProgramOutput {
font-weight: bold;
color: #808080; }

span.program {
font-weight: bold;
color: var(--program);
text-decoration: underline;
text-decoration-color: var(--hint);
text-decoration-thickness: 0.05em;
text-underline-offset: 0.15em;
}

span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
span.Other {
color: var(--other); }
Expand All @@ -872,6 +983,7 @@ dt pre > span.Operator ~ span.Identifier, dt pre > span.Other ~ span.Identifier
background-position: 0 0;
background-size: 51px 14px;
-webkit-filter: opacity(50%);
filter: opacity(50%);
background-repeat: no-repeat;
background-image: var(--nim-sprite-base64);
margin-bottom: 5px; }
Expand Down
Loading

0 comments on commit d04d3a8

Please sign in to comment.