Re: [Gambas-user] For Each ?WHAT? in Result
Thank thee ... :-) I did follow that path and I did miss the nuance of the second example. On 01/10/2015 03:04 AM, Caveat wrote: I presume you started here http://gambaswiki.org/wiki/comp/gb.db/result And then clicked on the big obvious link to FOR EACH, arriving here: http://gambaswiki.org/wiki/lang/foreach And then didn't look at the second example... :-P Kind regards, Caveat On 10/01/15 09:52, Lewis Balentine wrote: Result (gb.db) This class represents the result of a SQL request. This class is not creatable. This class acts like a read / write array. This class is *enumerable* with the FOR EACH keyword. Guess this should be obvious but not to me pray tell what type/class does one use to enumerate it ?? I tried ResultField[] I tried Collection I tried to try record As a last resort I tried String[] Suffice it to say: I have not a clue :-\ Dim MyResult as Result Dim MyRecord as ? Result = Connection.Find (Something) For Each MyRecord in MyResult Print MyRecord[Field1Name] Print MyRecord[Field2Name] Print MyRecord[Field3Name] Next regards, Lewis -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] For Each ?WHAT? in Result
I presume you started here http://gambaswiki.org/wiki/comp/gb.db/result And then clicked on the big obvious link to FOR EACH, arriving here: http://gambaswiki.org/wiki/lang/foreach And then didn't look at the second example... :-P Kind regards, Caveat On 10/01/15 09:52, Lewis Balentine wrote: Result (gb.db) This class represents the result of a SQL request. This class is not creatable. This class acts like a read / write array. This class is *enumerable* with the FOR EACH keyword. Guess this should be obvious but not to me pray tell what type/class does one use to enumerate it ?? I tried ResultField[] I tried Collection I tried to try record As a last resort I tried String[] Suffice it to say: I have not a clue :-\ Dim MyResult as Result Dim MyRecord as ? Result = Connection.Find (Something) For Each MyRecord in MyResult Print MyRecord[Field1Name] Print MyRecord[Field2Name] Print MyRecord[Field3Name] Next regards, Lewis -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] For Each ?WHAT? in Result
But the documentation arrived at by following the enumerable link doesn't give a fully working code example, and also doesn't document whether the order of the enumeration is predictable, which we'd better hope it is if you ever decide to use an order by clause :-D I'll see if have time to sign up and edit the page later, unless someone else can already take care of this? Thanks and kind regards Caveat On 10/01/15 11:59, Tobias Boege wrote: On Sat, 10 Jan 2015, Lewis Balentine wrote: On 01/10/2015 03:04 AM, Caveat wrote: On 10/01/15 09:52, Lewis Balentine wrote: Result (gb.db) This class represents the result of a SQL request. This class is not creatable. This class acts like a read / write array. This class is *enumerable* with the FOR EACH keyword. Guess this should be obvious but not to me pray tell what type/class does one use to enumerate it ?? I tried ResultField[] I tried Collection I tried to try record As a last resort I tried String[] Suffice it to say: I have not a clue :-\ Dim MyResult as Result Dim MyRecord as ? Result = Connection.Find (Something) For Each MyRecord in MyResult Print MyRecord[Field1Name] Print MyRecord[Field2Name] Print MyRecord[Field3Name] Next regards, Lewis I presume you started here http://gambaswiki.org/wiki/comp/gb.db/result And then clicked on the big obvious link to FOR EACH, arriving here: http://gambaswiki.org/wiki/lang/foreach And then didn't look at the second example... :-P Kind regards, Caveat Thank thee ... :-) I did follow that path and I did miss the nuance of the second example. Better yet, don't click on the FOR EACH link but on the enumerable link. This brings you to the Result-specific documentation for enumeration. You want to remember this because not every class is mentioned in the FOR EACH language documentation. As you see, Result has a different way of being enumerated. Instead of returning the objects in the result, a new iteration moves an internal cursor through the rows of the result data. This means, each execution of the loop body For Each hResult Print hResult!onefield Next will yield a different print (unless some rows contain the same value, of course). Regards, Tobi -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] For Each ?WHAT? in Result
I does work as expected with the order by clause. On 01/10/2015 06:16 AM, Caveat wrote: But the documentation arrived at by following the enumerable link doesn't give a fully working code example, and also doesn't document whether the order of the enumeration is predictable, which we'd better hope it is if you ever decide to use an order by clause :-D I'll see if have time to sign up and edit the page later, unless someone else can already take care of this? Thanks and kind regards Caveat -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] For Each ?WHAT? in Result
On Sat, 10 Jan 2015, Lewis Balentine wrote: On 01/10/2015 03:04 AM, Caveat wrote: On 10/01/15 09:52, Lewis Balentine wrote: Result (gb.db) This class represents the result of a SQL request. This class is not creatable. This class acts like a read / write array. This class is *enumerable* with the FOR EACH keyword. Guess this should be obvious but not to me pray tell what type/class does one use to enumerate it ?? I tried ResultField[] I tried Collection I tried to try record As a last resort I tried String[] Suffice it to say: I have not a clue :-\ Dim MyResult as Result Dim MyRecord as ? Result = Connection.Find (Something) For Each MyRecord in MyResult Print MyRecord[Field1Name] Print MyRecord[Field2Name] Print MyRecord[Field3Name] Next regards, Lewis I presume you started here http://gambaswiki.org/wiki/comp/gb.db/result And then clicked on the big obvious link to FOR EACH, arriving here: http://gambaswiki.org/wiki/lang/foreach And then didn't look at the second example... :-P Kind regards, Caveat Thank thee ... :-) I did follow that path and I did miss the nuance of the second example. Better yet, don't click on the FOR EACH link but on the enumerable link. This brings you to the Result-specific documentation for enumeration. You want to remember this because not every class is mentioned in the FOR EACH language documentation. As you see, Result has a different way of being enumerated. Instead of returning the objects in the result, a new iteration moves an internal cursor through the rows of the result data. This means, each execution of the loop body For Each hResult Print hResult!onefield Next will yield a different print (unless some rows contain the same value, of course). Regards, Tobi -- There's an old saying: Don't change anything... ever! -- Mr. Monk -- Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user