Maximum Length of any Field

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Nov 12 13:55:04 CST 2003


on 11/12/03 1:45 PM, Peter De Berdt at peter.de.berdt at pandora.be wrote:

>> First of all, Valentina 1.x do not support functions in SQL query directly,
>> Only in BaseObject methods.
> 
> 
> Bummer, this would mean I'd have to create an extra field with a
> BaseObject method for about every field used throughout the database
> (the user can define the columns he wants to see). But then I would
> be able to do:
> 
> "SELECT LENGTHField,Field FROM MyTable ORDER BY LENGTHField DESC" and
> take the first record to obtain the longest string in my Table? Would
> this have a serious speed impact (as the BaseObject method will
> probably execute when querying it)?
> 
> Am I right here?
> 
>> 
>> In any case your function is not right!
>> 
>> MAX -- must be used with GROUP BY only.
> 
> 
> OK, point taken.
> 
>> 
>> LENGTH -- returns real length of current value, but not MaxLenght of field
>> as this is specified in structure Table. BTW, may be it is good idea add
>> such functions.
> 
> That's what I intended to do: knowing the maximum of all the real
> length values (how long is the longest string entered by a user, so
> that even if a field can hold up to 1500 characters, if the longest
> string is only 300 chars, I need the stringwidth of 300 characters,
> not 1500).

Peter,

Once again. Right now Valentina do NOT provide function that all in SQL
query define max length of column.

As as far as I know any other DB also do not do this.

For numeric fields, you simple should use constants.

For string fields you need simply do

    cursor.StringField("myStringField").maxLength
    cursor.VarCharField("myStringField").maxLength


I.e. You simply ask String or VarChar field about its maxLen.

MaxLen is value that you have specify when did create that field
E.g. String[70]


For TEXT field THERE is no WAY define max length. It can be unlimited.

You see?


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list