Thanks Martijn, that works perfectly. I've added some code for anyone
who finds this useful. This extracts the domain name and the
corresponding values. This can then be used anywhere; Delphi, C++ etc.
with a 'Select * from domain_extract'
create or alter procedure domain_extract
returns (
domain_name char(93),
check_values varchar(80))
as
begin
for
select r.RDB$FIELD_NAME,
substr (r.RDB$VALIDATION_SOURCE,position('value in
(',r.RDB$VALIDATION_SOURCE)+9,30)
from RDB$FIELDS r
where r.RDB$VALIDATION_SOURCE is not null
into :domain_name,
:check_values
do
suspend;
end
DOMAIN_NAME CHECK_VALUES
NO_YES ('Y','N'))
SHOP_LOCATION ('W','H'))
TICKET ('W','D','S'))
Alan J Davies
Aldis
On 08/08/2014 18:35, 'Martijn Tonies (Upscene Productions)'
[email protected] [firebird-support] wrote:
> Hello Alan,
>
> The domain check constraint is available, however, it is a custom
> written check constraint, like for example:
>
> CREATE DOMAIN ...
> CHECK (
> VALUE IN ('Y', 'N')
> )
>
> This source can be found in the system tables, table RDB$FIELDS
> column RDB$VALIDATION_SOURCE
>
> With regards,
>
> Martijn Tonies
> Upscene Productions
> http://www.upscene.com
>
> Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
> Anywhere, MySQL, InterBase, NexusDB and Firebird!
>
> Hi, can anyone help me with the following please?
> As an example, I have a domain - YES_NO - with strangely enough only Y
> or N acceptable as input.
> I then use this domain in various tables.
> In Delphi I then check if 'Y' or 'N' is entered before trying to write
> to the database. Yes, I know the write will fail but I want to inform
> the user immediately on exit from the entry, rather than when getting to
> the final stage of data-entry, say clicking OK.
> Instead of hard-coding (paraphrasing) "If entry is not in 'Y','N' try
> again", can I get the domain and the domain constraints available to me
> with some sql code? Such as "If entry is not in YES_NO.CHECK try again"
> substituting the real values....
>
> I hope I've explained this.
>
> Alan J Davies
> Aldis
>
>
------------------------------------
------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu. Try FAQ and other links from the left-side menu there.
Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo Groups is subject to:
https://info.yahoo.com/legal/us/yahoo/utos/terms/