Android sqlite query

SQLiteDatabase db = dbhelper.getWritableDatabase();
        
        String table =  Player.TABLE_NAME ;
        String[] columns = new  String[] { Player.KEY_USER_PASS };
        String selection = Player.KEY_USER_NAME+"=?" ;
        String[] selectionArgs = new  String[]{username};
        String groupBy = "" ;
        String having = "" ;
        String orderBy = "" ;
        
        Player player = new Player();
        Cursor cursor = db.query(table,columns,selection,selectionArgs,groupBy,having,orderBy);
        player.setPlayer_id(cursor.getInt(cursor.getColumnIndex(Player.KEY_ID)));
        player.setUser_name(cursor.getString(cursor.getColumnIndex(Player.KEY_USER_NAME)));
        player.setUser_pass(cursor.getString(cursor.getColumnIndex(Player.KEY_USER_PASS)));
        return player;
上一篇:强制数据分布与导出prefix - 阿里云pg, hdb pg oss快速数据规整外部表导出实践案例


下一篇:SQLite If Else Case 实现