[Gambas-user] Problem with the EXEC[] function

Benoit Minisini gambas at ...1...
Mon Mar 7 15:54:33 CET 2005


On Monday 07 March 2005 15:44, Rolf Schmidt wrote:
> Hi
>
> I fight since three days agains the EXEC[] function for external calls.
>
> First why I use it: I would like to have some special setup for a
> postgresql database.
> Second: Postgresql is requiered because I need a lot of it's capabilities
> which are not available in mysql.
>
> Third: I would check if the setup of the database returns no error.
>
> The code example:
>
> PUBLIC DBisCreated AS Boolean
>
> PUBLIC SUB Process_Read()
>   DIM sline AS String
>
>   LINE INPUT #LAST, sline
> '  message.Info(sline)
>
>   returndata = returndata & sline
>   IF sline = "CREATE DATABASE" THEN
>     DBisCreated = TRUE
>   ELSE
>     DBisCreated = FALSE
>   ENDIF
> END
>
> PUBLIC FUNCTION createDB() AS Boolean
>   CAskDB.ShowModal()
>   EXEC ["createdb", "-h", FHV.konfig.Key("host"), "-U",
>             FHV.konfig.Key("user"), "-E", "UNICODE",
>             FHV.konfig.Key("database")] WAIT FOR READ
> ' why is the flag always false?
>   IF DBisCreated = TRUE THEN
>     EXEC ["psql", "-h", FHV.konfig.Key("host"), "-u",
> FHV.konfig.Key("user"), "-d", FHV.konfig.Key("database"), "-f",
>              "/home/entwicklung/hausverwaltung/HV/pgdatabase"] WAIT FOR
> READ ' why does this function never comes back - could it be, that it sends
> some ' informations via the error chanel? - How can I fetch these too?
>   ENDIF
> END
>
> Many thanks for any help
> Rolf

This is a problem in the process management of Gambas. You must not use WAIT 
if you want to use FOR READ/WRITE, because the event loop is not called.

I will try to fix that in the next version, but it is not easy...

Sorry for the inconvenience!

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list