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

Rolf Schmidt rolf.frogs at ...221...
Mon Mar 7 16:30:58 CET 2005


Thank you Benoit Minisini:

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

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

But without the WAIT statement the flag will never be TRUE.

And why will the second EXEC call not be served? - Any suggestions
The last argument in this call points to a file with a lot of table to create 
in the database (with references) and fills about 20 items into one of the 
tables. So postgresql resonds with stdout answers for creating and inserting 
but also with output in the error channel with informations about sequence 
tables which will be created automatically.
At least the output is about 50 lines.

Is it possible to handle this from inside of gambas?

Bye
Rolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20050307/2a156521/attachment.sig>


More information about the User mailing list