I attempted to copy Avi Bryants squeak version of the Sqlite library... And
I can execute queries against the database, but I can't return query results... He does some stuff with ResultBuffer structure that I can't get working, so it doesn't return any results to the calling code (Queries which don't return results are fine though).. Can I post the package here, and can anyone point me in the next direction to take to get it working? Regards, Sean |
"Sean Malloy" <[hidden email]> wrote in message
news:4090d0e4$[hidden email]... > I attempted to copy Avi Bryants squeak version of the Sqlite library... And > I can execute queries against the database, but I can't return query > results... He does some stuff with ResultBuffer structure that I can't get > working, so it doesn't return any results to the calling code (Queries which > don't return results are fine though).. > > Can I post the package here, and can anyone point me in the next direction > to take to get it working? You can try making it available, and maybe someone will be able to offer assistance. I would suggest placing it on a website and including a link in your posting since some news servers do not permit attachments in non-binary groups. I think people will tend to not want to commit to looking at a package until they actually look at it (if you know what I mean). Post the code and maybe someone will look at it and be able to offer advice. Chris |
> You can try making it available, and maybe someone will be able to offer
> assistance. I would suggest placing it on a website and including a link in > your posting since some news servers do not permit attachments in non-binary > groups. I think people will tend to not want to commit to looking at a > package until they actually look at it (if you know what I mean). Post the > code and maybe someone will look at it and be able to offer advice. Yeah I should have done that.. http://www.arcturus.com.au/Sqlite_Dolphin.zip Included is the Dolphin package and the Squeak version (which I based the code on). I didn't include the DLL. That can be downloaded from: http://www.sqlite.org/sqlitedll.zip I don't even want anyone to finish it.. Just tell me the "why" it isn't working, and point me in the right direction (alternate methods) to call which basically do the same thing as the squeak calls.. I have been browsing through dolphin classes to try and find equivalent methods, I'm in the dark when it comes to interfacing with external libraries. I need a torch. |
In reply to this post by Christopher J. Demers
> You can try making it available, and maybe someone will be able to offer
> assistance. I would suggest placing it on a website and including a link in > your posting since some news servers do not permit attachments in non-binary > groups. I think people will tend to not want to commit to looking at a > package until they actually look at it (if you know what I mean). Post the > code and maybe someone will look at it and be able to offer advice. Apologies if this post turns up twice. I posted the first time and it never turned up on the server. Yeah I should have done that.. http://www.arcturus.com.au/Sqlite_Dolphin.zip Included is the Dolphin package and the Squeak version (which I based the code on). I didn't include the DLL. That can be downloaded from: http://www.sqlite.org/sqlitedll.zip I don't even really want anyone to finish it (although if you do I don't really care).. I just want someone to point me in the right direction (alternate methods) to call which basically do the same thing as the squeak calls.. I have been browsing through dolphin classes to try and find equivalent methods, I'm in the dark when it comes to interfacing with external libraries. I need a torch. |
In reply to this post by Christopher J. Demers
I can tell one of the problems is with my implementation of defineFields.
Two of the external structures have the method define, and squeak must just build up a generic structure. Dolphin is more complex. Definiging the fields to custom structures involves method calls like; beFiller, beUncompiled, offset. and so on. How can I tell when a structure field needs these additional details, and when they don't? "Christopher J. Demers" <[hidden email]> wrote in message news:c6rnie$fkdp4$[hidden email]... > "Sean Malloy" <[hidden email]> wrote in message > news:4090d0e4$[hidden email]... > > I attempted to copy Avi Bryants squeak version of the Sqlite library... > And > > I can execute queries against the database, but I can't return query > > results... He does some stuff with ResultBuffer structure that I can't get > > working, so it doesn't return any results to the calling code (Queries > which > > don't return results are fine though).. > > > > Can I post the package here, and can anyone point me in the next direction > > to take to get it working? > > You can try making it available, and maybe someone will be able to offer > assistance. I would suggest placing it on a website and including a link in > your posting since some news servers do not permit attachments in non-binary > groups. I think people will tend to not want to commit to looking at a > package until they actually look at it (if you know what I mean). Post the > code and maybe someone will look at it and be able to offer advice. > > Chris > > |
Sean Malloy wrote:
> beFiller, beUncompiled, offset. and so on. > > How can I tell when a structure field needs these additional details, and > when they don't? Typically they don't. When they do, it's because you know that the elements of the structure aren't layed out in the positions that a modern MS 'C' compiler would put them by default if it were compiling an equivalent 'struct'. BTW, I took a quick look at the link you posted. Unfortunately I can't understand what's going on because I don't know anything about how Squeak's external interfacing works. However, I also looked at the sqllite website and, as far as I can see, there's no need to define external structures at all (though you may prefer to anyway). The API appears to work in terms of void*, char*, and char** (and a few ints and whatnot) which you should be able to work with "directly". I also noticed that their main API is based on a callback function. That API didn't appear to be exposed in the Squeak wrapper. I don't know if that is because Squeak can't easily do callbacks (I'm not saying it can't, I just don't know). If so, and if there is any need for it, Dolphin can define such callbacks rather conveniently. -- chris |
"Chris Uppal" <[hidden email]> wrote in message news:<[hidden email]>...
> I also noticed that their main API is based on a callback function. That API > didn't appear to be exposed in the Squeak wrapper. I don't know if that is > because Squeak can't easily do callbacks (I'm not saying it can't, I just don't > know). Yes, that's why. If Dolphin can do callbacks easily, there's probably not much point in porting the Squeak wrapper - just write a callback-based one from scratch. |
"Avi Bryant" <[hidden email]> wrote in message
news:[hidden email]... > "Chris Uppal" <[hidden email]> wrote in message news:<[hidden email]>... > > > I also noticed that their main API is based on a callback function. That API > > didn't appear to be exposed in the Squeak wrapper. I don't know if that is > > because Squeak can't easily do callbacks (I'm not saying it can't, I just don't > > know). > > Yes, that's why. If Dolphin can do callbacks easily, there's probably > not much point in porting the Squeak wrapper - just write a > callback-based one from scratch. As Chris says, callbacks are trivial in Dolphin. Here is an example from the image: Canvas>>fonts: aString do: operation | callback answer | callback := ExternalCallback block: [:lplf :lptm :dwType :lpData | operation value: lplf value: lptm value: dwType] argumentTypes: 'LOGFONT* lpvoid dword dword'. answer := GDILibrary default enumFonts: self asParameter lpFaceName: aString lpFontFunc: callback asParameter lParam: 0. callback free. ^answer This example directs callbacks from Windows API EnumFonts() into a block. Two minor points worth noting are that we normally "precompile" the argument type descriptor to avoid the cost of parsing it, and the 'callback free' is not entirely necesary since the callback will be free'd correctly by finalization anyway. Oh, and the callbacks can be debugged as normal code, and any number of callbacks can be active at any one time in different processes, or nested within the same process. The basic mechanism is fundamental to the operation of the entire Dolphin image (Dolphin is truly event driven off the Windows message queue with the messages dispatched from there resulting in callbacks into the image - Dolphin does not dequeue Windows messages into its own internal queues in the VM or image), so it can be assumed to work reliably. Regards Blair |
Free forum by Nabble | Edit this page |