[Gambas-user] [Gambas Bug Tracker] Bug #1296: not able to use db.find or sql.request with postgreSQL

Jorge Carrión shordi at gmail.com
Sun Apr 15 15:03:50 CEST 2018


The only way to ensure the fields name in sqlite is using the "as" clause
in query. Is what the sqlite web says.
Try with it. It should work.
Regards

El dom., 15 abr. 2018 14:20, <bugtracker at gambaswiki.org> escribió:

> http://gambaswiki.org/bugtracker/edit?object=BUG.1296&from=L21haW4-
>
> Michael ALTROGGE reported a new bug.
>
> Summary
> -------
>
> not able to use db.find or sql.request with postgreSQL
>
> Type             : Request
> Priority         : Medium
> Gambas version   : 3.10
> Product          : Database component
>
>
> Description
> -----------
>
> First, i'm using postgreSQL and this works in pgAdmin III:
>
> SELECT "MA00"."HDR", "MA00"."TXT" FROM public."MA00"
> WHERE "MA00"."MDL" = 'ADRESSEN' AND "MA00"."TNR" = 1 AND "MA00"."AS4LOCAL"
> = 'DE';
>
> this is the query string creation in gambas which works also:
>
> strSQL = "SELECT \"MA00\".\"HDR\", \"MA00\".\"TXT\" "
> strSQL &= "FROM \"public\".\"MA00\" "
> strSQL &= "WHERE \"MA00\".\"MDL\" = '" & VAR.INFMOD & "' AND "
> strSQL &= "\"MA00\".\"TNR\" = " & VAR.INFCOD & " AND "
> strSQL &= "\"MA00\".\"AS4LOCAL\" = '" & VAR.SYSLNG & "';"
>
>
> SQLRequest
>
> This is what I try ...
>
> Debug "INFCOD: " & VAR.INFCOD, "INFMOD: " & VAR.INFMOD, "SYSLNG: " &
> VAR.SYSLNG
> objSqlRequest = New SqlRequest(SYS.conMain)
> Print objRequest.Select("HDR", "TXT").From("MA00").Where("MDL = &1",
> VAR.INFCOD).And().Where("TNR = &2", VAR.INFMOD).And().Where("AS4LOCAL =
> &3", VAR.SYSLNG).OrderBy("HDR DESC").Get()
>
> Debug gives me:
>
> INFCOD: 1   INFMOD: ADRESSEN        SYSLNG: DE
> SELECT "HDR","TXT" FROM "MA00" WHERE (MDL = E'ADRESSEN') AND (TNR = ) AND
> (AS4LOCAL = ) ORDER BY "HDR" DESC
>
> neither TNR or AS4LOCAL are filled and MDL has the wrong value, beside
> that naming is also wrong (table has to be prefixed with schema and fields
> has to be prefixed with table) but trying different possibilities within
> SQLRequest will not lead me to success ... what did I do wrong???
>
> I tried to get DB.Find to work bat same problems ...
>
>
> System information
> ------------------
>
> [System]
> Gambas=3.10.90
> OperatingSystem=Linux
> Kernel=4.13.0-38-generic
> Architecture=x86_64
> Distribution=Linux Mint 18.3 Sylvia
> Desktop=CINNAMON
> Theme=Gtk
> Language=de_DE.UTF-8
> Memory=3390M
>
> [Libraries]
> Cairo=libcairo.so.2.11400.6
> Curl=libcurl.so.4.4.0
> DBus=libdbus-1.so.3.14.6
> GStreamer=libgstreamer-0.10.so.0.30.0
> GStreamer=libgstreamer-1.0.so.0.803.0
> GTK+2=libgtk-x11-2.0.so.0.2400.30
> GTK+3=libgtk-3.so.0.1800.9
> OpenGL=libGL.so.1.2.0
> Poppler=libpoppler.so.58.0.0
> QT4=libQtCore.so.4.8.7
> QT5=libQt5Core.so.5.5.1
> SDL=libSDL-1.2.so.0.11.4
> SQLite=libsqlite3.so.0.8.6
>
> [Environment]
>
> DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-DdhAFpsA3A,guid=88a4aec47827e9817dc919b95ad326c2
> DEFAULTS_PATH=/usr/share/gconf/cinnamon.default.path
> DESKTOP_AUTOSTART_ID=104373d92f142e0395152378745935338000000033660007
> DESKTOP_SESSION=cinnamon
> DISPLAY=:0
> GB_GUI=gb.qt4
> GDMSESSION=cinnamon
> GDM_LANG=de_DE
> GNOME_DESKTOP_SESSION_ID=this-is-deprecated
> GTK_MODULES=gail:atk-bridge
> GTK_OVERLAY_SCROLLING=1
> HOME=<home>
> LANG=de_DE.UTF-8
> LANGUAGE=de_DE
> LOGNAME=<user>
> MANDATORY_PATH=/usr/share/gconf/cinnamon.mandatory.path
>
> PATH=<home>/bin:<home>/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
> PWD=<home>
> QT_ACCESSIBILITY=1
> QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
> QT_QPA_PLATFORMTHEME=qgnomeplatform
> QT_STYLE_OVERRIDE=gtk
>
> SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/3366,unix/<hostname>:/tmp/.ICE-unix/3366
> SHELL=/bin/bash
> SHLVL=0
> SSH_AGENT_PID=3541
> SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
> TZ=:/etc/localtime
> USER=<user>
> XAUTHORITY=<home>/.Xauthority
> XDG_CONFIG_DIRS=/etc/xdg/xdg-cinnamon:/etc/xdg
> XDG_CURRENT_DESKTOP=X-Cinnamon
>
> XDG_DATA_DIRS=/usr/share/cinnamon:/usr/share/gnome:<home>/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
> XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/<user>
> XDG_RUNTIME_DIR=/run/user/1000
> XDG_SEAT=seat0
> XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
> XDG_SESSION_DESKTOP=cinnamon
> XDG_SESSION_ID=c2
> XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
> XDG_SESSION_TYPE=x11
> XDG_VTNR=7
>
>
>
> --------------------------------------------------
>
> This is the Gambas Mailing List:
> https://lists.gambas-basic.org/listinfo/user
>
> Search the list:
> https://lists.gambas-basic.org/cgi-bin/search.cgi
>
> Hosted by https://www.hostsharing.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180415/95c576a5/attachment.html>


More information about the User mailing list