[V4REV] VTable_SortN syntax discussed.

Robert Brenstein rjb at robelko.com
Sun Jun 12 16:34:43 CDT 2005


Should not this discussion be moved to beta list?

>
>>>      We are going to have VTable_SortN method in order to support
>>>  multiple-fields
>>>      table sorting.
>>
>>  You mean this will allow us to resort an existing cursor? But then
>>  may be not since it has tableRef not cursorRef.
>
>NO, this is for API way which do not use cursors at all,

Are you saying that this function will sort record in the database 
itself? I think I do not get the big picture of the API changes.


>  >>     What do you think - how params should be looked?
>  >>
>>>      1.
>>>      put VTable_SortN(
>>>                       tblRef,
>>>                       setRef,
>>>                       fld1, inBoolAscending1,
>>>                       [ fld2, inBoolAscending2,
>>>                         fld3, inBoolAscending3,
>>>                         fld4, inBoolAscending4 ] ) INTO ArraySetRef
>>>
>>>      Example:
>>>              put VTable_SortN( t1,allSet, f1, true, f2, false )
>>>
>>>      2.
>>>      put VTable_SortN(
>>>                       tblRef,
>>>                       setRef,
>>>                       "fld1 inBoolAscending1",
>>>                       [ "fld2 [inBoolAscending2 = true]",
>>>                         "fld3 [inBoolAscending3 = true]",
>>>                         "fld4 [inBoolAscending4 = true]" ] ) INTO 
>>>ArraySetRef
>>>
>>>      Example:
>>>              put VTable_SortN( t1,allSet, f1, "f2 false" )
>>>
>>
>>  #2 will surely be source of errors. Don't like it at all. But without
>>  fully understanding what this function does, I am not sure whether
>>  there is a better syntax than your #1.
>
>You have TableRef and some SET of records for this table.
>You want sort this set by one or two or three or more fields.
>
>In SQL we use
>     ORDER BY f1, f2 DESC, f3, f4
>
>In API we can do
>
>  put VTable_SortN( t1, Set1, f1, kAsc, f2 kDesc, f3 kAsc ) into SortedSet
>
>Or using strings -- style of Revolution
>
>  put VTable_SortN( t1, Set1, "f1, f2 kDesc, f3" ) into SortedSet
>
>
>In second case we have single last param,
>and V4REV should self parse string,
>and it looks we can avoid writing of kAsc.
>

What you wrote here is different than what Ivan wrote earlier. And 
from point of view of Rev, the last two function calls are different: 
the first has min 3 but unlimited number of params (well, limited by 
number of fields), the second has exactly 3 parameters.

Robert


More information about the Valentina mailing list