Appmate Droid
1.3.0
|
指向資料表的連接物件。 更多...
公開方法(Public Methods) | |
Tuple | getSchema () throws IOException |
取得資料表結構敘述。 更多... | |
Tuple [] | get () throws IOException |
取得資料表上的所有內容。 更多... | |
Tuple | get (String primaryKey) throws IOException |
以主鍵取得表格上之物件 更多... | |
Tuple | get (int id) throws IOException |
以 id 取得資料表上的特定物件。在 appmate 資料庫中多數的物件皆以 id 為主鍵。 更多... | |
Tuple [] | get (String... filters) throws IOException |
取得符合特定條件的物件。 更多... | |
void | add (Tuple... items) throws IOException |
新增物件到資料表中。 更多... | |
void | update (String primaryKey, Tuple item, boolean overwrite) throws IOException |
更新一個資料表上的項目。 更多... | |
void | update (int id, Tuple item, boolean overwrite) throws IOException |
更新一個資料表上的項目。 更多... | |
void | update (String primaryKey, Tuple item) throws IOException |
更新一個資料表上的項目。 本函式僅更新 item 下帶著的內容。 更多... | |
void | update (int id, Tuple item) throws IOException |
更新一個資料表上的項目。 本函式僅更新 item 下帶著的內容。 更多... | |
void | update (Tuple item, boolean overwrite) throws IOException |
更新一個資料表上的項目。適用於當 item 已經帶有主鍵時。 本函式僅更新 item 下帶著的內容。 更多... | |
void | update (Tuple item) throws IOException |
更新一個資料表上的項目。適用於當 item 已經帶有主鍵時。 更多... | |
void | delete (int... ids) throws IOException |
刪除一些項目。 更多... | |
void | delete (String... primaryKeys) throws IOException |
刪除一些項目。 更多... | |
建構子 | |
Table (@NonNull String apiRoot, @NonNull String table) | |
建立一個不帶授權的 Table 實體。 更多... | |
Table (@NonNull String apiRoot, @NonNull String table, @NonNull String username, @NonNull String password) | |
建立一個帶授權的 Table 實體。 更多... | |
Table (@NonNull Database database, @NonNull String table) | |
自母資料庫建立表格連結。 更多... | |
指向資料表的連接物件。
Table | ( | @NonNull String | apiRoot, |
@NonNull String | table | ||
) |
建立一個不帶授權的 Table 實體。
apiRoot | api root 所在位置( 非 表格路徑),須包含傳輸阜,如:http://example:8000/api/ |
table | 資料表名稱 |
Table | ( | @NonNull String | apiRoot, |
@NonNull String | table, | ||
@NonNull String | username, | ||
@NonNull String | password | ||
) |
建立一個帶授權的 Table 實體。
apiRoot | api root 所在位置( 非 表格路徑),須包含傳輸阜,如:http://example:8000/api/ |
username | 登入用使用者名稱 |
password | 登入用密碼 |
table | 資料表名稱 |
void add | ( | Tuple... | items | ) | throws IOException |
新增物件到資料表中。
items | 要加入資料表的物件清單 |
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
void delete | ( | int... | ids | ) | throws IOException |
刪除一些項目。
ids | 要被刪除的項目的 id ,在 appmate 資料庫中多數的物件皆以 id 為主鍵。 |
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
void delete | ( | String... | primaryKeys | ) | throws IOException |
刪除一些項目。
primaryKeys | 要被刪除的項目的主鍵 |
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
Tuple [] get | ( | ) | throws IOException |
取得資料表上的所有內容。
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
Tuple get | ( | String | primaryKey | ) | throws IOException |
以主鍵取得表格上之物件
primaryKey | 主鍵 |
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
Tuple get | ( | int | id | ) | throws IOException |
以 id
取得資料表上的特定物件。在 appmate
資料庫中多數的物件皆以 id
為主鍵。
id | 物件 id |
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
Tuple [] get | ( | String... | filters | ) | throws IOException |
取得符合特定條件的物件。
可指定一個或多個過濾條件,用以篩選出指定的物件。 所有過濾條件皆需以字串形式給予,如:
AND
運算),目前不支援聯集運算(OR
運算)現階段支援以下數種過濾條件
完全比對 (適用型別: String)
使用符號: =
, ==
使用符號: =
, ==
0
, 1
而非 True
, False
不等式 (適用型別:Integer, Float, Double)
使用符號: >
, >=
, <
, <=
filters | 篩選規則 |
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
Tuple getSchema | ( | ) | throws IOException |
取得資料表結構敘述。
如:
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
void update | ( | String | primaryKey, |
Tuple | item, | ||
boolean | overwrite | ||
) | throws IOException |
更新一個資料表上的項目。
primaryKey | 要更新的項目的主鍵 |
item | 要更新的資料 |
overwrite | 是否進行完全覆寫, False 時候僅 item 內所帶的欄位會被修正 |
IOException | 資料表不存在、網路錯誤,或當 overwrite 為 True 卻缺少部分欄位資料 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
void update | ( | int | id, |
Tuple | item, | ||
boolean | overwrite | ||
) | throws IOException |
更新一個資料表上的項目。
id | 要被更新的項目。在 appmate 資料庫中多數的物件皆以 id 為主鍵。 |
item | 要更新的資料 |
overwrite | 是否進行完全覆寫 |
IOException | 資料表不存在、網路錯誤,或當 overwrite 為 True 卻缺少部分欄位資料 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
void update | ( | String | primaryKey, |
Tuple | item | ||
) | throws IOException |
更新一個資料表上的項目。 本函式僅更新 item
下帶著的內容。
primaryKey | 要更新的項目的主鍵 |
item | 要更新的資料 |
IOException | 資料表不存在、網路錯誤,或當 overwrite 為 True 卻缺少部分欄位資料 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
void update | ( | int | id, |
Tuple | item | ||
) | throws IOException |
更新一個資料表上的項目。 本函式僅更新 item
下帶著的內容。
id | 要被更新的項目。在 appmate 資料庫中多數的物件皆以 id 為主鍵。 |
item | 要更新的資料 |
IOException | 資料表不存在、網路錯誤,或當 overwrite 為 True 卻缺少部分欄位資料 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
void update | ( | Tuple | item, |
boolean | overwrite | ||
) | throws IOException |
更新一個資料表上的項目。適用於當 item
已經帶有主鍵時。 本函式僅更新 item
下帶著的內容。
item | item to be updated |
overwrite | 是否進行完全覆寫 |
UnsupportedOperationException | item 沒有主鍵 |
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |
void update | ( | Tuple | item | ) | throws IOException |
更新一個資料表上的項目。適用於當 item
已經帶有主鍵時。
item | item to be updated |
UnsupportedOperationException | item 沒有主鍵 |
IOException | 資料表不存在,或網路錯誤 |
NetworkOnMainThreadException | 在主執行緒上使用此函式 |