[Gambas-bugtracker] Bug #1647: SQLITE: INTEGER PRIMARY KEY AUTOINCREMENT is not SERIAL?
bugtracker at gambaswiki.org
bugtracker at gambaswiki.org
Sun Sep 8 23:56:51 CEST 2019
http://gambaswiki.org/bugtracker/edit?object=BUG.1647&from=L21haW4-
Martín BELMONTE reported a new bug.
Summary
-------
SQLITE: INTEGER PRIMARY KEY AUTOINCREMENT is not SERIAL?
Type : Request
Priority : Medium
Gambas version : Master
Product : Database component
Description
-----------
Hi.
If I use a database SQLite3 created as follow:
CREATE TABLE "cars" ( `csidx` INTEGER PRIMARY KEY AUTOINCREMENT, `csname` TEXT UNIQUE )
Then I try to know the type of field with something like this:
Public Sub Samplefld(c As Connection)
Dim tbl As Table
Dim fld As Field
Dim str As String
For Each tbl In c.Tables 'Lista de tablas
For Each fld In tbl.Fields
Select fld.Type
Case db.Boolean '(1)
str &= "Type: Boolean [" & fld.Type & "]\n"
'Case ??????? '(2)
'Case ??????? '(3)
Case db.Integer '(4)
str &= "Type: Integer [" & fld.Type & "]\n"
Case db.Long '(5)
str &= "Type: Long [" & fld.Type & "]\n"
'Case ??????? '(6)
Case db.float '(7)
str &= "Type: Float [" & fld.Type & "]\n"
Case db.date '(8)
str &= "Type: Date [" & fld.Type & "]\n"
Case db.string '(9)
str &= "Type: String [" & fld.Type & "]\n"
Case db.Serial '(-1)
str &= "Type: Serial [" & fld.Type & "]\n"
Case db.Blob '(-2)
str &= "Type: Blob [" & fld.Type & "]\n"
Case Else
str &= "Type: ???? [" & fld.Type & "]\n"
End Select
Next
Next
Print str
End
Then gb.db returns integer and never serial.
if INTEGER PRIMARY KEY AUTOINCREMENT is the way to say to Sqlite3 hey this field is serial. It is possible to modify the component gb.db in order to it returns gb.serial?
I dont know what happen in pg o mysql.
Thanks.
System information
------------------
[System]
Gambas=3.13
OperatingSystem=Linux
Kernel=5.0.0-27-generic
Architecture=x86_64
Distribution=Pop!_OS 19.04
Desktop=POP:GNOME
Theme=Gtk
Language=es_AR.UTF-8
Memory=7848M
[Libraries]
Cairo=libcairo.so.2.11600.0
Curl=libcurl.so.4.5.0
DBus=libdbus-1.so.3.19.9
GStreamer=libgstreamer-1.0.so.0.1590.0
GTK+2=libgtk-x11-2.0.so.0.2400.32
GTK+3=libgtk-3.so.0.2404.4
OpenGL=libGL.so.1.7.0
Poppler=libpoppler.so.85.0.0
QT4=libQtCore.so.4.8.7
QT5=libQt5Core.so.5.12.2
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6
[Environment]
CLUTTER_IM_MODULE=xim
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DEFAULTS_PATH=/usr/share/gconf/pop.default.path
DESKTOP_SESSION=pop
DISPLAY=:1
GB_GUI=gb.qt4
GDMSESSION=pop
GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/gambas3.desktop
GIO_LAUNCHED_DESKTOP_FILE_PID=2001
GJS_DEBUG_OUTPUT=stderr
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GNOME_SHELL_SESSION_MODE=pop
GOPATH=<home>/Documents/desarrollo/golan
GOROOT=/usr/local/go
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
GTK_IM_MODULE=ibus
GTK_MODULES=gail:atk-bridge
HOME=<home>
IM_CONFIG_PHASE=2
LANG=es_AR.UTF-8
LANGUAGE=es_AR.UTF-8
LC_ADDRESS=es_AR.UTF-8
LC_IDENTIFICATION=es_AR.UTF-8
LC_MEASUREMENT=es_AR.UTF-8
LC_MONETARY=es_AR.UTF-8
LC_NAME=es_AR.UTF-8
LC_NUMERIC=es_AR.UTF-8
LC_PAPER=es_AR.UTF-8
LC_TELEPHONE=es_AR.UTF-8
LC_TIME=es_AR.UTF-8
LOGNAME=<user>
MANDATORY_PATH=/usr/share/gconf/pop.mandatory.path
PAPERSIZE=a4
PATH=<home>/Documents/desarrollo/golan/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD=<home>
QT4_IM_MODULE=xim
QT_ACCESSIBILITY=1
QT_IM_MODULE=ibus
SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/1453,unix/<hostname>:/tmp/.ICE-unix/1453
SHELL=/bin/bash
SHLVL=0
SSH_AGENT_PID=1559
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
TZ=:/etc/localtime
USER=<user>
USERNAME=<user>
WINDOWPATH=2
XAUTHORITY=/run/user/1000/gdm/Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-pop:/etc/xdg
XDG_CURRENT_DESKTOP=pop:GNOME
XDG_DATA_DIRS=/usr/share/pop:/usr/local/share/:/usr/share/
XDG_MENU_PREFIX=gnome-
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=pop
XDG_SESSION_ID=2
XDG_SESSION_TYPE=x11
XDG_VTNR=2
XMODIFIERS=@im=ibus
More information about the Bugtracker
mailing list