[Gambas-user] Extracting fields from a Result

Doug Hutcheson owlbrudder at gmail.com
Tue Jan 2 06:18:00 CET 2018



On Tue, 2018-01-02 at 14:34 +1000, Doug Hutcheson wrote:
> On Mon, 2018-01-01 at 23:12 -0500, T Lee Davidson wrote:
> > On 01/01/2018 10:00 PM, Doug Hutcheson wrote:
> > > I changed the code to connect to my database and the following
> > > was the output:
> > > [doug at womble <mailto:doug at womble> CommandLinePostgreSQLtestApp]$
> > > ./CommandLinePostgreSQLtestApp.gambas 
> > > Connected.
> > > Main.Main.24: 35
> > > Main.Main.25: Main.Main.25: Unknown field: txtMasterDatabase
> > > Main.Main.25 
> > > 
> > > 35 is the correct field count; txtMasterDatabase is the first
> > > field in the table.
> > > 
> > > I have attached two source archives: one is my PostgreSQL test
> > > application - the one which started this thread - and the other
> > > is your command line application. Please feel free to point out
> > > if I have done something stupid, because I am at the start of my
> > > Gambas learning curve and welcome any input.
> > > 
> > 
> > Looking at the name of the first field in the table reminded me of
> > something I stumbled across during my foray into PostgreSQL
> > land. It has an issue with mixed-case names.
> > 
> > https://stackoverflow.com/questions/20878932/are-postgresql-column-
> > names-case-sensitive :
> > "All identifiers (including column names) that are not double-
> > quoted are folded to lower case in PostgreSQL."
> > 
> > 
> Darn! I knew about that restriction and commonly double-quote my
> identifiers for that reason. Sure 'nuff, when I change the first
> field name to all lower-case the loop works fine, then barfs on the
> next one which I have not changed.
> 
> Looks like you have solved that much of the quandary for me, Lee.
> Give yourself a gold star and an elephant stamp!   "8-)
> 
> Now I will see if it solves the problem of the Connections not
> wanting to play nicely. I'll get back to you on that.
> 
> Cheers, Doug

Hi Lee. Nope, it does not help with the Connections problem. My
Connections tool correctly shows all my tables and browses my data, but
attempting to use a Connection with a Datasource control and giving it
a tablename visible in the Connections tool, causes the error "Cannot
open database: fe_sendauth: no password supplied".

I am a retired C and VBA programmer with more time than sense, so I'll
poke around in the Gambas source (gb.db, gb.db.mysql, gb.db.postgresql
for a start) and see what I can see. The field names issue might just
be a matter of double-quoting each time a field is accessed and the
password issue seems to be common to MySql and PostgreSQL so is going
to be something obvious. I'll let you know if I find anything
interesting.
Cheers, Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180102/d5a63e2a/attachment.html>


More information about the User mailing list