> I appreciate that this has been asked and answered over on Stack Overflow and > possibly here as well (but I couldn't find it), but my query is slightly > different. > > What do people consider to be 'best practice' with regard to domains? > > Should I create a domain for each datatype I use or just let Firebird create > defaults for me? > > Why does Firebird create a different default domain for each column even with > the same data types? For example if I have two columns, both INTs, both allow > NULL, both no default value, I would still end up with two default domains. > Should I create a domain called INT_NULL_NODEFAULT and use that wherever I > need an INT column?
I use user-defined domains whenever I can, because it makes your field data types more readable and your database won't get bloated with system-defined (RDB$...) domain names. I have both, domains with just the based simple datatype in its name, e.g.: D_INT D_NUMERIC_15_2 which are NOT NULL in naming convention or their nullable counterparts: D_INT_NULL D_NUMERIC_15_2_NULL using NULL as domain name prefix. The second approach is to put semantic into the domain name, e.g.: D_ZIP_CODE D_FIRSTNAME etc ... Or have special domains for primary/foreign key columns, e.g.: D_PK D_FK D_FK_NULL Hope this helps. -- With regards, Thomas Steinmaurer Upscene Productions http://www.upscene.com http://blog.upscene.com/thomas/ Download LogManager Series, FB TraceManager today! Continuous Database Monitoring Solutions supporting Firebird, InterBase, Advantage Database, MS SQL Server and NexusDB!
