On Apr 2, 2014, at 1:46 PM, James Berry <[email protected]> wrote: > > On Apr 2, 2014, at 1:26 PM, Donald Steele <[email protected]> wrote: > >> What I’m talking about that is part of Xcode is the SQLite framework not >> APIs. The access to SQLite is done with the Obj C APIs as defined by SQLite. >> I am a fairly new developer and may be having some problems keeping up with >> folks with more time. So if I’m using incorrect terms that is my excuse. >> >> If was more experienced the documentation on SQLite’s web site would make >> more sense and I would not be here asking dumb questions. > > Ok, so I’ll try to give you a hand… > > First off, there are no Obj-C APIs for SQLite built into iOS. It sounds like > you are calling the C APIs. Also, SQLite is not bundled into iOS as a > Framework (which suggests Obj-C APIs), but as a library. The differences may > be subtle, but calling them the wrong things is confusing to those who > understand the differences. > > I think we’ve established that you’d like to use a natural sort algorithm to > order your results. We have told you the function you need to use to register > this (sqlite3_create_collation), and given you some pointers to where you > might find such a function, in plain C. You might also be able to do compares > with NSString using the NSNumericSearch option. But in any event, you’ll have > to write and register a collation function. We’ve also shown examples of how > you would invoke the collation from your SQL. > > There are two holes that I see: > > (1) Nobody has written a collocation function for you. > (2) I have a hint that you’re a little confused at the parameters that > should be passed to sqlite3_create_collation, perhaps. > > The documentation of the collation callback could be improved, I believe. > Exactly what the parameters are isn’t well documented that I can see. I > believe they are: (1) the application data pointer, (2) the length of string > “a" (in bytes or characters?), (3) the pointer to string “a”, (4) the length > of string “b”, (5) the pointer to string “b”. Again, those parameters aren’t > clearly specified in the SQLite docs, and I haven’t gone looking for example > code, or the sources, but I assume those are the answers. One question that > remains for me is whether the string parameters (3 and 5) would be > null-terminated if they’re UTF-8, for instance. > > Given a collation callback, then: > > int naturalStringCompare(void* appdata, int lenA, const void* strA, int > lenB, const void* strB) > { > /* logic to compare strA and strB here... */ > return result; > } > > you would register this using: > > sqlite3_create_collation(sqlite3, “naturalSortOrder”, SQLITE_UTF8, nil, > naturalStringCompare); > > Do you have explicit questions about that?
I have a lot of questions but they are questions that are a result of being as new as I am. It’s apparent to me that this is a forum for folks a lot more experienced than I. First thanks for the clarification on framework vs Library. Second I must admit I truly thought I was using Obj C APIs. You have provided a lot of helpful information and from here I’ll continue to read and learn. I really didn’t want anyone to do my work for me I was just looking for guidance and clarification and only managed to confuse those here and get back confusing answers. Thanks for your help & I’ll only come back when I’m better prepared and can ask better questions. > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

