SQLtable & MySql: Problem with Seek & Assign

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
User avatar
wriedmann
Posts: 3775
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

SQLtable & MySql: Problem with Seek & Assign

Post by wriedmann »

Hi Gianluca,
I'm not sure if the SQLTable class needs a movement call before being used.
I have now searched the programmers guide of VO 2.7, but there the SQLTable class is not even mentioned.
Maybe you can give a look to the SQLTable sources to see what is going on - maybe copying a renamed class and using that in the debugger.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
g.bunzel@domonet.de
Posts: 97
Joined: Tue Mar 01, 2016 11:50 am
Location: Germany

SQLtable & MySql: Problem with Seek & Assign

Post by g.bunzel@domonet.de »

Gianluca,

in your 'OrderBy()' you use a Symbol as argument:
oDBArticok:OrderBy( #CODICE )

In the VO helpfile, these arguments should be strings:
Syntax
<oSQLTable>:OrderBy(<cOrder> [, <cOrder>]) ---> NIL

Arguments
<cOrder> [, <cOrder>]

The list of strings comprising the ORDER BY clause. The list will be concatenated, separated by commas. The strings can contain any valid ORDER BY syntax that is accepted by the driver, including ASC and DESC keywords.


Edit my message - Had a look at the SDK:
OrderBy() is also working with Symbols:

cOrder := NULL_STRING
// any parameters?
IF ( PCount() != 0 )
FOR wCount:=1 UPTO PCount()
cOrder += cSeparator + __GetSymString( _GETMPARAM( wCount ) )
cSeparator := ","
NEXT
ENDIF


Gerhard
Jamal
Posts: 323
Joined: Mon Jul 03, 2017 7:02 pm

SQLtable & MySql: Problem with Seek & Assign

Post by Jamal »

Gianluca,

I am not sure about the SqlTable behavior, but from what I know that the SQL engine utilizes indexes if they exist in the select statement ORDER BY; so there is no need for SQLTable:OrderBY() method.
Instead of SetRelation, the SELECT with JOIN statement is more powerful.
This is much easier in .NET.


Jamal
ic2
Posts: 1862
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

SQLtable & MySql: Problem with Seek & Assign

Post by ic2 »

This may be totally unrelated, but:

I recently used UNION in VO for a quite complicated set of statements, used via ADS, and UNION failed with unpredictable while I couldn't see anything wrong. Eventually I gave up and used a very long SELECT query with 5 or's in it. Not only it worked but it was many times faster than a DO WHILE loop and/or filter in 'normal' VO/ADS would be.

So I'd try a JOIN but should the result be illogical too then it may be not your fault.

Dick
User avatar
gianluca.pinoli
Posts: 36
Joined: Mon Nov 02, 2015 1:13 pm
Location: Italy

SQLtable & MySql: Problem with Seek & Assign

Post by gianluca.pinoli »

Hi,
I know that the best way is to migrate to SQL (and this is my goal), but i was investigating a shortcut to replace DBF with MySQL without relevant code modification.
SQLTable/SQLSelect seem not to be the best way for me, so i'll continue with my previos way, editing every single function/method
Thanks to all

Gianluca
Post Reply