NameError("name '__pydevd_ret_val_dict' is not defined")
时间: 2023-09-30 12:12:03 浏览: 217
This error message suggests that the Python interpreter is unable to find the variable or function "__pydevd_ret_val_dict" in the current scope. This could be due to a number of reasons, such as a typo in the variable/function name, or the variable/function not being defined yet.
It's possible that this error is related to a debugging tool or library that you're using, as "__pydevd" suggests that it may be related to PyDev, a Python IDE. If that's the case, you may need to check the documentation for the tool to see how to properly use the missing variable or function.
Without more context or code, it's difficult to provide a more specific solution.
相关问题
请用power_supply_get_by_name(ddata->dev)的方法对以下函数进行改写:static int set_charger_type(void) { int ret; static int old_type_en = 0; union power_supply_propval val; struct power_supply *psy = power_supply_get_by_name("bbc"); if (psy == NULL) { pr_info("power_supply_get_by_name error.\n"); return -1; } val.intval = chr_type_en; pr_info("set_charger_type: %d.\n", val.intval); if (val.intval) { if (!old_type_en) { ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); old_type_en = 1; } power_supply_changed(psy); val.intval = POWER_SUPPLY_TYPE_WIRELESS; ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_TYPE, &val); if (!ret) { return val.intval; } else { return 0; } } else { val.intval = POWER_SUPPLY_TYPE_USB; ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_TYPE, &val); if (ret < 0) pr_info("set chg psy failed\n"); power_supply_changed(psy); old_type_en = 0; } return 0; }
static int set_charger_type(void) {
int ret;
static int old_type_en = 0;
union power_supply_propval val;
struct power_supply *psy = power_supply_get_by_name("bbc");
if (!psy) {
pr_info("power_supply_get_by_name error.\n");
return -1;
}
val.intval = chr_type_en;
pr_info("set_charger_type: %d.\n", val.intval);
if (val.intval) {
if (!old_type_en) {
ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_ONLINE, &val);
old_type_en = 1;
}
power_supply_changed(psy);
val.intval = POWER_SUPPLY_TYPE_WIRELESS;
ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_TYPE, &val);
if (ret < 0) {
pr_info("set chg psy failed\n");
return 0;
}
return val.intval;
} else {
val.intval = POWER_SUPPLY_TYPE_USB;
ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_TYPE, &val);
if (ret < 0) {
pr_info("set chg psy failed\n");
}
power_supply_changed(psy);
old_type_en = 0;
}
return 0;
}
delimiter // CREATE FUNCTION DBROAM.GET_FORMVALUE ( str in varchar2 ) return number is cursor_name integer; ret integer; val number(12,4); begin val := -1; begin cursor_name := dbms_sql.open_cursor; dbms_sql.parse(cursor_name, 'select '||str||' from dual', dbms_sql.v7); dbms_sql.define_column (cursor_name, 1, val); ret := dbms_sql.execute(cursor_name); if dbms_sql.fetch_rows (cursor_name)<>0 then dbms_sql.column_value (cursor_name, 1, val); end if; dbms_sql.close_cursor(cursor_name); exception when others then dbms_sql.close_cursor(cursor_name); end; return val; end; // delimiter ;改写成mysql可以运行的
好的,根据你提供的Oracle函数代码,我将其转换为MySQL函数代码如下:
```
delimiter //
CREATE FUNCTION GET_FORMVALUE (str VARCHAR(100)) RETURNS DECIMAL(12,4)
BEGIN
DECLARE cursor_name INTEGER;
DECLARE ret INTEGER;
DECLARE val DECIMAL(12,4);
SET val = -1;
SET cursor_name = 0;
SET ret = 0;
BEGIN
SET cursor_name = (SELECT @@session.pseudo_thread_id);
PREPARE my_query FROM CONCAT('SELECT ', str, ' FROM dual');
EXECUTE my_query;
DEALLOCATE PREPARE my_query;
IF cursor_name > 0 THEN
SET ret = 1;
END IF;
IF ret = 1 THEN
FETCH cursor_name INTO val;
END IF;
CLOSE cursor_name;
END;
RETURN val;
END;//
delimiter ;
```
请注意,MySQL中不存在`dbms_sql`包,所以我使用了动态SQL来编写查询语句。此外,由于MySQL不支持`%TYPE`语法,因此我将返回值类型设置为DECIMAL(12,4)。如果你需要返回不同的数据类型,可以根据需要进行更改。
阅读全文
相关推荐














