Commit aa37f5da authored by chen.weican's avatar chen.weican

【修改内容】设备属性数据表添加设备类型字段

【提交人】陈伟灿
parent 2a977c46
......@@ -148,7 +148,7 @@ static int _dm_init_tsl_params(int devId)
}
return res;
}
int dm_mgr_properities_db_create(kk_tsl_t* dev_shadow,char *deviceCode )
int dm_mgr_properities_db_create(kk_tsl_t* dev_shadow,char *deviceCode,int devType )
{
int num = 0,idx = 0;
kk_tsl_data_t *pProperty = NULL;
......@@ -163,7 +163,7 @@ int dm_mgr_properities_db_create(kk_tsl_t* dev_shadow,char *deviceCode )
pProperty = dev_shadow->properties+idx;
INFO_PRINT("dm_mgr_properities_db_create pProperty->identifier:%s!!\n",pProperty->identifier);
if(pProperty){
kk_property_db_insert(deviceCode,pProperty->identifier,pProperty->data_value.type);
kk_property_db_insert(deviceCode,pProperty->identifier,pProperty->data_value.type,devType);
}
}
}
......@@ -224,7 +224,7 @@ int dm_mgr_device_create(_IN_ int dev_type,_IN_ char productCode[PRODUCT_CODE_MA
return FAIL_RETURN;
}
}
dm_mgr_properities_db_create(node->dev_shadow,deviceCode);
dm_mgr_properities_db_create(node->dev_shadow,deviceCode,dev_type);
INIT_LIST_HEAD(&node->linked_list);
list_add_tail(&node->linked_list, &ctx->dev_list);
......
......@@ -18,6 +18,7 @@ typedef enum{
DB_IDENTIFITER,
DB_VALUE,
DB_VALUETYPE,
DB_DEVTYPE
};
static kk_property_db_ctx_t s_kk_property_db_ctx = {0};
......@@ -60,7 +61,8 @@ static int kk_property_db_Init(void)
deviceCode varchar(33), \
identifier varchar(33), \
value varchar(33), \
valueType INTEGER)";
valueType INTEGER, \
devType INTEGER)";
char *pcErr;
// DBG_vPrintf(DBG_SQL, "Execute SQL: '%s'\n", pConditionTableDef);
......@@ -129,10 +131,10 @@ static int _kk_check_property_exist(const char* deviceCode,const char* identifie
}
int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_data_type_e valuetype)
int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_data_type_e valuetype,int devtype)
{
const char *insertCmd = "insert into PropertiesInfo (deviceCode,identifier,value,valueType) \
values ('%s','%s','%s','%d');";
const char *insertCmd = "insert into PropertiesInfo (deviceCode,identifier,value,valueType,devType) \
values ('%s','%s','%s','%d','%d');";
char *sqlCmd = NULL;
int rc = 0;
char *zErrMsg = 0;
......@@ -145,7 +147,7 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
return SUCCESS_RETURN;
}
_kk_property_db_lock();
sqlCmd = sqlite3_mprintf(insertCmd,deviceCode,identifier,"",valuetype);
sqlCmd = sqlite3_mprintf(insertCmd,deviceCode,identifier,"",valuetype,devtype);
rc = sqlite3_exec(ctx->pDb, sqlCmd, NULL, NULL, &zErrMsg);
if( rc != SQLITE_OK ){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment