Correcting mysef: Yesterday it works in home, this morning it doesn't work in office. Isn't enough repeat the .Create line. Is necesary to close and re-open the connection:
Public Sub hlog(tipo As String, detalle As String) Dim r As Result Dim s As String s = Replace(detalle, "'", "\\'") s = Replace(s, "\"", "\\\"") Try r = hconn.Create("ad_hlog") If Error Then r = Null hconn.close hconn.open r = hconn.Create("ad_hlog") Endif r!tipo = tipo r!detalle = s r!usr = mComun.usuario.nick r!fmod = Now() r.Update End 2014-11-05 11:40 GMT+01:00 Jorge Carrión <sho...@gmail.com>: > Ron: > Your Cº is ugly but almost all Spanish names wear á, é, í, ó or ú > characters... You can imagine what a names list is... :D :D > > I think this is a bug. > > I've modified the function in this way: > > Public Sub hlog(tipo As String, detalle As String) > > Dim r As Result > Dim s As String > > s = Replace(detalle, "'", "\\'") > s = Replace(s, "\"", "\\\"") > > Try r = datos.Create("ad_hlog") > If Error Then > r = Null > r = datos.Create("ad_hlog") > Endif > > r!tipo = tipo > r!detalle = s > r!usr = mComun.usuario.nick > r!fmod = Now() > r.Update > > End > > Simply setting the result as null (trying to free the "non allocated") and > repite the .Create and .... all works fine. > > Regards. > > > 2014-11-05 11:17 GMT+01:00 Ron <r...@cyberjunky.nl>: > >> I have seen maybe something similar twice when running my project. >> On 3.6.1 (maybe also 3.6.0) all of a sudden the character set seem to >> have been switched/resetted. >> >> I see it because a lot of my fields contains °C symbols, when the >> issue with occurs it is displayed as seen in attachment and ofcourse >> the queries/check fails/don't match anymore. My tables are using >> latin1 default charset. >> >> Only restarting the program resolved the issue. >> >> I can reproduce it by restarting mysql server between/during queries. >> Of course this is normal for this to go wrong, but I remember that >> there was a bugfix with regards to re-selecting correct charset when >> this happens/connection issues arise. >> >> During the two times I have seen the issue, my mysql server wasn't >> being restarted, and I had enough resources on my develpment machine. >> So I'm not sure what happened, and why the recovered connections >> behave differently. >> >> Maybe this issue can be looked into.. >> >> >> Regards, >> Ron. >> >> 2014-11-05 10:39 GMT+01:00 Jorge Carrión <sho...@gmail.com>: >> > 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 >> > >> ------------------------------------------------------------------------------ >> > _______________________________________________ >> > Gambas-user mailing list >> > Gambas-user@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/gambas-user >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> Gambas-user mailing list >> Gambas-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-user >> >> > ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user