sqllite 1.1.0 copy "sqllite: ^1.1.0" to clipboard
sqllite: ^1.1.0 copied to clipboard

discontinued
Dart 1 only

A dart wrapper for kipken/sql.js

example/main.dart

import 'dart:html';
import 'dart:convert';
import 'dart:typed_data';
import 'package:sqllite/sqllite.dart';

InputElement uploadInput;
Database db;
main() {
  uploadInput = querySelector('#fileupload');
  uploadInput.onChange.listen(importDb);
}

importDb(evt) {
  final files = uploadInput.files;
  if (files.length == 1) {
    final file = files[0];
    final reader = new FileReader();
    reader.onLoadEnd.listen((e) {
      var upload = reader.result.toString().split(',').elementAt(1);
      var dbBytes = BASE64.decode(upload);
      fillDB(dbBytes);
    });
    reader.readAsDataUrl(file);
  }
}

fillDB(List<int> data) {
  db = new Database(new Uint8List.fromList(data));
  var output = db.exec('SELECT * from LIST_ITEM');
  for (var row in output[0].values) {
    print(row);
  }
}
0
likes
25
pub points
67%
popularity

Publisher

verified publisherjpryan.me

A dart wrapper for kipken/sql.js

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

js, resource

More

Packages that depend on sqllite