Passing temp-tables

Posted by Admin on 18-Feb-2010 05:04

Can anyone tell me how can I pass temp-table through at least 3 objects without copying it by-val. The situation is simple. I've got one form which holds grid with data from local temp-table. It has refresh button which when clicked runs simple method. This method does something like this: instanciate datahelper object (which holds methods for loading data in many ways - filtering, etc.), invoking one of the helper method (first tt pas). This helper method creates specified object which implements IOperation, and passes this object to connection manager singelton, which executes operation(conn. to the appsrv, invoke spec. procedure, grab data), after this execution operation object holds data in temp-table. After that helper method should grab data from operation object and pass it to the form.

Only one pass by-value is needed here - appserver proc to operation object, rest should be passed by ref or bind or something that works. I read the doc couple times, tried some examples and all for nothing. It all works now passing by-value which is slow with tons of data. Any suggestions?

All Replies

Posted by Thomas Mercer-Hursh on 18-Feb-2010 11:12

Why pass the TT at all?  Why not wrap it in an object with appropriate methods and simply pass the object reference.

Posted by Admin on 18-Feb-2010 23:21

Any suggestions?

Do you have a call diagram? It should work (and works for me) when thru all the call stack there is the BY-REFERENCE option on the (OUTPUT) parameters, except for the one where you expect a deep copy.

Posted by Admin on 19-Feb-2010 03:28

So I've got wrapped temp-table. Made some methods which returns bindingsource for datagrids. Now when i pass bindingsource is it by reference by default (?), c# passes all var by reference (except base ones), but here i'm a little bit confused (docs said everything is by val). When i tried BY-REFERENCE with bindingsource i got an error.

What about situation when you need just one row of data (one order?) to bind it to controls or to process it (calculate sth., or just to check sth.)?

Posted by Admin on 19-Feb-2010 04:02

Objects are always passed by reference, never by values. This will be

the same for .NET and ABL objects.

This thread is closed