sqltree_query 0.5.0+1

  • Example
  • Installing
  • Versions
  • 0

example/sqltree_query_example.dart

// Copyright (c) 2016, Roberto Tassi. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:sqltree/sqltree.dart' as sql;
import 'package:sqltree_query/sqltree_query.dart';

main() async {
  var statement = sql.select(2);
  print(statement);
  print(statement.isFreezed);

  var queryManager = new QueryManagerImpl(null);
  var query = queryManager.prepareSelect();

  query.statement.select(1);

  var query2 = query.clone();
  query2.statement
    ..clearSelect()
    ..select(2);

  print(query.statement);
  print(query2.statement);
}

test1() async {
  // 1. preparazione della query
  QueryManager queryManager;
  // statement
  Query<sql.SqlSelectStatement> query = queryManager.prepare(sql.select());

  query.statement.select(1);

  var query2 = query.clone();
  query2.statement
    ..clearSelect()
    ..select(2);

  print(query);
  print(query2);
}

test2() async {
  // 1. preparazione della query
  QueryManager queryManager;
  // statement
  var query = queryManager.prepareSelect();

  query.statement
    ..select(1)
    ..from(2);
}

test3() async {
  // 1. preparazione della query
  QueryManager queryManager;
  // statement
  var query = queryManager.prepareSelect();
  query.statement
    ..select(1)
    ..from(2);
  // parametri
  query.parameters["status"] = true;
  query.parameters.set("status", true);
  query.parameters.setBool("status", true);
  query.parameters.set("status", true, type: QueryValueType.BOOL);
  // tipi colonne risultati
  query.resultColumnTypes["status"] = QueryValueType.BOOL;
  query.resultColumnTypes.setBool("status");
  query.resultColumnTypes["status"] = QueryValueType.BOOL;

  // 2. esecuzione della query e recupero ResultSet
  var result = await query.execute();

  // 3. lettura resultset
  if (result.isResultSet) {
    for (var record in result.rows) {
      // recupero colonne
      record["status"];
      record.get("status");
      record.get("status", type: QueryValueType.BOOL);
      record.getBool("status");
    }
  } else {
    result.lastInsertId;
    result.affectedRows;
  }
}

test4() async {
  // 1. preparazione della query
  QueryManager queryManager;
  // statement
  Query query = queryManager.prepare(sql.select());
  // parametri
  query.parameters["status"] = true;
  query.parameters.set("status", true);
  query.parameters.setBool("status", true);
  query.parameters.set("status", true, type: QueryValueType.BOOL);
  // tipi colonne risultati
  query.resultColumnTypes["status"] = QueryValueType.BOOL;
  query.resultColumnTypes.setBool("status");
  query.resultColumnTypes["status"] = QueryValueType.BOOL;

  // 2. esecuzione della query e recupero ResultSet
  var result = await query.execute();

  // 3. lettura resultset
  if (result.isResultSet) {
    for (var record in result.rows) {
      // recupero colonne
      record["status"];
      record.get("status");
      record.get("status", type: QueryValueType.BOOL);
      record.getBool("status");
    }
  } else {
    result.lastInsertId;
    result.affectedRows;
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  sqltree_query: ^0.5.0+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:sqltree_query/sqltree_query.dart';
  
Version Uploaded Documentation Archive
0.5.0+1 Dec 13, 2016 Go to the documentation of sqltree_query 0.5.0+1 Download sqltree_query 0.5.0+1 archive
0.5.0 Dec 13, 2016 Go to the documentation of sqltree_query 0.5.0 Download sqltree_query 0.5.0 archive
0.4.0 Dec 6, 2016 Go to the documentation of sqltree_query 0.4.0 Download sqltree_query 0.4.0 archive
0.3.0+2 Nov 30, 2016 Go to the documentation of sqltree_query 0.3.0+2 Download sqltree_query 0.3.0+2 archive
0.3.0+1 Oct 13, 2016 Go to the documentation of sqltree_query 0.3.0+1 Download sqltree_query 0.3.0+1 archive
0.3.0 Jul 29, 2016 Go to the documentation of sqltree_query 0.3.0 Download sqltree_query 0.3.0 archive
0.2.0 Jul 20, 2016 Go to the documentation of sqltree_query 0.2.0 Download sqltree_query 0.2.0 archive
0.1.0 Jul 11, 2016 Go to the documentation of sqltree_query 0.1.0 Download sqltree_query 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0