[Gambas-user] How do I execute this istruction

Ralf Schuchardt rasc at ...17...
Mon Sep 13 15:31:30 CEST 2004


Hello!

Am Montag, 13. September 2004, 14:39:23, schriebst du:

> How do I execute this istruction ?
> EXEC ["mdb-schema", DbName, "-T", tablename] FOR READ AS p2

> I am writing this code to get all the tables in an mdb database. I get the
> database name, and then, by the command mdb-tables I get all the tables of this
> database.

[...]

> PUBLIC SUB Button1_Click()
> DIM tablename AS String
> DIM p2 AS Process
> IF tabelle.Index<>-1 THEN
> textbox1.text=tabelle.Current.text
> tablename=tabelle.Current.text
> EXEC ["mdb-schema", DbName, "-T", tablename] FOR READ AS p2
> ELSE
> textbox1.text="Nessun elemento selezionato"
> EXEC ["mdb-schema", DBname] FOR READ AS p2

> Object.Attach(p2, ME, "proc2")
> ENDIF
> end

> But when I execute the program and I select an item in the listbox, the program
> is blocked. If I don't select an item in the list, teh program works correctly.

You use only one attach command? This does mean you have at least the
following subs declared:

public sub Process_Read()
  ' to read output for one table
  ' Process is the standard name
end

public sub proc2_Read()
  ' to read output for all tables
  ' proc2 is your "attached" name
end

I suppose you miss Process_Read() or your Object.Attach is in a wrong
line and should belong below the ENDIF.


But I think you have triggered a bug in gambas, or at least an
underdocumented behavior.
When the internal input buffer (where gambas collects all output of a
executed program) is full and it finds no one to deliver the
data to, it simply stops.
This has bitten me in the past.

  exec [cmd] wait for read as aprocess

Never do this, if your cmd creates output of more than a few lines.


Ralf





More information about the User mailing list