[Gambas-user] What "Cannot read information about table mi_table_name" means?

Jorge Carrión shordi at ...626...
Wed Nov 5 10:39:11 CET 2014


With MySQL I have this function to log certains operations on a table named
ad_hlog:

(The connection is named datos and is a public variable that remains opened
during project execution.)

Public Sub hlog(tipo As String, detalle As String)

    Dim r As Result
    Dim s As String

    detalle = Replace(detalle, "'", "\\'")
    detalle = Replace(detalle, "\"", "\\\"") 'the string detalle can
contains ' and " characters
    '  Old_code: this two commented lines makes eventualy that charset of
database be changed without message or warning at all
    '    s = "insert into ad_hlog (tipo, detalle, usr,fmod) values ('" &
tipo & "', '" & detalle & "', '" & mComun.usuario.nick & "', " & "now()" &
")"
    '    datos.Exec(s)

    ' New code: the next line produces the "Cannot read information about
table ad_hlog" and changes the charset and produces allocation non freed at
end of execution
    r = datos.Create("ad_hlog")
    r!tipo = tipo
    r!detalle = detalle
    r!usr = mComun.usuario.nick
    r!fmod = Now()
    r.Update

End

This occurs seemingly random. Works fine several times and suddenly all is
wrong.
Apparently something is wrong on connection because the table definition is
very simple and I can't see anything erroneous:

CREATE TABLE IF NOT EXISTS `ad_hlog` (
  `idhlog` int(8) unsigned NOT NULL AUTO_INCREMENT,
  `tipo` varchar(50) NOT NULL,
  `detalle` mediumtext NOT NULL,
  `usr` varchar(20) NOT NULL,
  `fmod` datetime NOT NULL,
  KEY `id` (`idhlog`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2567 ;

That situation are driven me crazy since a lot of time....
I guess that once the problem isolated, I can get around it, but it seems
to me a bug....

Regards



More information about the User mailing list