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
Copy file name to clipboardExpand all lines: README.md
+51-9Lines changed: 51 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,71 @@
1
-
<!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️-->
2
-
[](#nativescript-akylas-sqlite)
1
+
<!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️--><!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️-->
Copy file name to clipboardExpand all lines: docs/index.html
+50-11Lines changed: 50 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -12,28 +12,67 @@
12
12
<divclass="col-8 col-content">
13
13
<divclass="tsd-page-title">
14
14
<h2>SQLite for Nativescript</h2></div>
15
-
<divclass="tsd-panel tsd-typography"><!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️-->
16
-
<p><ahref="#nativescript-akylas-sqlite"></a></p>
15
+
<divclass="tsd-panel tsd-typography"><!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️--><!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️-->
<ahref="https://npmcharts.com/compare/@nativescript-community/sqlite?minimal=true"><imgalt="Downloads per month" src="https://img.shields.io/npm/dm/@nativescript-community/sqlite.svg" height="20"/></a>
<p>You should take care of wrapping sqlite calls to your preferred async option (promises, observables, async/await). And catch any exceptions thrown.</p>
36
-
<pre><codeclass="language-typescript"><spanclass="hl-2">import</span><spanclass="hl-1"> { </span><spanclass="hl-0">openOrCreate</span><spanclass="hl-1">, </span><spanclass="hl-0">deleteDatabase</span><spanclass="hl-1"> } </span><spanclass="hl-2">from</span><spanclass="hl-1"></span><spanclass="hl-3">"nativescript-akylas-sqlite"</span><spanclass="hl-1">;</span><br/><br/><spanclass="hl-4">const</span><spanclass="hl-1"></span><spanclass="hl-5">sqlite</span><spanclass="hl-1"> = </span><spanclass="hl-6">openOrCreate</span><spanclass="hl-1">(</span><spanclass="hl-3">"path/to/db"</span><spanclass="hl-1">);</span><br/><spanclass="hl-0">sqlite</span><spanclass="hl-1">.</span><spanclass="hl-6">execute</span><spanclass="hl-1">(</span><spanclass="hl-3">"CREATE TABLE names (id INT, name TEXT)"</span><spanclass="hl-1">);</span><br/><spanclass="hl-0">sqlite</span><spanclass="hl-1">.</span><spanclass="hl-6">transaction</span><spanclass="hl-1">(</span><spanclass="hl-0">cancelTransaction</span><spanclass="hl-1"></span><spanclass="hl-4">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-7">// Calling cancelTransaction will rollback all changes made to db</span><br/><spanclass="hl-1"></span><spanclass="hl-0">names</span><spanclass="hl-1">.</span><spanclass="hl-6">forEach</span><spanclass="hl-1">((</span><spanclass="hl-0">name</span><spanclass="hl-1">, </span><spanclass="hl-0">id</span><spanclass="hl-1">) </span><spanclass="hl-4">=></span><br/><spanclass="hl-1"></span><spanclass="hl-0">sqlite</span><spanclass="hl-1">.</span><spanclass="hl-6">execute</span><spanclass="hl-1">(</span><br/><spanclass="hl-1"></span><spanclass="hl-3">"INSERT INTO names (id, name) VALUES (?, ?)"</span><spanclass="hl-1">,</span><br/><spanclass="hl-1"> [</span><spanclass="hl-0">id</span><spanclass="hl-1">, </span><spanclass="hl-0">name</span><spanclass="hl-1">]</span><br/><spanclass="hl-1"> )</span><br/><spanclass="hl-1"> );</span><br/><spanclass="hl-1">});</span>
75
+
<pre><codeclass="language-typescript"><spanclass="hl-0">import</span><spanclass="hl-1"> { </span><spanclass="hl-2">openOrCreate</span><spanclass="hl-1">, </span><spanclass="hl-2">deleteDatabase</span><spanclass="hl-1"> } </span><spanclass="hl-0">from</span><spanclass="hl-1"></span><spanclass="hl-3">"@nativescript-community/sqlite"</span><spanclass="hl-1">;</span><br/><br/><spanclass="hl-4">const</span><spanclass="hl-1"></span><spanclass="hl-5">sqlite</span><spanclass="hl-1"> = </span><spanclass="hl-6">openOrCreate</span><spanclass="hl-1">(</span><spanclass="hl-3">"path/to/db"</span><spanclass="hl-1">);</span><br/><spanclass="hl-2">sqlite</span><spanclass="hl-1">.</span><spanclass="hl-6">execute</span><spanclass="hl-1">(</span><spanclass="hl-3">"CREATE TABLE names (id INT, name TEXT)"</span><spanclass="hl-1">);</span><br/><spanclass="hl-2">sqlite</span><spanclass="hl-1">.</span><spanclass="hl-6">transaction</span><spanclass="hl-1">(</span><spanclass="hl-2">cancelTransaction</span><spanclass="hl-1"></span><spanclass="hl-4">=></span><spanclass="hl-1"> {</span><br/><spanclass="hl-1"></span><spanclass="hl-7">// Calling cancelTransaction will rollback all changes made to db</span><br/><spanclass="hl-1"></span><spanclass="hl-2">names</span><spanclass="hl-1">.</span><spanclass="hl-6">forEach</span><spanclass="hl-1">((</span><spanclass="hl-2">name</span><spanclass="hl-1">, </span><spanclass="hl-2">id</span><spanclass="hl-1">) </span><spanclass="hl-4">=></span><br/><spanclass="hl-1"></span><spanclass="hl-2">sqlite</span><spanclass="hl-1">.</span><spanclass="hl-6">execute</span><spanclass="hl-1">(</span><br/><spanclass="hl-1"></span><spanclass="hl-3">"INSERT INTO names (id, name) VALUES (?, ?)"</span><spanclass="hl-1">,</span><br/><spanclass="hl-1"> [</span><spanclass="hl-2">id</span><spanclass="hl-1">, </span><spanclass="hl-2">name</span><spanclass="hl-1">]</span><br/><spanclass="hl-1"> )</span><br/><spanclass="hl-1"> );</span><br/><spanclass="hl-1">});</span>
37
76
</code></pre>
38
77
<p><ahref="#demos-and-development"></a></p>
39
78
@@ -45,7 +84,7 @@ <h2>Demos and Development</h2>
45
84
<h3>Repo Setup</h3>
46
85
</a>
47
86
<p>The repo uses submodules. If you did not clone with <code> --recursive</code> then you need to call</p>
0 commit comments