package com.sogouchat.os;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
public interface MsgSqlConst {
String[] Projection_Sms = new String[] { "_id", "thread_id", "person",
"protocol", "read", "status", "type", "date", "address",
"body" };
public static final int Index_Sms_Id = 0;
public static final int Index_Sms_ThreadId = 1;
public static final int Index_Sms_Person = 2;
public static final int Index_Sms_Protocol = 3;
public static final int Index_Sms_Read = 4;
public static final int Index_Sms_Status = 5;
public static final int Index_Sms_Type = 6;
public static final int Index_Sms_Date = 7;
public static final int Index_Sms_Address = 8;
public static final int Index_Sms_Body = 9;
/*
select pdu._id, pdu.thread_id, pdu.read, pdu.st, pdu.msg_box, pdu.date, addr.address, pdu.ct_l
from pdu, addr
where (pdu._id=addr.msg_id) and (pdu.thread_id=115)
group by pdu._id
*/
public static final int Index_Mms_Id = 0;
public static final int Index_Mms_ThreadId = 1;
public static final int Index_Mms_Read = 2;
public static final int Index_Mms_Status = 3;
public static final int Index_Mms_Type = 4;
public static final int Index_Mms_Date = 5;
public static final int Index_Mms_Address = 6;
public static final int Index_Mms_Body = 7;
String[] Projection_Contact = new String[] { ContactsContract.Contacts._ID,
ContactsContract.Contacts.PHOTO_ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER,
ContactsContract.CommonDataKinds.Phone.TYPE };
public static final int Index_Contact_Id = 0;
public static final int Index_Photo_Id = 1;
public static final int Index_Name = 2;
public static final int Index_Number = 3;
public static final int Index_Type = 4;
String[] Projection_Thread = new String[] {"thread_id",
"read", "status", "type", "date", "address", "body" };
public static final int Index_Thread_Id = 0;
public static final int Index_Thread_Read = 1;
public static final int Index_Thread_Status = 2;
public static final int Index_Thread_Type = 3;
public static final int Index_Thread_Date = 4;
public static final int Index_Thread_Address = 5;
public static final int Index_Thread_Body = 6;
/*
Cursor draftCursor = mContext.getContentResolver().query(Uri.parse("content://sms"),
new String[] {"threads._id, canonical_addresses.address, threads.date, threads.message_count, threads.unread_count, " +
"threads.snippet, threads.snippet_cs, threads.read, threads.has_attachment "+
" from threads,canonical_addresses " +
"where threads.recipient_ids=canonical_addresses._id order by threads.date desc --"},
*/
public static final int Index_Threads_Id = 0;
public static final int Index_Threads_Address = 1;
public static final int Index_Threads_Date = 2;
public static final int Index_Threads_Msg_Cnt = 3;
public static final int Index_Threads_Snippet = 4;
public static final int Index_Threads_Snippet_cs = 5;
public static final int Index_Threads_Read = 6;
public static final int Index_Threads_Attach = 7;
public static final int Index_Threads_UnMsg_Cnt = 2;
}
/*
threads表(会话)
列名
类型
说明
_id
integer
唯一标识,自增,从1开始
date
integer
会话最新更新时间
message_count
integer
当前会话所包含的消息数量
recipient_ids
text
接收者(canonical_addresses表的id)列表,所有接收者以空格隔开
snippet
text
最新更新的消息的内容(彩信为主题,短信为正文)
snippet_cs
integer
snippet的编码方式,彩信:UTF-8为106,短信为0
read
integer
是否有未读信息:0-未读,1-已读
type
integer
会话类型,0-普通会话(只有一个接收者),1-广播会话(多个接收者)
error
integer
发送失败的消息(type=5)的数量
has_attachment
integer
是否有附件:0-无,1-有
sms表(短信)
列名
类型
说明
_id
integer
唯一标识,自增,从1开始
thread_id
integer
threads表的id
address
text
接收者手机号码,对于一个会话,有可能含有多个接收者,每个人都将收到一条短信
person
integer
联系人(模块)列表里的序号,陌生人为null
date
integer
时间,以豪秒来表示
protocol
integer
协议,分为:0-SMS_RPOTO,1-MMS_PROTO。成功发送后设置。
read
integer
是否阅读:0-未读,1-已读
status
integer
状态:-1默认值,0-complete,64-pending,128-failed
type
integer
ALL=0;INBOX=1;SENT=2;DRAFT=3;OUTBOX=4;FAILED=5;QUEUED=6;
reply_path_present
integer
TP-Reply-Path位的值 0/1
subject
text
短信的主题,默认为空
body
text
短信内容
service_center
text
短信服务中心号码编号
locked
integer
此条短信是否已由用户锁定,0-未锁定,1-已锁定
error_code
integer
错误代码,有哪些值暂时未知
seen
integer
用于指明该消息是否已被用户看到(非阅读,点开会话列表即可,不用打开会话),仅对收到的消息有用
pdu表(彩信)
列名
类型
说明
_id
integer
唯一标识,自增,从1开始
thread_id
integer
threads表的id
date
integer
时间,以秒来表示(与短信的不同)
msg_box
integer
此条彩信属于哪个信箱,all为0,inbox为1,sent为2,draft为3,outbox为4,failed为5
read
integer
此条彩信是否已读:0-未读,1-已读
m_id
text
Message-ID,由彩信服务器分配的消息id
sub
text
此条彩信主题
sub_cs
integer
此条彩信主题编码方式:UTF-8为106
ct_t
text
彩信对应的Content-Type是application/vnd.wap.multipart.related
ct_l
text
X-Mms-Content-Location
exp
integer
X-Mms-Expiry,彩信有效期
m_cls
text
X-Mms-Message-Class,此条彩信的用途:auto,advertisement,personal,informational
m_type
integer
X-Mms-Message-Type,由MMS协议定义的彩信类型,其中send-req为128、notification-ind为130、retrieve-conf为132
v
integer
X-Mms-MMS-Version,此条彩信对应的MMS协议的版本号,1.0 16,1.1 17,1.2 18,1.3 19
m_size
integer
X-Mms-MessageSize
pri
integer
X-Mms-Priority,此条彩信的优先级,normal 129,low 128,high 130
rr
integer
X-Mms-Read-Report,此条彩信的阅读报告,129
rpt_a
integer
X-Mms-Report-Allowed
resp_st
integer
X-Mms-Response-Status
st
integer
该彩信的下载状态,未启动-128,下载中-129,传输失败-130,保存失败-135
tr_id
text
X-Mms-Transaction-Id,事务标识
retr_st
integer
X-Mms-Retrieve-Status
retr_txt
text
X-Mms-Retrieve-Text
retr_txt_cs
integer
RETRIEVE_TEXT的编码方式
read_status
integer
X-Mms-Read-Status
ct_cls
integer
X-Mms-Content-Class
resp_txt
text
X-Mms-Response-Text
d_tm
integer
X-Mms-Delivery-Time
d_rpt
integer
X-Mms-Delivery-Report,此条彩信的传输报告,是-128,否-129
locked
integer
此条彩信是否已由用户锁定,0-未锁定,1-已锁定
seen
integer
用于指明该消息是否已被用户看到(非阅读,点开会话列表即可,不用打开会话),仅对收到的消息有用
part表(附件)
列名
类型
说明
_id
integer
唯一标识,自增,从1开始
mid
integer
pdu表的id
seq
integer
标志part的顺序,若ct为application/smil,则为-1,否则为0
ct
text
此PART内容类型,如果是彩信始末:application/smil;如果是文本附件:text/plain;图像附件:jpg:image/jpeg,gif:image/gif;音频附件:audio/mpeg
name
text
该PART的名字
chset
integer
该PART的编码方式,UTF-8为106
cd
text
CONTENT_DISPOSITION
fn
text
该PART的文件名称
cid
text
CONTENT_ID,该PART内容的id
cl
text
该PART的文件的位置
ctt_s
integer
CONTENT_TYPE内容类型在消息中的起始位置,未在代码中设置
ctt_t
text
CONTENT_TYPE内容类型的类型,未在代码中设置
_data
text
彩信附件在手机上的地址
text
text
如果是彩信始末,为彩信的SMIL内容;如果是文本附件,为附件内容;如果是视频、音频附件,此参数为空
addr表
列名
类型
说明
_id
integer
唯一标识,自增,从1开始
msg_id
integer
pdu表的id
contact_id
integer
电话本中联系人的id
address
text
电话号码,如果为insert-address-token且type为151,说明为本机号码
type
integer
电话号码的类型,必须为PduHeaders.BCC-129,PduHeaders.CC-130,PduHeaders.FROM-137,PduHeaders.TO-151之一
charset
integer
电话号码编码方式
canonical_addresses表
列名
类型
说明
_id
integer
唯一标识,自增,从1开始
address
text
所有曾经使用过的接收者的电话号码,用于threads表标识会话
*/