sqlite gambas table info?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

sqlite gambas table info?

PICCORO McKAY Lenz
its there some code to get BEFORE send the query the fields of the table?

i mean, in the following code example i already know the column name, but i
need firts detect column name to send amount of filters

sCriteria *=* "id = &1"iParameter *=* *1012*$hConn*.*Begin' Same as
"SELECT * FROM tblDEFAULT WHERE id = 1012"hResult *=*
$hConn*.*Edit*(*"tblDEFAULT"*,* sCriteria*,* iParameter*)*


in this case, the column "id" was previously knowed! but in my case i need
to detect all the column names firts before send the filters/parameters
criteria

please any help?

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sqlite gambas table info?

zxMarce
On 16/06/17 14:48, PICCORO McKAY Lenz wrote:

> its there some code to get BEFORE send the query the fields of the table?
>
> i mean, in the following code example i already know the column name, but i
> need firts detect column name to send amount of filters
>
> sCriteria *=* "id = &1"iParameter *=* *1012*$hConn*.*Begin' Same as
> "SELECT * FROM tblDEFAULT WHERE id = 1012"hResult *=*
> $hConn*.*Edit*(*"tblDEFAULT"*,* sCriteria*,* iParameter*)*
>
>
> in this case, the column "id" was previously knowed! but in my case i need
> to detect all the column names firts before send the filters/parameters
> criteria
>
> please any help?
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
Piccoro,

Does this help?

  Dim fld as Field
  For Each fld In Result.Fields
    ... do whatever with field names
  Next

zxMarce

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sqlite gambas table info?

PICCORO McKAY Lenz
2017-06-16 15:04 GMT-04:00 ML <[hidden email]>:

> Does this help?
>
>   Dim fld as Field
>   For Each fld In Result.Fields
>     ... do whatever with field names
>   Next
>
err zxMarce.. that need a previous query... and i need the filed BEFORE
made the query jajajaj

quite strange but that its!


>
> zxMarce
>
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sqlite gambas table info?

zxMarce
Maybe a previous query like:

  SELECT TOP 1 * FROM <yourTable>

would help with the FOR EACH loop. Don't really know your case though.

Regards,
zxMarce


On Jun 16, 2017, 16:40, at 16:40, PICCORO McKAY Lenz <[hidden email]> wrote:

>2017-06-16 15:04 GMT-04:00 ML <[hidden email]>:
>
>> Does this help?
>>
>>   Dim fld as Field
>>   For Each fld In Result.Fields
>>     ... do whatever with field names
>>   Next
>>
>err zxMarce.. that need a previous query... and i need the filed BEFORE
>made the query jajajaj
>
>quite strange but that its!
>
>
>>
>> zxMarce
>>
>> ------------------------------------------------------------
>> ------------------
>> 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
>> [hidden email]
>> 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
>[hidden email]
>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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sqlite gambas table info?

PICCORO McKAY Lenz
yeah--- that i was done.. as you confirmed.. its the only solution

due mysql has the DESCRIBE command, but sqlite need to search in master
table...

thanks

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-06-16 15:47 GMT-04:00 <[hidden email]>:

> Maybe a previous query like:
>
>   SELECT TOP 1 * FROM <yourTable>
>
> would help with the FOR EACH loop. Don't really know your case though.
>
> Regards,
> zxMarce
>
>
> On Jun 16, 2017, 16:40, at 16:40, PICCORO McKAY Lenz <
> [hidden email]> wrote:
> >2017-06-16 15:04 GMT-04:00 ML <[hidden email]>:
> >
> >> Does this help?
> >>
> >>   Dim fld as Field
> >>   For Each fld In Result.Fields
> >>     ... do whatever with field names
> >>   Next
> >>
> >err zxMarce.. that need a previous query... and i need the filed BEFORE
> >made the query jajajaj
> >
> >quite strange but that its!
> >
> >
> >>
> >> zxMarce
> >>
> >> ------------------------------------------------------------
> >> ------------------
> >> 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
> >> [hidden email]
> >> 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
> >[hidden email]
> >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
> [hidden email]
> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sqlite gambas table info?

Tobias Boege-2
In reply to this post by PICCORO McKAY Lenz
On Fri, 16 Jun 2017, PICCORO McKAY Lenz wrote:

> its there some code to get BEFORE send the query the fields of the table?
>
> i mean, in the following code example i already know the column name, but i
> need firts detect column name to send amount of filters
>
> sCriteria *=* "id = &1"iParameter *=* *1012*$hConn*.*Begin' Same as
> "SELECT * FROM tblDEFAULT WHERE id = 1012"hResult *=*
> $hConn*.*Edit*(*"tblDEFAULT"*,* sCriteria*,* iParameter*)*
>
>
> in this case, the column "id" was previously knowed! but in my case i need
> to detect all the column names firts before send the filters/parameters
> criteria
>
> please any help?
>

Look again at the properties of the Connection object. To get information
about a table, the "Tables" property is a good start. If your Connection
is called h you can list all tables, their fields and datatypes like this:

  ' h is an open connection to a database
  Dim t As Table, f As Field

  For Each t In h.Tables
    Print t.Name
    For Each f In t.Fields
      Print "  "; f.Name;; f.Type
    Next
  Next

Use

  t = h.Tables["<your_tablename>"]

in place of the outer loop if you only care about a specific table.

Regards,
Tobi

--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sqlite gambas table info?

PICCORO McKAY Lenz
umm interesting, great tobias, thanks...

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-06-16 16:17 GMT-04:00 Tobias Boege <[hidden email]>:

> On Fri, 16 Jun 2017, PICCORO McKAY Lenz wrote:
> > its there some code to get BEFORE send the query the fields of the table?
> >
> > i mean, in the following code example i already know the column name,
> but i
> > need firts detect column name to send amount of filters
> >
> > sCriteria *=* "id = &1"iParameter *=* *1012*$hConn*.*Begin' Same as
> > "SELECT * FROM tblDEFAULT WHERE id = 1012"hResult *=*
> > $hConn*.*Edit*(*"tblDEFAULT"*,* sCriteria*,* iParameter*)*
> >
> >
> > in this case, the column "id" was previously knowed! but in my case i
> need
> > to detect all the column names firts before send the filters/parameters
> > criteria
> >
> > please any help?
> >
>
> Look again at the properties of the Connection object. To get information
> about a table, the "Tables" property is a good start. If your Connection
> is called h you can list all tables, their fields and datatypes like this:
>
>   ' h is an open connection to a database
>   Dim t As Table, f As Field
>
>   For Each t In h.Tables
>     Print t.Name
>     For Each f In t.Fields
>       Print "  "; f.Name;; f.Type
>     Next
>   Next
>
> Use
>
>   t = h.Tables["<your_tablename>"]
>
> in place of the outer loop if you only care about a specific table.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> 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
> [hidden email]
> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...