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

richard terry rterry at ...1822...
Wed Mar 26 11:21:09 CET 2008


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
================================





More information about the User mailing list