Skip to content

Instantly share code, notes, and snippets.

@chzyer
Last active December 14, 2015 23:49
Show Gist options
  • Save chzyer/5168236 to your computer and use it in GitHub Desktop.
Save chzyer/5168236 to your computer and use it in GitHub Desktop.
andfree重构文档

AndFree 重构计划

目录

1. 数据库封装 (db)
2. 控件封装 (widget)
3. ContentProvider和数据库对等封装 (rdb)
4. 网络库封装 (net)
5. 辅助函数 (helper)
6. 其他

一. 数据库封装 (org.chenye.db)

  1. 数据库操作

    a. 构造:

select() from() where() limit() b. 查询java result() get() c. 操作:java update() insert() delete() ```

  1. 数据库构造: 类型:

    • DBInt
    • DBBool
    • DBText
  2. 用法实例

// 构造sql
Account acc = new Account();
acc.user.set("aaa");
acc.pasw.set("123");
acc.select(acc.pasw).orderBy(acc.user);
acc.toSql(); // sql语句

// 执行查询
Line data = acc.result();

// 插入
Account acc = new Account();
acc.user = "aa";
acc.insert();

// 更新
Account acc = new Account();
acc.user.set("aa");
acc.pasw.set("123");
acc.update(acc.user);

// 定义
public static Account extends Table {
	public DBInt id;
	public DBText user;
	public DBBool pasw;
}

二. Widget (org.chenye.widget)

控件封装

三. ContentProvider (org.chenye.rdb)

df

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment