On Sat, Dec 4, 2010 at 2:52 AM, Frank Church
<vfclists@gmail.com> wrote:
I am looking for a SqueakDBX demo that shows how to display the output of records from the database, like outputting them in a tabular format.
�
Does anyone know of an example somewhere?
HI Frank. All the applications I know are using SqueakDBX but trought GlorpDBX (an ORM). But anyway, I am not sure I undertand your problem. I recommend you to take a look to all the tests in the class DBXQueryTest.
For example, you can do this:
testIterateResultSet
��� | conn result select aRow |
��� conn := self doConnectAndOpen.
��� select := 'SELECT * FROM student'.
��� result := conn execute: select.
��� [ aRow := result nextRow.
"Do something with aRow"
�] doWhileTrue: [ aRow notNil ].
��� self assert: aRow isNil.
��� result releaseResult.
��� conn disconnect
And to DBXRow, you can ask values (accessing by index or by name), descriptions, converting or not so String, etc...
For example, check the class DBXTranscript >> showResultSet: resultSet
showResultSet: resultSet
��� | stream |
��� stream := String new writeStream.
��� resultSet columnDescriptions
��� ��� do: [:each | stream nextPutAll: each name]
��� ��� separatedBy: [stream nextPutAll: ' | '].
��� Transcript show: stream contents;
��� ��� �cr.
��� resultSet
��� ��� rowsDo: [:row |
��� ��� ��� stream := String new writeStream.
��� ��� ��� row values
��� ��� ��� ��� do: [:each | stream nextPutAll: each asDbxString]
��� ��� ��� ��� separatedBy: [stream nextPutAll: ' | '].
��� ��� ��� Transcript show: stream contents;
��� ��� ��� ��� �cr]
What I mean is that since you have reified DBXRow, DBXResultSet, etc...then you can do whatever you want with that.
Cheers
Mariano
�
--
Frank Church
=======================
http://devblog.brahmancreations.com