[Gambas-user] Connection.Subst crashing with Signal #11 (2.99 1154)

Benoit Minisini gambas at ...1...
Wed Mar 26 21:59:05 CET 2008


On mercredi 26 mars 2008, richard terry wrote:
> This started happening on my machine with 2.99 build 1147, Some of my code
> uses .Subst . I quickly knocked up this simple example  which causes the
> same problem.
>
> However running this file under 2.4, works with no problem at all.
>
> This has bought my programming to a frustrating grinding halt. I'd like to
> continue in 3.0, but can I re-compile in 2.4 and not have lost anything?
>
> Regards
>
> Richard
>
> ==============================================
> ' Gambas class file
> PUBLIC $hconn AS Connection
> PUBLIC $result AS Result
> 'simple table for postgresql - make in postgres environment
> ' CREATE TABLE test
> ' (
> '   test text
> ')
>
>
> PUBLIC SUB form_Open()
>   test
> END SUB
>
> PUBLIC SUB test()
>    DIM bConnect AS Boolean
>    DIM sql AS String
>    bConnect = dbConnect()
>    'This line crashes with signal 11
>    PRINT $hconn.Subst("WHERE Name = &1 AND Date = &2", "Benoit", Now)
>
>    'but this dosn't
>     sql = "Insert into public.test (test) values ('Help, nothing works any
> more')"
>     PRINT sql
>        TRY $Result = $hConn.Exec(sql)
>          IF ERROR THEN
>             message.Error(error.Text)
>         END IF
>
>
>  END SUB
>
> PUBLIC FUNCTION dbConnect() AS Integer
>  DIM sName AS String
>  DIM bConnected AS Boolean
>  bConnected = 0
>
>   $hConn = NEW Connection
>  sName = "MyDB"  'database name
>   TRY $hConn.Close
>    WITH $hConn
>     .Type = "postgresql"
>     .Host = "localhost"
>     .Login = "yourlogin"
>     .Password = "your password here"
>   END WITH
>   $hConn.Name = sName
>   $hConn.Open
>    bConnected = 1
>    RETURN bConnected
> CATCH
>
>
>   Message.Error(DConv(Error.Text))
>   bConnected = FALSE
> RETURN bConnected
> END
> ================================
>

The bug has been fixed (normally) in revison 1261.

Otherwise you can install gambas2 and gambas3 on the same system. This is the 
reason of having the version sticked to the name!

Regards,

-- 
Benoit Minisini




More information about the User mailing list