Re: Variable-length Types

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Variable-length Types
Дата
Msg-id 39EA4E56.CAD35C88@agliodbs.com
обсуждение исходный текст
Ответ на Variable-length Types  (Itai Zukerman <zukerman@math-hat.com>)
Ответы Re: Variable-length Types  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-sql
KuroiNeko,

>  I remember from  the old days of Delphi/InterBase, and  even older days of
> Paradox, there were so called input masks, US phone code mask would be like

Input masks still exist for some languages (VB, Paradox) but I've found
that even in those platforms that support them I tend to replace them
with custom functions, because actually using them is too buggy.

>  I'm just not sure what to do if 8 or 9 digits are supplied? Maybe, reject,
> assuming that  such things should  be caught  by UI, and  if we get  such a
> weird thing, there's something really really wrong?

Or, if you're using an interface that doesn't readily support entry
validation (e.g. PHP) then you can nest functions and have the "Save"
button test for a reply indicating that something's wrong.

To wit:

Create Function save_candidate (Lots of candidate data variables) RETURNS VARCHAR (100)
ASDeclare output_string VARCHAR(100)Do a whole bunch of stuffSELECT first_phone = phoneformat(first_phone)IF
first_phone= 'fail' (    SELECT output_string = 'Bad phone number for Primary Phone'    RETURN output_string    )More
code

-Josh

-- 
______AGLIO DATABASE SOLUTIONS___________________________                                       Josh Berkus  Complete
informationtechnology      josh@agliodbs.com   and data management solutions       (415) 436-9166  for law firms, small
businesses      fax  436-0137   and non-profit organizations.       pager 338-4078                               San
Francisco


В списке pgsql-sql по дате отправления:

Предыдущее
От: KuroiNeko
Дата:
Сообщение: Re: Variable-length Types
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Variable-length Types