[Manifold-l] query.text vs. query.run()
adamw at manifold.net
adamw at manifold.net
Wed Jul 26 06:06:07 CDT 2006
> My script reads:
>
> Imports Manint = Manifold.Interop
> Imports manscript = Manifold.Interop.Scripts
>
> Sub main()
> Dim monapp As Manint.Application
> Dim mondoc As Manint.Document
> Dim monsql As Manint.Query
>
> monapp = New Manint.Application
> mondoc = monapp.NewDocument("g:\thermiques\test.map", False)
> monsql = mondoc.NewQuery("creation tables")
> monsql.Text = "CREATE TABLE [Pilotes] ([IDpilote] INTEGER
> DEFAULT 0, [Pilote] TEXT DEFAULT """");"
> monsql.Run()
> ' ......
> exit sub
>
> When I run the script step by step in debug mode, the new table
> is created at monsql.text line and monsql.run brings an error
> because the [Pilotes] table cannot be created twice. If I comment
> out the monsql.run() line, it works fine.
>
> When I run the script full speed, I need the monsql.run() instruction.
It looks like the debugger evaluates all properties of the Query object (perhaps because you are displaying the value of "monsql" in one of the debugger windows), including the value of the Table property. Attempting to access the value of the Table property runs the query if it has not yet been run. It might be argued that this behavior should be suppressed for action queries, that do not return any tables, but that is how it is currently implemented.
You can solve the problem by stopping the debugger from computing properties. To do that, go to Tools - Options, Debugger, General and uncheck "Enable property evaluation and other implicit function calls".
--
Adam Wachowski
Manifold Development Team
More information about the Manifold-l
mailing list