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

Dao自定义SQL,ResultSet为空 #492

Closed
enzozhong opened this issue Jul 22, 2013 · 4 comments
Closed

Dao自定义SQL,ResultSet为空 #492

enzozhong opened this issue Jul 22, 2013 · 4 comments
Milestone

Comments

@enzozhong
Copy link
Contributor

Sql sql = Sqls.create ( "SHOW TABLES" );
sql.setCallback ( new SqlCallback ()
{

        @Override
        public Object invoke ( Connection conn , ResultSet rs , Sql sql )
            throws SQLException
        {

            System.out.println ( rs );rs = null


            return rs;
        }

    } );
    dao.execute ( sql );

不知道问题出在哪里,用原生的就没有任何问题
PreparedStatement ps = conn.prepareStatement ( sql.toPreparedStatement () );
rs = ps.executeQuery ();

            while ( rs.next () )
            {
                System.out.println ( rs.getObject ( 1 ) );
            }
@wendal
Copy link
Member

wendal commented Jul 22, 2013

只有select语句有ResultSet

@enzozhong
Copy link
Contributor Author

因为查询的语句是SHOW TABLES,但是ResultSet死活是null,最后只能用原生来
PreparedStatement ps = conn.prepareStatement ( sql.toPreparedStatement () );
ResultSet rs = ps.executeQuery ();

while ( rs.next () )
{
System.out.println ( rs.getObject ( 1 ) );
}
这样才能获取返回值,
dao的自定义sql应该是把所有的sql执行并且把反馈值返回来,或者至少返回一个ResultSet

@zozoh
Copy link
Member

zozoh commented Sep 3, 2013

.... 怎样加个开关呢? 还是不支持?

@zozoh zozoh modified the milestones: 1.b.51, 1.b.50 Apr 12, 2014
@enzozhong
Copy link
Contributor Author

如果拿不准,不如现在doc上面注明一下,我也感觉不是什么大问题,只是不知道的人会郁闷那么一会

@zozoh zozoh modified the milestones: 1.b.51, 1.b.52 Oct 12, 2014
@wendal wendal closed this as completed in 06d1354 Feb 10, 2015
@wendal wendal added the 需求 label Feb 10, 2015
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