[Gambas-user] collection of collection problem
PICCORO McKAY Lenz
mckaygerhard at ...626...
Sat Mar 25 00:24:11 CET 2017
2017-03-24 10:52 GMT-04:00 Fabien Bodard <gambas.fr at ...626...>:
> Sorry but despite your article ... that i've read all the content I
> can't understand your need ... And I'm sur there is a way to do it
> simpler with Gambas.
>
U'r code are correct, the problem is the understand for people that come
from other programing languaje .. please dont pay attention to the "array"
word, its only a reference
Here some will ask it selft: "so then why Gambas? why not better php or
java?" simple: once understand the code, as u said, will be then a better
way and wil be easy to do!
It is difficult to explain it for all of you because I do not see large
projects made in Gambas beyond domotica project, and second because they do
not understand when one should evaluate contracting expenses against
quality of personnel ..
A developer who understands at first sight your concept, it will cost me
more than one who only has a simple analogy ...i mean we do not see the
word "array" only, the equivalence of code are able to Understand it quickly
Obviously there are better ways, if I must, i would implement Beans adapted
from Java EE concepts and dynamic abstractions .. but I would get expensive
at the contracting level ..
an then gambas convert in a "basic" related languaje easy to learn
>
> What I've understand :
>
> ' Gambas module file
>
> Public Sub Main()
>
> Dim hCon As New Connection(Subst("mysql://&1@&2:3306/&3",
> $servername, $username, $dbname))
> Dim $orders As String = "SELECT * FROM almorder WHERE cod_order = &1"
> Dim $ordersproducts As String = "SELECT * FROM alorderproducts WHERE
> cod_order = &1"
>
> Dim CurrentOrder As String = "001"
> Dim cOrder as Collection
>
> hCon.Password = $password
> hCon.Open
>
> 'refer to the first line of the returned collection to get a single
> collection
> cOrder = ResultToCollectionArray(db.Exec($orders, CurrentOrder))[0]
>
> cOrder!cod_contenido =
> ResultToCollectionArray(db.Exec($ordersproducts, CurrentOrder)
>
>
> 'So we can read :
>
> Print cOrder!cod_contenido[2]!can_product
>
> 'that refer To the Line 2 Of the array contained In column
> "cod_contenido" Of cOrder....column "can_product"
>
> End
>
>
> Private Function ResultToCollectionArray(hResult As Result) As
> Collection[]
> Dim a As New String[]
> Dim f As ResultField
> Dim C As Collection
> Dim aC As New Collection[]
> Dim s As String
>
> If Not hResult And If Not hResult.Available Then Return
>
> For Each f In ResultField
> a.Add(f.Name)
> Next
>
> For Each hResult
> c = New Collection
> For Each s In a
> c[s] = hResult[s]
> Next
> aC.Add(c)
> Next
> Return aC
> End
>
>
>
>
> 2017-03-23 19:49 GMT+01:00 PICCORO McKAY Lenz <mckaygerhard at ...626...>:
> > well, this its a funny case, the code of the firts mail are the correct
> way
> > , but one line are incorrect.. that's why not working
> >
> > in any case i put how must be done in this article:
> > http://qgqlochekone.blogspot.com/2017/03/gambas3-
> collections-of-collections-as.html
> >
> > my error, a typo in the line:
> > filasdet.Add(columnas, rsetd!cod_contenido)
> > must be:
> > filasdet.Add(columnasdet, rsetd!cod_contenido)
> >
> > and in the article i try to explain why i done that
> >
> >
> > Lenz McKAY Gerardo (PICCORO)
> > http://qgqlochekone.blogspot.com
> >
> > 2017-03-23 8:25 GMT-04:00 Fabien Bodard <gambas.fr at ...626...>:
> >
> >> Please tel me how you make the array in php. And in java. Or give me a
> >> link.
> >> I'll try to answer this evening
> >> For me you need arrays of collections.
> >> Array are the lines storage and collection the line itself.
> >>
> >> Colresult[2]!storage[3]!article
> >> ------------------------------------------------------------
> >> ------------------
> >> Check out the vibrant tech community on one of the world's most
> >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> >> _______________________________________________
> >> Gambas-user mailing list
> >> Gambas-user at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> > ------------------------------------------------------------
> ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list