FMDBResultSet is sorted when returned

43 views
Skip to first unread message

Moksh Khurana

unread,
Apr 8, 2013, 4:15:26 PM4/8/13
to fm...@googlegroups.com
While issuing a simple query:

SELECT * FROM contactgroups where group_id = '5321FD46-7D60-435F-BAB5-C532AAF0354D'

This returns me the following when I do [[rs resultDict] description]

Printing description of $25:

{

    createdate = 1365451062;

    createdby = Smith;

    description = "here is my description";

    effectivefrom = 0;

    effectiveto = 0;

    "group_admin" = 9876;

    "group_email" = "em...@domain.com";

    "group_id" = "5321FD46-7D60-435F-BAB5-C532AAF0354D";

    "group_owner" = 6789;

    "group_type" = user;

    isclosed = 0;

    isprivate = 0;

    lastupdate = 1365451062;

    markedfordelete = 0;

    name = John;

    searchable = 1;

    updatedby = John;

    "user_id" = 12345;

}


But in the database my columns are set differently. They are in this order for table contactgroup:


group_id, user_id, name, description, isprivate, group_email, searchable, group_type, isclosed, group_owner, group_admin, lastUpdate, updatedby, createdBy, createDate, markedfordelete, effectivefrom, effectiveto.


So the question is, how can I get FMResultSet to return the row in the order of the columns as defined in the DB?

Gus Mueller

unread,
Apr 8, 2013, 4:27:37 PM4/8/13
to fm...@googlegroups.com

On Apr 8, 2013, at 1:15 PM, Moksh Khurana <moksh....@gmail.com> wrote:

> While issuing a simple query:
>
> SELECT * FROM contactgroups where group_id = '
> 5321FD46-7D60-435F-BAB5-C532AAF0354D'
>
> This returns me the following when I do [[rs resultDict] description]
<snip>

> But in the database my columns are set differently. They are in this order
> for table contact group:
<snip>
> So the question is, how can I get FMResultSet to return the row in the

NSDictionary orders the keys when you print them out. FMDB doesn't change the ordering anywhere, as you can find when you use stringForColumnIndex: and friends.

Hope that helps,

-gus


--

August 'Gus' Mueller
Flying Meat Inc.
http://flyingmeat.com/

Moksh Khurana

unread,
Apr 11, 2013, 1:10:47 PM4/11/13
to fm...@googlegroups.com
Thanks for the help Gus!
Reply all
Reply to author
Forward
0 new messages