- 授权协议: MIT
- 开发语言: Java
- 操作系统: Android
- 软件首页: https://github.com/mjason/ANGROM
- 软件文档: https://github.com/mjason/ANGROM
软件介绍
ANGROM 是一个简单的android 数据库 dsl, 解决了数据库版本控制问题, 提供了select查询类.
使用入门
-
下载并导入jar包
-
创建MyApplication类
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
}}
-
修改 AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="xx.xx.xx" android:versionCode="1" android:versionName="1.0" > <application android:name=".MyApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > </application></manifest>
-
创建数据库
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
MigrationManager migrationManager = new MigrationManager();
Migration user = new CreateTable("users")
.addAutoIncrementPrimaryKey("id")
.addColumn(Genre.STRING, "name");
migrationManager.addMigration(1, user); // 添加数据库1的迁移, 可以添加很多个
SQLHelper sqlHelper = new SQLHelper(getContext(), migrationManager, "test.db", 1);
sqlHelper.getWritableDatabase();
}}
5.修改版本
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
MigrationManager migrationManager = new MigrationManager();
Migration user = new CreateTable("users")
.addAutoIncrementPrimaryKey("id")
.addColumn(Genre.STRING, "name");
migrationManager.addMigration(1, user); // 添加数据库1的迁移, 可以添加很多个
Migration person = new CreateTable("person")
.addAutoIncrementPrimaryKey("id")
.addColumn(Genre.STRING, "age");
migrationManager.addMigration(2, person);
Migration test1 = new CreateTable("test1")
.addAutoIncrementPrimaryKey("id")
.addColumn(Genre.INTEGER, "age");
migrationManager.addMigration(3, test1);
Migration test2 = new CreateTable("test2")
.addAutoIncrementPrimaryKey("id")
.addColumn(Genre.INTEGER, "age");
migrationManager.addMigration(4, test2);
SQLHelper sqlHelper = new SQLHelper(getContext(), migrationManager, "test.db", 4);
sqlHelper.getWritableDatabase();
}}
-
使用查询
Cursor cursor = new Select("id, name")
.from("users")
.where(String.format("id=%s", id_.toString()))
.query(sqlHelper.getReadableDatabase());if (cursor.moveToNext()) {
Assert.assertEquals(cursor.getString(1), "ngdkSelect");} else {
Assert.fail("测试失败");}Cursor cursor = new Select("id, name")
.from("users")
.where("id=?")
.query(sqlHelper.getReadableDatabase(), new String[] {id.toString()});if (cursor.moveToNext()) {
Assert.assertEquals(cursor.getString(1), "ngdkSelect");} else {
Assert.fail("测试失败");}
Node.js实战
[美] Mike Cantelon、[美] TJ Holowaychuk、[美] Nathan Rajlich / 吴海星 / 人民邮电出版社 / 2014-5 / 69.00元
服务器端JavaScript?没错。Node.js是一个JavaScript服务器,支持可伸缩的高性能Web应用。借助异步I/O,这个服务器可以同时做很多事情,能满足聊天、游戏和实时统计等应用的需求。并且既然是JavaScript,那你就可以全栈使用一种语言。 本书向读者展示了如何构建产品级应用,对关键概念的介绍清晰明了,贴近实际的例子,涵盖从安装到部署的各个环节,是一部讲解与实践并重的优秀......一起来看看 《Node.js实战》 这本书的介绍吧!
