[V4REV] VTable_SortN syntax discussed.

Ivan Smahin IvanSmahin at public.kherson.ua
Sun Jun 12 18:01:52 CDT 2005


Hello Robert,

Sunday, June 12, 2005, 5:34:43 PM, you wrote:

RB> 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,

RB> Are you saying that this function will sort record in the database
RB> 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.
>>

RB> What you wrote here is different than what Ivan wrote earlier. And

Just we are looking for solution which is suitable for
revolution world.

Ruslan have told about third way.
So

3. put VTable_SortN( t1, Set1, "f1, f2 kDesc, f3" ) into SortedSet

All sorted info placed in the single string.


RB> from point of view of Rev, the last two function calls are different:
RB> the first has min 3 but unlimited number of params (well, limited by
RB> number of fields), the second has exactly 3 parameters.


We could do reasonable number of params - 4-5 for example ( for case of 1-2 issues ).
I don't think that unlimited pairs count is very useful in real world.



-- 
Best regards,
 Ivan                            mailto:IvanSmahin at public.kherson.ua



More information about the Valentina-beta mailing list