[Gambas-user] problem using SQLITE3 and string fields
Benoît Minisini
gambas at ...1...
Fri Jul 17 19:02:00 CEST 2009
> > Hi all,
> >
> > I'm trying to read the f-spot database to add some tools to this program.
>
> I
>
> > write few lines in gambas and everything worked fine but no the access to
> >
> >> string fields. this is a part of the code:
> >>
> >> Con.Close()
> >> Con.Type = "sqlite"
> >> Con.Host = "/home/rsalas/.gnome2/f-spot/"
> >> Con.Name = "photos.db"
> >> TRY Con.Open()
> >> IF ERROR THEN
> >> Message.Error("Error al conectar a la base de datos.")
> >> Con = NULL
> >> ELSE
> >> TRY TablaFicheros = Con.Exec("SELECT photos. *, tags. * FROM (photos
> >> INNER JOIN photo_tags ON photos.Id = photo_tags.photo_id)INNER JOIN tags
>
> ON
>
> >> photo_tags.tag_id = tags.Id ")
> >> IF ERROR THEN
> >> Message.Error("Error al abrir hacer SELECT base de datos.")
> >> ELSE
> >> TablaFicheros.Movefirst()
> >> sFichero = TablaFicheros["uri"]
> >> txtFichero.text = sFichero
> >> ENDIF
> >>
> >> The line "sFichero = TablaFicheros["uri"]" gives the value "f" to
>
> sFichero
>
> >> but not the rest of the string. This doesn't happend with text fields.
>
> Can
>
> >> anyone help me on this?
> >>
> >> Thanks
> >>
> >> PS: Using gambas 2.8 on linux ubuntu 9.04
> >
> >Can you get the real sqlite datatype of this field?
> >
> >--
> >Beno?t
>
> sqlite> .schema photos
> CREATE TABLE photos ( id INTEGER PRIMARY KEY
> AUTOINCREMENT NOT NULL, time INTEGER NOT NULL,
> uri STRING NOT NULL, description TEXT NOT
> NULL, roll_id INTEGER NOT NULL,
> default_version_id INTEGER NOT NULL, rating INTEGER
> NULL, md5_sum TEXT NULL );
> CREATE INDEX idx_photos_roll_id ON photos(roll_id);
> sqlite>
>
>
> uri is a string with the path name of the file
I can read the uri correctly with Gambas 3. I will check with Gambas 2...
--
Benoît
More information about the User
mailing list