Configuration是属於util工具包。

把所有环境设置都定义在Configuration工具包里,那麽这个Configuration就是独立的单一入囗。

在架构上,可以提高耦合度,而且出Bug时也方便追纵。

更重要的是,假如表格的Name需要改变,那只要在Configuration里改一下变量就行,不用担心其他控件会因此出Bug。

这里第一部份定义了SQlite的Query,第二部份定义了okhttp的URL。

1. SQlite的Query

/*
* SQLite
*/
public static final String DB_NAME = "epdz.db";
public static int DB_VERSION = 23; /*
* SQLite [Table]User
*/
public static final String DB_USER = "epdz_user";
public static final String USER_ID = "id";
public static final String USER_USERID = "userId";
public static final String USER_NAME = "name";
public static final String USER_PASSWORD = "password";
public static final String USER_EMAIL = "email";
public static final String USER_DESCRIPTION = "description";
public static final String USER_TEAM = "team";
public static final String USER_ACADEMIC = "academic";
public static final String USER_PORTRAIT = "portrait";
public static final String USER_PORTRAIT_DATA = "portraitData";
public static final String USER_REGISTER_DATE = "registerDate"; /*
* SQLite [Table]Post
*/
public static final String DB_POST = "epdz_post";
public static final String POST_ID = "pid";
public static final String POST_POSTID = "id";
public static final String POST_CATEGORY = "category";
public static final String POST_DATE = "date";
public static final String POST_AUTHORID = "authorId";
public static final String POST_EDITORID = "editorId";
public static final String POST_TITLE = "title";
public static final String POST_ABSTRACT = "abstract";
public static final String POST_ABSTRACTIMG = "abstractImg";
public static final String POST_CONTEXT = "context";
public static final String POST_ISTOP = "isTop";
public static final String POST_VISITABLE = "visitable";
public static final String POST_AUTHORNAME = "authorName";
public static final String POST_EDITORNAME = "editorName";
public static final String POST_CATEGORYNAME = "categoryName"; /*
* SQlite [Table] Create user
*/
public static final String CREATE_USER_TABLE = " CREATE TABLE " +DB_USER+ " (" +
USER_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
USER_USERID + " VARCHAR(256) NOT NULL, " +
USER_NAME + " VARCHAR(256) NOT NULL, " +
USER_PASSWORD + " VARCHAR(256) NOT NULL, " +
USER_EMAIL + " VARCHAR(256), " +
USER_DESCRIPTION + " VARCHAR(512), " +
USER_TEAM + " VARCHAR(256), " +
USER_ACADEMIC + " VARCHAR(256), " +
USER_PORTRAIT + " VARCHAR(512), " +
USER_PORTRAIT_DATA + " BLOB, " +
USER_REGISTER_DATE + " VARCHAR(256) NOT NULL );"; /*
* SQlite [Table] Create post
*/
public static final String CREATE_POST_TABLE = " CREATE TABLE " +DB_POST+ " (" +
POST_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
POST_POSTID + " VARCHAR(32) NOT NULL, " +
POST_CATEGORY + " VARCHAR(32), " +
POST_CATEGORYNAME + " VARCHAR(32), " +
POST_DATE + " VARCHAR(32), " +
POST_AUTHORID + " VARCHAR(32), " +
POST_AUTHORNAME + " VARCHAR(32), " +
POST_EDITORID + " VARCHAR(32), " +
POST_EDITORNAME + " VARCHAR(32), " +
POST_TITLE + " VARCHAR(512), " +
POST_ABSTRACT + " VARCHAR(1024), " +
POST_ABSTRACTIMG + " VARCHAR(1024), " +
POST_CONTEXT + " VARCHAR(2048), " +
POST_ISTOP + " VARCHAR(32), " +
POST_VISITABLE + " VARCHAR(32) );";

2. okhttp的URL

/*
* login query
* @param [String] userNmae, [String] userPassword
* @return [BOOL]result, [String]userId
*/
public static String isUserExistURL(String userNmae, String userPassword)
{
return "http://e-pdz.com/epdz/router/mobile/userRouter.php?action=isUserExist&name="+userNmae+"&password="+userPassword;
} /*
* get user query
* @param [String]userId
* @return [array]user
*/
public static String getUserURL(String userId) {
return "http://e-pdz.com/epdz/router/mobile/userRouter.php?action=getUserByUserId&id="+userId;
} /*
* create user query
* @param [String] name, [String] password
* @return [BOOL]result
*/
public static String createUserURL(String name, String password) {
return "http://e-pdz.com/epdz/router/mobile/userRouter.php?action=register&name="+name+"&password="+password;
} /*
* update user query
* @param [UserDTO]userDTO
* @return [BOOL]result, [String]userId
*/
public static String updateUserURL(UserDTO userDTO) {
Integer id = userDTO.getId();
String name = userDTO.getName();
String password = userDTO.getPassword();
String description = userDTO.getDescription();
String team = userDTO.getTeam();
String academic = userDTO.getAcademic(); return "http://e-pdz.com/epdz/router/mobile/userRouter.php?action=updateUser&id="+id+"&name="+name+
"&password="+password+"&description="+description+"&team="+team+"&academic="+academic;
} /*
* get all post query
* @return [array] post
*/
public static String getAllPost = "http://e-pdz.com/epdz/router/mobile/postRouter.php?action=getAllPost"; /*
* get hot post query
* @return [array] post
*/
public static String getHotPost = "http://e-pdz.com/epdz/router/mobile/postRouter.php?action=getHotPost"; /*
* get hot post offset query
* @param [String]start, [String]amount
* @return [array]post
*/
public static String getHotPostByCursor(Integer start, Integer amount) {
return "http://e-pdz.com/epdz/router/mobile/postRouter.php?action=getHotPostByCursor&start="+start+
"&amount="+amount;
} /*
* get post query
* @param [String] category
* @return [array] post
*/
public static String getPostByCategoryURL(String Category) {
return "http://e-pdz.com/epdz/router/mobile/postRouter.php?action=getPostByCategory&category="+Category;
} /*
* get post query
* @param [String] postId
* @return [array] post
*/
public static String getPostByIdURL(String id) {
return "http://e-pdz.com/epdz/router/mobile/postRouter.php?action=getPostById&postId="+id;
} /*
* get post query
* @param [String] postId
* @return [html] post
*/
public static String getPostHhtmlByIdURL(String id) {
return "http://e-pdz.com/epdz/viewAndroid/post/post.php?id="+id;
} /*
* get user like post
* @param [String]userId
* @return [array]post
*/
public static String getLikePostByUserId(String id) {
return "http://e-pdz.com/epdz/router/mobile/userRouter.php?action=getLikePostByUserId&userId="+id;
} /*
* get user comment query
* @param [String]userId
* @return [array]post
*/
public static String getCommentByWriterId(String id) {
return "http://e-pdz.com/epdz/router/mobile/userRouter.php?action=getCommentByWriterId&userId="+id;
} /*
* get user message query
* @param [String]receiverId
* @return [array]Message
*/
public static String getMessageByReceiverId(String receiverId) {
return "http://e-pdz.com/epdz/router/mobile/userRouter.php?action=getMessageByReceiverId&receiverId="+receiverId;
} /*
* update portrait query
*
*/
public static String updatePortrait = "http://e-pdz.com/epdz/router/mobile/userRouter.php";

这里只出一部份代码供叁考。

Sqlite教程(3) SQlite Query的更多相关文章

  1. SQLite Learning、SQL Query Optimization In Multiple Rule

    catalog . SQLite简介 . Sqlite安装 . SQLite Programing . SQLite statements 1. SQLite简介 SQLite是一款轻型的数据库,是遵 ...

  2. android安卓 SQLite教程:内部架构及SQLite使用办法

    SQLite 介绍 SQLite一个非常流行的嵌入式数据库,它支持SQL语言,并且只利用很少的内存就有很好的性能.由于JDBC不适合手机这种内存受限设备,所以Android开发人员需要学习新的API ...

  3. sqlite3使用教程1 SQLite 命令

    http://www.runoob.com/sqlite/sqlite-commands.html 本章将向您讲解 SQLite 编程人员所使用的简单却有用的命令.这些命令被称为 SQLite 的点命 ...

  4. Xamarin SQLite教程Xamarin.iOS项目添加引用

    Xamarin SQLite教程Xamarin.iOS项目添加引用 使用直接方式访问SQLite数据库,需要将System.Data和Mono.Data.SQlite库导入到创建的项目中.下面将分别讲 ...

  5. Xamarin SQLite教程数据库访问与生成

    Xamarin SQLite教程数据库访问与生成 在本教程中,我们将讲解如何开发SQLite相关的App.在编写程序前,首先需要做一些准备工作,如了解Xamarin数据库访问方式,添加引用,构建使用库 ...

  6. SQLite教程

    SQLite教程 http://www.runoob.com/sqlite/sqlite-date-time.html SQLite管理工具http://www.sqliteexpert.com/do ...

  7. SQLite的使用--SQLite语句

    一.SQLite的介绍   1.为什么要存储数据?        1.1 手机数据大多都是从网络加载的,不存储,每次滚动界面都要从新发送网络请求加载数据,浪费流量      1.2 当用户没网的时候, ...

  8. 纯 Swift 封装的 SQLite 框架:SQLite.swift

    SQLite.swift 是一个使用纯 Swift 语言封装 SQLite3 的操作框架. 特性: 简单的查询和参数绑定接口 安全.自动类型数据访问 隐式提交和回滚接口 开发者友好的错误处理和调试 文 ...

  9. 【Android】13.3 使用SQLite.NET-PCL访问SQLite数据库

    分类:C#.Android.VS2015: 创建日期:2016-02-26 一.简介 本章开头已经说过了,SQLite.NET-PCL用起来很爽,这一节咱们看看怎样使用吧. 二.示例3运行截图 下面左 ...

随机推荐

  1. 51Nod-1072-威佐夫游戏

    有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆中取任意个或从2堆中取相同数量的石子,但不可不取.拿到最后1颗石子的人获胜.假设A B都非常聪明,拿石子的过程中不会出现失误.给出2堆石子的数量, ...

  2. vue组件化应用构建

    组件系统是 Vue 的另一个重要概念,因为它是一种抽象,允许我们使用小型.独立和通常可复用的组件构建大型应用.仔细想想,几乎任意类型的应用界面都可以抽象为一个组件树: 在 Vue 里,一个组件本质上是 ...

  3. CSS绘制小三角

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. PAT Advanced 1034 Head of a Gang (30) [图的遍历,BFS,DFS,并查集]

    题目 One way that the police finds the head of a gang is to check people's phone calls. If there is a ...

  5. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war

    创建springboot项目,且不采用<parent>引入springboot时,pom.xml如下: <?xml version="1.0" encoding= ...

  6. UVA - 1629 Cake slicing(切蛋糕)(dp---记忆化搜索)

    题意:有一个n行m列(1<=n, m<=20)的网格蛋糕上有一些樱桃.每次可以用一刀沿着网格线把蛋糕切成两块,并且只能够直切不能拐弯.要求最后每一块蛋糕上恰好有一个樱桃,且切割线总长度最小 ...

  7. Java算法练习——寻找两个有序数组的中位数

    题目链接 题目描述 给定两个大小为 m 和 n 的有序数组 nums1 和 nums2. 请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 $O(log(m + n))$. 你可以假设 nu ...

  8. html_位置偏移属性position

    定位属性 位置属性position:static.relative.absolute.fixed 偏移属性:top.bottom.left.right 浮动定位属性:float/clear 1.浮动定 ...

  9. viewer.js插件简单使用说明

    不需要依赖jQuery.js,只需要导入viewer.js和viewer.css文件即可. 插件GitHub地址:https://github.com/fengyuanchen/viewerjs 示例 ...

  10. GBDT入门

    GBDT(MART)迭代决策树入门教程 GBDT(Gradient Boosting Decision Tree) 又叫 MART(Multiple Additive Regression Tree) ...