Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed
Message
From
31/08/2006 17:53:39
 
 
To
31/08/2006 16:52:07
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Re: Speed
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Oracle
Miscellaneous
Thread ID:
01150121
Message ID:
01150246
Views:
33
How did you chain the commands into a property?

say command1 is "insert into load_history (field1) values (1)"
and command2 is "insert into load_history (field2) values (2)"

What do you put between the two so each command is recognised as distinct?

>>The prepare_for_sqlexec routine aids in getting ready for the sqlexec. Since I am building the sql into a variable, I have to stick quotes around a character value after performing rtrim. For numeric I have to convert to character. For null, I have to use "null". I will have to experiment with this.
>
>I have rolled my own thing for SQL updates (TSQL, not Oracle, but I figure the difference isn't much). Couple of things:
>
>- your emulation of update mode 2 or 3 (whichever it was - checking all the updated or all updatable fields) is probably too much. Its intention was to give fine granular control to two users updating the same record, i.e. to handle the deadly embrace situations. For batch updates, I'm always going by key only.
>
>- when building an update statement, you can build the command string as you do - i.e. converting every value to character (I got my own code for that, if you want), or use ?var type of value. In the latter case, you can pretty much sqlprepare the statement, and just do a scatter memvar each time and SqlExec() again for the new set of values in the variables. But that's still one trip per record.
>
>- if you're sending updates one record at a time, you're making a trip to the server for each. The trip itself bears some cost. My trick to reduce the cost was to accumulate the commands into a variable (actually a property of my updater class) and check what the size would be after adding the next chunk. If it would go over 8K (which I think is the limit for SQL server), I'd execute it, set it back to "" and then add the next command. This greatly reduced the number of calls to the server - and mind you, my server was about six states away.
>
>>Is there any easy way to compare two fields that can be null? Basically if both fields are null then return true, if only one is null and the other has a value then return false. If both are not null then compare the two values.
>
>You can compare the nvl() of each. You only need to take care to provide a meaningful default value.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform