简体   繁体   English

从Mybatis / Ibatis运行DBCC命令

[英]Running DBCC commands from Mybatis / Ibatis

I am trying to call a Sql Server DBCC command from mybatis and am getting back a list of the result names but not the values. 我试图从mybatis调用Sql Server DBCC命令,并返回结果名称列表,而不是值列表。

@select("dbcc useroptions")
List dbccUserOptions();

Returns only a list of the option names. 仅返回选项名称的列表。 Any ideas how to get the values? 任何想法如何获得价值?

Try this: 尝试这个:

@Select("dbcc useroptions")
@MapKey("Set Option")
Map<String, String> dbccUserOptions();

After some experimentation I discovered this works: 经过一番实验,我发现这可行:

@select("dbcc useroptions")
List<Map> dbccUserOptions();

It turns out that Mybatis is inspecting the return type and if it is a list of scalars it will only return the first item. 事实证明Mybatis正在检查返回类型,如果它是标量列表,则只会返回第一项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM