Code Monkey home page Code Monkey logo

dart-sqlite's Introduction

dart-sqlite: SQLite bindings for the Dart VM

Download

Try the binary build which should work on Mac, 64-bit Linux, and Windows.

You can also build it yourself, see below.

Example

#import('lib/sqlite.dart');
var c = new sqlite.Database("/tmp/test.db");
try {
    // Simple queries and statements
    Row results = c.first("SELECT ?+2, UPPER(?)", [3, "Hello"]);
    var five = results[0];
    var shouting = results[1];

    // Iterating over a result set
    var count = c.execute("SELECT * FROM posts LIMIT 10", callback: (row) {
        print("${row.title}: ${row.body}");
    });
    print("Showing ${count} posts.");

    // Reusing prepared statements
    var statement = c.prepare("INSERT INTO posts (title, body) VALUES (?,?)");
    try {
        statement.execute(["Hi", "Hello world"]);
        statement.execute(["Byte", "Goodbye cruel world"]);
    } finally {
        statement.close();
    }
} finally {
    c.close();
}

Documentation

Yes! Here's the dartdoc.

Building (Linux/Mac)

You'll need:

  • Dart SDK
  • sqlite3-dev package
  • g++ toolchain.

Either edit build.sh to point to the SDK, or set the environment variable DART_SDK.

Building the library

./build.sh

Generating documentation

./build.sh doc

Running tests

./build.sh test

Building (Windows)

You'll need:

  • Dart SDK
  • dart.lib, the Dart native API library. You can obtain this by compiling Dart from source or grab this version (last updated: 2012-04-24)
  • The SQLite source code (the 'amalgamation')
  • Visual C++ 2008. The free version works fine.

Edit build.bat to point to the SDK and the SQLite sources.

Building the library

Edit build.bat to specify where you extracted the SQLite and Dart sources.

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat
build

Generating the documentation

build doc

Running tests

build test

Legal stuff

Copyright 2012 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

dart-sqlite's People

Contributors

sam-mccall avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.