Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sql 不支持类似于 EXEC [cms].dbo.sp_get_system_image 这样的语句 #394

Closed
qinerg opened this issue Feb 4, 2013 · 6 comments
Closed
Assignees
Milestone

Comments

@qinerg
Copy link
Member

qinerg commented Feb 4, 2013

运行环境:Sql Server 2008
直接上代码:
Dao dao = new NutDao(dataSource);
Sql sql = Sqls.create("EXEC [cms].dbo.sp_get_system_image");
sql.setCallback(Sqls.callback.records());
dao.execute(sql);
List list = sql.getList(Record.class);
System.out.println(list.size());
报警告:
Can't indentify SQL type : EXEC [cms].dbo.sp_get_system_image
list 的 size 为 0

@ghost ghost assigned zozoh Feb 4, 2013
@zozoh
Copy link
Member

zozoh commented Feb 4, 2013

嗯,春节前搞搞

@wendal
Copy link
Member

wendal commented Feb 4, 2013

这是存储过程, 自定义SQL走的是PrepareStat, 不是CallStat的

@zozoh
Copy link
Member

zozoh commented Feb 4, 2013

哦,靠

@zozoh zozoh closed this as completed Feb 4, 2013
@qinerg
Copy link
Member Author

qinerg commented Feb 4, 2013

虽然是存储过程,但对于简单的直接返回结果集的存储过程使用 PreparedStatement 也是可以执行的。
Connection conn = dataSource.getConnection();
PreparedStatement stat = conn.prepareStatement("EXEC [cms].dbo.sp_get_system_image");
ResultSet ret = stat.executeQuery();
while (ret.next()) {
String path = ret.getString("p_path");
System.out.println(path);
}
stat.close();
conn.close();

@wendal
Copy link
Member

wendal commented Feb 4, 2013

哦, 如果是这样的话, 加些log什么的提醒一下, 加上这个支持咯

@wendal wendal reopened this Feb 4, 2013
@ghost ghost assigned wendal Feb 18, 2013
@wendal
Copy link
Member

wendal commented Feb 18, 2013

fixed

@wendal wendal closed this as completed Feb 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants