Ciao darth
no, il passo g) è corretto, uso il classico PRINT per visualizzare il contenuto del campo, ma in ogni caso, qualsiasi funzione riporta solo il primo carattere.
Il codice, alquanto semplice, che stò utilizzando per testare le funzionalità di sqlite, è il seguente:
PRIVATE $hConn AS Connection
PUBLIC SUB Main()
DIM sName AS String = User.Home &/ "tmp" &/ "dbsqlite.db"
DIM hRes AS Result
DIM hField AS ResultField
DIM nRec AS Integer
$hConn = NEW Connection
WITH $hConn
.Type = "sqlite3"
.Host = ""
.Login = ""
.Password = ""
.Name = sName
END WITH
PRINT "File = "; sName
PRINT "Exist = "; Exist(sName)
$hConn.Open()
PRINT "Database opened"
PRINT "Database name = " & $hConn.Name
'hRes = $hConn.Exec("SELECT name FROM sqlite_master WHERE type = 'table';")
hRes = $hConn.Exec("SELECT * FROM test;")
PRINT "Count = "; hRes.Count
hRes.MoveFirst()
FOR nRec = 0 TO hRes.Max
FOR EACH hField IN hRes.Fields
PRINT "Field = "; hField.Name, hField.Type, hField.Length, CStr(hRes[hField.Name])
NEXT
hRes.MoveNext()
NEXT
FINALLY
TRY $hConn.Close()
PRINT "Database closed"
RETURN
CATCH
PRINT "Error = "; Error.Code, Error.Text
END
Ho fatto una prova, cercando di ottenere l'elenco delle tabelle contenute nel database, e mi dà lo stesso identico problema:
PRIVATE $hConn AS Connection
PRIVATE $hRes AS Result
PRIVATE $hTable AS Table
PRIVATE $hField AS ResultField
PUBLIC SUB Main()
DIM sName AS String = User.Home &/ "tmp" &/ "dbsqlite.db"
DIM nRec AS Integer
$hConn = NEW Connection
WITH $hConn
.Type = "sqlite3"
.Host = ""
.Login = ""
.Password = ""
.Name = sName
END WITH
PRINT "File = "; sName
PRINT "Exist = "; Exist(sName)
$hConn.Open()
IF (NOT $hConn.Opened) THEN Error.Raise("Database not opened.")
PRINT "Database opened"
PRINT "Database name = " & $hConn.Name
PRINT "Charset = "; $hConn.Charset
PRINT "Version = "; Left(Str($hConn.Version), Len(Str($hConn.Version)) - 4)
'--------------------------------------------
' elenco tabelle. Errore -1 e visualizza solo il primo carattere del nome
FOR EACH $hTable IN $hConn.Tables
PRINT "Table = "; $hTable.Name
NEXT
'--------------------------------------------
'hRes = $hConn.Exec("SELECT name FROM sqlite_master WHERE type = 'table';")
$hRes = $hConn.Exec("SELECT * FROM " & $hConn.Quote("color"))
PRINT "Count = "; $hRes.Count
PRINT " "; "Name", "Type", "Length", "Value"
PRINT " "; "----", "----", "------", "-----"
$hRes.MoveFirst()
FOR nRec = 0 TO 0 'hRes.Max
FOR EACH $hField IN $hRes.Fields
TRY PRINT "Field = "; $hField.Name, $hField.Type, $hField.Length, $hRes[$hField.Name]
NEXT
$hRes.MoveNext()
NEXT
TRY $hConn.Close()
PRINT "Database closed"
CATCH
PRINT "Error = "; Error.Code, Error.Text
END
Inoltre, stessa anomalia cambiando il nome del driver in "sqlite"; prove con "sqlite2" non posso farle perchè non esiste più nel repository di fedora, già da parecchio tempo.
Confermo l'errore che hai riscontrato!
Questo l'output che ricevo:
File = /home/han/tmp/dbsqlite.db Exist = True Database opened Database name = /home/han/tmp/dbsqlite.db Charset = UTF-8 Version = 3 Error = -1 Unknown table: c
Sarebbe proprio un peccato dover abbandonare queste nuove funzionalità che stai implementando; continuo a sperare!