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. linux服务重启命令

    /etc/init.d/sshd restart/etc/init.d/sshd reload systemctl status sshd.servicesystemctl restart sshd. ...

  2. mysql第四篇--SQL逻辑查询语句执行顺序

    mysql第四篇--SQL逻辑查询语句执行顺序 一.SQL语句定义顺序 SELECT DISTINCT <select_list> FROM <left_table> < ...

  3. 如何利用vue脚手架创建一个vue项目

    1.安装node.js 2.打开命令行查看下npm和node是否都安装好 node -v npm -v 3.安装淘宝镜像cnpm $ npm install -g cnpm --registry=ht ...

  4. trove database功能总结

    我曾经以为trove只负责数据库(datastore)的部署,最近才发现trove可以进行数据库(database)的创建. 首先是列出某个实例上(instance)数据库(datastrore)上的 ...

  5. php curl模拟post请求提交数据例子总结

    php curl模拟post请求提交数据例子总结 [导读] 在php中要模拟post请求数据提交我们会使用到curl函数,下面我来给大家举几个curl模拟post请求提交数据例子有需要的朋友可参考参考 ...

  6. ipa提取png图片,windows下显示黑色

    原因:ipa提取的png图片经过xcode特殊格式处理,在windows下查看会显示黑色   方法1:通过“ ipin.py文件”转化 过程: 1.安装python,需2.7版本,本文使用2.7.5 ...

  7. Thread--停止线程

    参考:http://blog.sina.com.cn/s/blog_6ca570ed01016mti.html Thread.interrupt()方法不会中断一个正在运行的线程.它的作用是,在线程受 ...

  8. C#-类型转换和引用转换

    对象的引用可以被: 隐式地向上转换 显示的向下转换 向上转换 向上转换是指一个从一个基类指向一个子类: House house = new House(); Asset asset = house; ...

  9. LA 3882 经典约瑟夫环问题的数学递推解法

    就是经典约瑟夫环问题的裸题 我一开始一直没理解这个递推是怎么来的,后来终于理解了 假设问题是从n个人编号分别为0...n-1,取第k个, 则第k个人编号为k-1的淘汰,剩下的编号为  0,1,2,3. ...

  10. sourceTree 代码回滚(git 和http)

    近些时候,有遇到提交后代码有误的情况,所以需要回退到前一个版本.因为不常见,所以每次都不是很熟练,记录于此,以备查阅. 一.[将master重置到这次提交] 在sourceTree中选中错误的提交的下 ...