Template. fbbase in codebuilder is a basic template based on XML syntax. It consists of defkeys, functions, parts, and sections.
Code
<? XML version = "1.0" encoding = "UTF-8" ?>
<! -- This file is defined by faib studio and Version 1.0 -->
<! --
Language: The generatedCodeLanguage SQL | csharptext and so on
Convert: data type conversion dictionary Configuration
-->
< Config Name = "Generate MSSQL scripts" Language = "SQL" Convert = "Csconvert. config" >
<! -- Defines some constants. These constants are also referenced using $ key $. -->
< Defkeys >
< Key Name = "Author" > Faib </ Key >
</ Defkeys >
<! --
Define some external functions
Language: The Language type of the code file CSHARP | vbasic
File: code file
-->
< Functions >
< Function Name = "Columnsql" Language = "CSHARP" File = "Code \ sqlcolumn. cs" />
</ Functions >
<! -- Structure: Parts \ part \ sections \ Section -->
<! -- Note the definition of the Call Sequence -->
< Parts >
< Part Name = "SQL" File = "Design \ create. SQL" Loop = "NONE" >
< Sections >
< Section Name = "Tablecreate" Loop = "Tables" >
< Sections >
< Section Name = "Columnarray" Loop = "Columns" Endchar = "," >
[$ Columnname $] $ getcolumnsql () $ </ Section >
< Section Name = "Columdescript" Loop = "Columns" >
<! [CDATA [ $ Addcolumndescription () $
Go
]>
</ Section >
< Section Name = "Primarycreate" Loop = "Primarykeys" >
<! [CDATA [ Alter table $ tablename $
Add constraint pK _ $ tablename $ _ $ columnname $ primary key ($ columnname $)
Go
]>
</ Section >
</ Sections >
< Body >
<! [CDATA [
Create Table [$ tablename $] ($ columnarray $
)
Go
$ Primarycreate $
-- Region add description
$ Addtabledescription () $
Go
$ Columdescript $
-- Endregion
]>
</ Body >
</ Section >
< Section Name = "Referencedelete" Loop = "Tables" >
< Sections >
< Section Name = "Referencedelete1" Loop = "Refobjects" >
<! [CDATA [ If exists (select 1
From sysobjects
Where id = object_id ('fk _ $ fktablename $ _ $ pktablename $ ')
And type = 'F ')
Alter table $ fktablename $
Drop constraint FK _ $ fktablename $ _ $ pktablename $
Go
]>
</ Section >
</ Sections >
< Body >
<! [CDATA [ $ Referencedelete1 $ ]>
</ Body >
</ Section >
< Section Name = "Referencecreate" Loop = "Tables" >
< Sections >
< Section Name = "Referencecreate1" Loop = "Refobjects" >
<! [CDATA [ Alter table $ fktablename $
Add constraint FK _ $ fktablename $ _ $ pktablename $ foreign key ($ fkcolumnname $)
References $ pktablename $ ($ pkcolumnname $)
Go
]>
</ Section >
</ Sections >
< Body >
<! [CDATA [ $ Referencecreate1 $ ]>
</ Body >
</ Section >
< Section Name = "Tabledelete" Loop = "Tables" >
<! [CDATA [
If exists (select 1
From sysobjects
Where id = object_id ('$ tablename $ ')
And type = 'U ')
Drop table [$ tablename $]
Go
]>
</ Section >
</ Sections >
< Body >
<! [CDATA [
-- ===================================================== ======================
-- This script is generated by the codebuilder tool.
-- Copyright: (c) faib studio 2009
--
-- Creator: $ author $
-- Creation Time: $ now $
-- ===================================================== ======================
-- Region
$ Referencedelete $
-- End region
-- Region: delete a table
$ Tabledelete $
-- End region
-- Region
$ Tablecreate $
-- End region
-- Region
$ Referencecreate $
-- End region
]>
</Body>
</Part>
</Parts>
</Config>