Skip to content
Newer
Older
100644 96 lines (62 sloc) 3.81 KB
e8b107b @superquadratic Added README
superquadratic authored
1 # SQLite3-WinRT
2
94ac1ba @superquadratic Update README
superquadratic authored
3 Async SQLite for (JavaScript) Windows Store apps.
e8b107b @superquadratic Added README
superquadratic authored
4
69a1a7d @milgner Bump version and document changes
milgner authored
5 ## Changelog
6
facf947 @pke added blob example
pke authored
7 ### 1.3.4
8
9 #### Support for blobs
10
11 This allows you to insert blobs into your database and read them back as BASE64 encoded values in your JSON result.
b5a1c73 @pke Fix link to blog example
pke authored
12 See [the blob example](https://github.com/doo/SQLite3-WinRT/tree/master/SQLite3JS/examples/blobs.js) how to use it in your apps.
facf947 @pke added blob example
pke authored
13 If you need an IBuffer back from the db you can use [CryptographicBuffer.DecodeFromBase64String](http://msdn.microsoft.com/en-us/library/windows/apps/windows.security.cryptography.cryptographicbuffer.decodefrombase64string).
14
15
69a1a7d @milgner Bump version and document changes
milgner authored
16 ### 1.1.2
17
18 Some minor API changes:
c5abeb5 @milgner Fix README markdown
milgner authored
19
69a1a7d @milgner Bump version and document changes
milgner authored
20 1. `getLastInsertRowId()` function becomes `lastInsertRowId` property
21 2. `getAutocommit()` function becomes `autoCommit` property
22 3. `getLastError()` function becomes `lastError` property
23 4. `enableSharedCache()` function becomes `sharedCache` property
24
c5abeb5 @milgner Fix README markdown
milgner authored
25
69a1a7d @milgner Bump version and document changes
milgner authored
26 ### 1.1.0
e954be1 @milgner Update README to reflect changes in version 1.1.0
milgner authored
27
28 This version introduces a **breaking API change** along with some enhancements:
29
d0b33a4 @pke Change wording in runAsync description
pke authored
30 1. `runAsync` no longer returns the database for chained calls. Instead it will now return the number of rows affected by the executed SQL statement.
31 2. A special collation sequence, `WINLOCALE` is introduced. It uses the sorting behaviour of the currently active system locale. The locale can be overridden by setting `db.collationLanguage`.
e954be1 @milgner Update README to reflect changes in version 1.1.0
milgner authored
32 3. We also now implemented a `regexp` function based on the STL (TR1) regex functionality. You can now use the `REGEXP` operator, see the SQLite documentation for further information.
33
34 As usual, you should look at our unit tests if you are unsure how to use this new functionality.
35
36
e8b107b @superquadratic Added README
superquadratic authored
37 ## Status
38
e954be1 @milgner Update README to reflect changes in version 1.1.0
milgner authored
39 We finally consider _SQLite3-WinRT_ ready for production use and it is already
40 being used by certified apps published in the Windows Store including, of course [our own application](http://apps.microsoft.com/webpdp/app/doo/28631302-9666-4ee3-aaf4-e52c493370e8).
41 Support for BLOBs and an API for transaction management are still on our to-do list - unfortunately with a very low priority. Feedback and contributions are highly appreciated, feel free to open issues or pull requests on GitHub.
42
e8b107b @superquadratic Added README
superquadratic authored
43
94ac1ba @superquadratic Update README
superquadratic authored
44 ## Setup
9edaf16 @superquadratic Update README
superquadratic authored
45
94ac1ba @superquadratic Update README
superquadratic authored
46 _SQLite3-WinRT_ consists of two parts, a WinRT component named
47 _SQLite3Component_ and a JavaScript namespace called _SQLite3JS_ that builds
48 upon the _SQLite3Component_.
49
50 Therefore, in order to use _SQLite3JS_ in a JavaScript app, the
51 _SQLite3Component_ project `SQLite3Component\SQLite3Component.vcxproj` must be
52 added to the app's solution using _FILE > Add > Existing Project..._.
53 A reference to _SQLite3Component_ must be added to the app's project using
54 _PROJECT > Add Reference..._. Now, the _SQLite3JS_ source
55 `SQLite3JS\js\SQLite3.js` can be used in the app's project.
56
57 Note for users of Visual Studio 2012 Express: To compile the WinRT component
812045e @superquadratic Fix Windows SDK link in README.md
superquadratic authored
58 successfully, please install the [Windows SDK][1].
94ac1ba @superquadratic Update README
superquadratic authored
59
60 [1]: http://msdn.microsoft.com/en-us/windows/desktop/hh852363.aspx
61
e954be1 @milgner Update README to reflect changes in version 1.1.0
milgner authored
62
94ac1ba @superquadratic Update README
superquadratic authored
63 ## Usage
64
65 The _SQLite3JS_ namespace provides an async JavaScript API for SQLite. It is built
9edaf16 @superquadratic Update README
superquadratic authored
66 around the `Database` object that can be obtained using `SQLite3JS.openAsync()`.
94ac1ba @superquadratic Update README
superquadratic authored
67 The API was inspired by [node-sqlite3][2].
9edaf16 @superquadratic Update README
superquadratic authored
68
94ac1ba @superquadratic Update README
superquadratic authored
69 [2]: https://github.com/developmentseed/node-sqlite3/
9edaf16 @superquadratic Update README
superquadratic authored
70
ea72ebd @milgner Revert switching to external SQLite library
milgner authored
71 ### Example
9edaf16 @superquadratic Update README
superquadratic authored
72
73 var dbPath = Windows.Storage.ApplicationData.current.localFolder.path + '\\db.sqlite';
74 SQLite3JS.openAsync(dbPath)
e954be1 @milgner Update README to reflect changes in version 1.1.0
milgner authored
75 .then(function (db) {
76 return db.runAsync('CREATE TABLE Item (name TEXT, price REAL, id INT PRIMARY KEY)')
77 .then(function () {
9edaf16 @superquadratic Update README
superquadratic authored
78 return db.runAsync('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Mango', 4.6, 123]);
79 })
e954be1 @milgner Update README to reflect changes in version 1.1.0
milgner authored
80 .then(function () {
9edaf16 @superquadratic Update README
superquadratic authored
81 return db.eachAsync('SELECT * FROM Item', function (row) {
82 console.log('Get a ' + row.name + ' for $' + row.price);
83 });
84 })
e954be1 @milgner Update README to reflect changes in version 1.1.0
milgner authored
85 .then(function () {
9edaf16 @superquadratic Update README
superquadratic authored
86 db.close();
87 });
e954be1 @milgner Update README to reflect changes in version 1.1.0
milgner authored
88 });
89
9edaf16 @superquadratic Update README
superquadratic authored
90
e8b107b @superquadratic Added README
superquadratic authored
91 ## License
92
facf947 @pke added blob example
pke authored
93 Copyright (c) 2012,2013 doo GmbH
5eca374 @superquadratic Added MIT license
superquadratic authored
94
95 Licensed under the MIT License, see LICENSE file.
Something went wrong with that request. Please try again.