GreenDao 直接执行SQL的方法

try
                {
                    DaoSession session=MyApplication.getInstances().getDaoSession();
                    long fromId=-1;
                    String strSql="select * from test order by ID desc limit 0,1 ";
                    Cursor c  = session.getDatabase().rawQuery(strSql,null);
                    if(c.moveToFirst())
                    {
                        fromId=c.getLong(c.getColumnIndex("ID"));

                    }
                    c.close();
                }
                catch (Exception ex)
                {
                    showToast(ex.getMessage());
                }

 

posted @ 2018-10-12 13:40  zhaogaojian  阅读(5961)  评论(0编辑  收藏  举报