android content命令

    xiaoxiao2021-04-15  91

    为了方便调试,简单介绍下android串口下如何修改数据库的值。

    第一种方式使用sqlite3命令: 1、首先进入sqlite3命令模式: **shell@ubuntu:/Database # sqlite3 user_setting.db SQLite version 3.7.11 2012-03-20 11:35:50 Enter “.help” for instructions Enter SQL statements terminated with a “;” sqlite>** 简单几点说明: 可以输入.help查看命令帮助说明 常用的命令,查看有哪些数据表:.tables; 退出sqlite3命令模式:.quit 如果要删除字符,需要使用Ctrl + Backspace。 2、查看某个表的值: 查看所有列:select * from tbl_SystemSetting; (注意要有分号 ; ) 输出结果: *sqlite> select from tbl_SystemSetting; 0|0|0|0|0|2|50|0|0|0|26|0|0|0|4|0|1|0|0|0|3|5000|0|1|0|8|0|0|0|2|0|0|1|0|0|1|4|0|0|0|0|0|0|0|3|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0|65535|0|1|4|0|1|1|1|1|1|1|0|100|50|1|1** 查看单独某一列的值,具体列的名称需要去查对应的sql文件:select enInputSourceType from tbl_SystemSetting; 输出结果: sqlite> select enInputSourceType from tbl_SystemSetting; 2 3、更新某个字段值: update tbl_SystemSetting set enInputSourceType=1; 输出结果: **sqlite> update tbl_SystemSetting set enInputSourceType=1; sqlite> select enInputSourceType from tbl_SystemSetting; 1**


    第二种方式使用content命令,这种方式比较“美观” shell下输入 content,会输出一下用法信息 *usage: adb shell content [subcommand] [options] usage: adb shell content insert –uri [–user ] –bind [–bind …] a content provider URI. binds a typed value to a column and is formatted: :: where: specifies data type such as: b - boolean, s - string, i - integer, l - long, f - float, d - double Note: Omit the value for passing an empty string, e.g column:s: Example: Add “new_setting” secure setting with value “new_value”. adb shell content insert –uri content://settings/secure –bind name:s:new_setting –bind value:s:new_value usage: adb shell content update –uri [–user ] [–where ] is a SQL style where clause in quotes (You have to escape single quotes - see example below). Example: Change “new_setting” secure setting to “newer_value”. adb shell content update –uri content://settings/secure –bind value:s:newer_value –where “name=’new_setting’” usage: adb shell content delete –uri [–user ] –bind [–bind …] [–where ] Example: Remove “new_setting” secure setting. adb shell content delete –uri content://settings/secure –where “name=’new_setting’” usage: adb shell content query –uri [–user ] [–projection ] [–where ] [–sort ] is a list of colon separated column names and is formatted: [:…] is the order in which rows in the result should be sorted. Example: Select “name” and “value” columns from secure settings where “name” is equal to “new_setting” and sort the result by name in ascending order. adb shell content query –uri content://settings/secure –projection name:value –where “name=’new_setting’” –sort “name ASC” usage: adb shell content call –uri –method [–arg ] [–extra …] is the name of a provider-defined method is an optional string argument is like –bind above, typed data of the form :{b,s,i,l,f,d}: 1、查询 命令行输入:content query –uri content://abcd.tv.usersetting/systemsetting 输出结果: Row: 0 _id=0, fRunInstallationGuide=0, fNoChannel=0, bDisableSiAutoUpdate=0, bDisableDynamicRescan=0, enInputSourceType=1, Country=50, enCableOperators=0, enSatellitePlatform=0, u16NetworkId=0, Language=26, en3DARC=0, enSPDIFMODE=0, fSoftwareUpdate=0, U8OADTime=4, fOADScanAfterWakeup=0, fAutoVolume=1, fDcPowerOFFMode=0, DtvRoute=0, ScartOutRGB=0, U8Transparency=3, u32MenuTimeOut=5000, AudioOnly=0, bEnableWDT=1, u8FavoriteRegion=0, u8Bandwidth=8, u8TimeShiftSizeType=0, fOadScan=0, bEnablePVRRecordAll=0, u8ColorRangeMode=2, u8HDMIAudioSource=0, bEnableAlwaysTimeshift=0, eSUPER=1, bUartBus=0, m_AutoZoom=0, bOverScan=1, m_u8BrazilVideoStandardType=4, m_u8SoftwareUpdateMode=0, OSD_Active_Time=0, m_MessageBoxExist=0, u16LastOADVersion=0, bEnableAutoChannelUpdate=0, u32PvrSettingId=0, enForcedInputSourceType=0, enLocalDimm=3, bATVChSwitchFreeze=1, bSourceDetectEnable=1, bAutoSourceSwitch=0, u32MsrvTimerCounter=0, standbyNoOperation=0, standbyNoSignal=0, screenSaveMode=0, bAutoMHLSwitch=0, bViewerPrompt=0, u8OpMode=0, u32CicamIdentifier=0, bEnableHbbtv=0, bWOLEnable=0, u32StrPowerMode=0, bEnableACR=0, bSourcePreview=0, bMonitorITC=0, bxvYCCOnOff=0, bEnableStoreCookies=1, bServiceListNeedRearrange=0, bCiOccupiedTuner=0, u16CiPinCode=65535, u16HdmidEdidVersion=0, enMemoryInputSource=1, TTX_Language=4, bBlueScreenMode=0, bMainAutoDetectHdrLevel=1, bSubAutoDetectHdrLevel=1, u8MainHdrLevel=1, u8SubHdrLevel=1, bMainHdrOn=1, bSubHdrOn=1, bDCRStatus=0, bDCRBacklightMAX=100, bDCRBacklightRange=50, bDCRBacklightStep=1, bDCRStepTime=1*

    查询某一列,即某个字段的值:content query –uri content://abcd.tv.usersetting/systemsetting –projection enInputSourceType 输出结果: Row: 0 enInputSourceType=1

    2、更新某个字段数据值 比如我要更新enInputSourceType为2,它的数据类型为int,那么命令如下: content update –uri content://abcd.tv.usersetting/systemsetting –bind enInputSourceType:i:2 //用冒号分隔第一部分为字段名称,第二部分为字段类型,第三部分为最终要写入的值 比较常用的应该就是查询以及删除,具体要了解代码如何实现,可以去看 android/frameworks/base/cmds/content/src/com/android/commands/content/Content.java

    转载请注明原文地址: https://ju.6miu.com/read-671523.html

    最新回复(0)