編輯:關於android開發
- CREATE TABLE json_test(
- id INT,
- person_desc TEXT
- )ENGINE INNODB;
- INSERT INTO json_test VALUES (1,'{
- "programmers": [{
- "firstName": "Brett",
- "lastName": "McLaughlin",
- "email": "aaaa"
- }, {
- "firstName": "Jason",
- "lastName": "Hunter",
- "email": "bbbb"
- }, {
- "firstName": "Elliotte",
- "lastName": "Harold",
- "email": "cccc"
- }],
- "authors": [{
- "firstName": "Isaac",
- "lastName": "Asimov",
- "genre": "sciencefiction"
- }, {
- "firstName": "Tad",
- "lastName": "Williams",
- "genre": "fantasy"
- }, {
- "firstName": "Frank",
- "lastName": "Peretti",
- "genre": "christianfiction"
- }],
- "musicians": [{
- "firstName": "Eric",
- "lastName": "Clapton",
- "instrument": "guitar"
- }, {
- "firstName": "Sergei",
- "lastName": "Rachmaninoff",
- "instrument": "piano"
- }]
- }');
- ALTER TABLE json_test MODIFY person_desc json;
- mysql> SELECT id,json_keys(person_desc) as "keys" FROM json_test\G
- *************************** 1. row ***************************
- id: 1
- keys: ["authors", "musicians", "programmers"]
- 1 row in set (0.00 sec)
- mysql> SELECT json_extract(AUTHORS,'$.lastName[0]') AS 'name', AUTHORS FROM
- -> (
- -> SELECT id,json_extract(person_desc,'$.authors[0][0]') AS "authors" FROM json_test
- -> UNION ALL
- -> SELECT id,json_extract(person_desc,'$.authors[1][0]') AS "authors" FROM json_test
- -> UNION ALL
- -> SELECT id,json_extract(person_desc,'$.authors[2][0]') AS "authors" FROM json_test
- -> ) AS T1
- -> ORDER BY NAME DESC\G
- *************************** 1. row ***************************
- name: "Williams"
- AUTHORS: {"genre": "fantasy", "lastName": "Williams", "firstName": "Tad"}
- *************************** 2. row ***************************
- name: "Peretti"
- AUTHORS: {"genre": "christianfiction", "lastName": "Peretti", "firstName": "Frank"}
- *************************** 3. row ***************************
- name: "Asimov"
- AUTHORS: {"genre": "sciencefiction", "lastName": "Asimov", "firstName": "Isaac"}
- 3 rows in set (0.00 sec)
- mysql> SELECT
- -> json_extract(AUTHORS,'$.firstName[0]') AS "firstname",
- -> json_extract(AUTHORS,'$.lastName[0]') AS "lastname",
- -> json_extract(AUTHORS,'$.genre[0]') AS "genre"
- -> FROM
- -> (
- -> SELECT id,json_extract(person_desc,'$.authors[0]') AS "authors" FROM json
- _test
- -> ) AS T\G
- *************************** 1. row ***************************
- firstname: "Isaac"
- lastname: "Asimov"
- genre: "sciencefiction"
- 1 row in set (0.00 sec)
- mysql> UPDATE json_test
- -> SET person_desc = json_remove(person_desc,'$.authors')\G
- Query OK, 1 row affected (0.01 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- mysql> SELECT json_contains_path(person_desc,'all','$.authors') as authors_exist
- s FROM json_test\G
- *************************** 1. row ***************************
- authors_exists: 0
- 1 row in set (0.00 sec)
利用RecyclerView CardView實現新聞卡片樣式, 引入的包: demo結構: 測試代碼: News.java
android 官方DrawerLayout的介紹和使用,androiddrawerlayout南塵:愛編程,愛安卓,每天進步一點點。 drawerLayout是Supp
Android幾種常見的多渠道(批量)打包方式介紹 多渠道打包,主要是為了統計不同的渠道上包的下載數量,渠道越多,我們需要打的包數量越多,這個時候,我們沒法去使用單純
Activity詳解二 activity數據傳遞,activity詳解首先看效果圖: 1.Bundle類的作用 Bundle類用作攜帶數據,它類似於M