V4RB - DB method that evaluates type of expression
erne
ernestogiannotta at tiscalinet.it
Wed Jul 6 12:07:24 CDT 2005
Hi Ruslan,
thanks for listening,
on 6-07-2005 8:46, Ruslan Zasukhin at sunshine at public.kherson.ua wrote:
> On 7/6/05 1:48 AM, "Erne" <ernestogiannotta at tiscalinet.it> wrote:
>
> Hi Erne,
>
> Have you note that actually functions of Valentina can return result in any
> type?
>
> Yes, on default, RETURN TYPE of "Month(TableClients.Birthday)" is INT.
>
> But you still can ask it as string,
>
> CreateStringField( "a", 50, "Month(TableClients.Birthday)" )
>
> And this will work.
> Or use that result as argument for next sting function, e.g. Concat()
>
> So I do not see yet what task you can solve using this new function
>
very true!
so, I can also ask to SQL either
Select * from TableClients where Month(TableClients.Birthday) = 3
Select * from TableClients where Month(TableClients.Birthday) = "3"
and get away with both? I love that :!)
Cool Runnings,
Erne.
>
>> Hello Valentina Team,
>>
>> I'd like to have a function in a Valentina Database Object
>> that I can pass an expression to and get the type of data returned by
>> that expression
>>
>> it's like asking for a field Type property, but applied to an expression
>>
>> e.g.
>> I call the function (let's call it DataType(expression)):
>>
>> iType = mDB.DataType("Concat(TableClients.Name, TableClients.Age)")
>>
>> and I get a EVDataType.kTypeString value
>> (yep! EVDataType is a brand new set of enum constants)
>>
>> or
>>
>> iType = mDB.DataType("Month(TableClients.Birthday)")
>>
>> and I get a EVDataType.kTypeInteger value
>>
>> of course a vException error code should be returned
>> if the expression is wrong and can't be evaluated
>> (just as it does now when we try to pass a wrong expression to a
>> MethodField)
>>
>>
>>
>> this could be useful for many things
>> like creating abstract query classes
>> pass them parameters as variants
>> and let them build a proper SQL query expression
>>
>> What do you think, feed it to Mantis :?)
--
| e r | Ernesto Giannotta
| n e | Musical Box - a media store
More information about the Valentina-beta
mailing list