📄 gui_tsqlcode.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
<TITLE>LLBLGen::GUI: T-SQL Code tab</TITLE>
<link rel="STYLESHEET" type="text/css" href="general.css">
</HEAD>
<BODY>
<br>
<h3>LLBLGen::GUI: T-SQL Code tab</h3>
<br>
<p align="center">
<img src="sshot_tsql.gif" border="0">
<p class="SmallFontREF" align="center">
<b>The T-SQL code tab.</b>
</p>
</p>
<p>
LLBLGen's T-SQL code generator for the stored procedures uses the settings on this tab. LLBLGen will depend which
.NET Code methods to generate on which features are selected here, since generating code that calls non-existing
stored procedures isn't that necessary.
<br><br>
<b class="SmallHdr">The tab's controls and their meaning</b><br>
<ul>
<li><b>Generate Select SPs</b>. <br>Checking this box will force LLBLGen to generate for each table a SelectOne
stored procedure and, if possible, for each field in that table which has a UNIQUE constraint a
SelectOneW<i>UniqueField</i>Logic stored procedure.
See <a href="codestructure_tsql.htm">Structure of T-SQL code</a> for details about these stored procedures.</li>
<li><b>Generate Update SPs</b>. <br>Checking this box will force LLBLGen to generate for each table an Update Stored procedure
and UpdateAllW<i>ForeignKeyField</i>Logic stored procedures.
Updating Foreign Key fields will use two property values for the same
field. Say 'Bar' is a Foreign Key in the table 'Foo'. LLBLGen will generate the stored procedure
pr_Foo_UpdateAllWBarLogic (no, not the logic used in your favorite bar! ;))
which will be called by method UpdateAllWBarLogic, located in the class Foo, which will use two properties:
Bar and BarOld. The values of these properties are passed to the stored procedure pr_Foo_UpdateAllWBarLogic
so that this stored procedure will
update all rows in Foo with the value of the property 'Bar' for the field 'Bar' which have the value of the
property 'Bar' for the field 'Bar'. Simply put: reset the field Bar with the value of property 'Bar' for all
rows which have the value of the property 'BarOld' for the field 'Bar'.
See <a href="codestructure_tsql.htm">Structure of T-SQL code</a> for details about these stored procedures.</li>
<li><b>Generate Delete SPs</b>. <br>Checking this box will force LLBLGen to generate for each table a Delete stored
procedure and DeleteAllW<i>PrimaryKeyField</i>Logic stored procedures.
Example: The table 'DepartmentEmployees' has a Primary Key of
two fields: DepartmentID and EmployeeID. When an employee leaves, you can delete all rows of that employee with
ID EmployeeID from the table DepartmentEmployees calling the method DeleteAllWEmployeeIDLogic in the class for the table
DepartmentEmployees, passing the EmployeeID value for that particular employee to the property of the EmployeeID
field. LLBLGen will not generate DeleteAllWPrimaryKeyLogic stored procedures when the Primary Key has just one
field or no fields at all.
See <a href="codestructure_tsql.htm">Structure of T-SQL code</a> for details about these stored procedures.</li>
<li><b>Generate Insert SPs</b>. <br>Checking this box will force LLBLGen to generate for each table and view an Insert stored
procedure which will insert one single new row into the table or view (which in fact stores a new row in the
tables where the view is constructed from), using the values of the properties in the .NET
class. When an Identity field is found in the table, the new value is returned in the property of that field.
See <a href="codestructure_tsql.htm">Structure of T-SQL code</a> for details about these stored procedures.</li>
<li><b>Generate SelectAll SPs</b>. <br>Checking this box will force LLBLGen to generate for each table and view a SelectAll
stored procedure and for each Foreign Key found in the table a SelectAllW<i>ForeignKeyField</i>Logic stored procedure.
See <a href="codestructure_tsql.htm">Structure of T-SQL code</a> for details about these stored procedures.</li>
<li><b>Include ErrorCode</b>. <br>Checking this box will force LLBLGen to generate in each generated stored procedure the
output parameter ErrorCode, which will contain the value of @@ERROR after the code in the stored procedure was
executed. When checked, all methods generated will have a check on this output parameter: if the returned value
is not equal to LLBLError.AllOk (which is 0, i.e. no errors), an exception will be thrown. It's recommended you
check this box, because it will allow you to extend the stored procedures with extra code which then can return
custom error values to the data-access tier and calling tiers as well, without having to change the data-access
tier code nor the interfaces of the stored procedures. </li>
<li><b>Prefix Parameters</b>. <br>Checking this box will result in type prefixed T-SQL Parameters, thus will force LLBLGen
to generate T-SQL using hungarian coding style. See
<a href="ref_types.htm">SQLServer, .NET type relations</a> for the list of type prefixes.</li>
<li><b>Include drops</b>. Checking this box will result in extra code for each generated stored procedure that will
first drop a current version of that same stored procedure if that stored procedure is already present in the
database, same like the code Enterprise Manager will generate for you when you select the similar option when generating
SQL script.</li>
<li><b>Include comments</b>. <br>Checking this box will make LLBLGen generate T-SQL comment statements about the stored
procedure and the passed parameters, plus the returned parameters. Highly recommended.</li>
<li><b>Include NOCOUNT</b>. <br>Checking this box will result in the inclusion of 'SET NOCOUNT ON' statements to each
generated stored procedure. When you don't care about how many rows were affected by the stored procedure (most
developers don't care) check this box, because it will speed up the execution of the generated stored
procedure. </li>
<li><b>Stored Procedure Name Prefix</b>. <br>Specify here the prefix LLBLGen will use to prefix stored procedures.
The default is 'pr_'. You should avoid using 'sp_' since this will make SQLServer check for the presents
of the stored procedure in the Master database first, which will slow down execution.</li>
<li><b>Select clause specification format: SELECT * FROM Table</b>. First option in a radiobutton group about the
select clause specification format. When selecting this option, LLBLGen will generate all select stored procedures
(that is: the SelectOne, SelectOneWUniqueFieldLogic, SelectAll and the SelectAllWForeignKeyFieldLogic stored procedures)
using the SELECT * FROM Table method. This method is handy when you are modifying fieldnames etc. often, but is slower
than the other method.</li>
<li><b>Select clause specification format: SELECT field1, field2, ... FROM Table</b>.<br>
Second option in a radiobutton group about the
select clause specification format. When selecting this option, LLBLGen will generate all select stored procedures
(that is: the SelectOne, SelectOneWUniqueFieldLogic, SelectAll and the SelectAllWForeignKeyFieldLogic stored procedures)
using the SELECT field1, field2 FROM Table method. This method is the preferred choice for most applications, since
it's the fastest way to select data from SQLServer.</li>
<li><b>Excluded fields in update/insert queries</b>. <br>By clicking <i>Refresh</i>, all fields from the selected tables
and views on the Tables / Views tab, will be loaded into the list for the Excluded fields. You can now select
which fields should be excluded in the parameter list for Insert and Update stored procedures by clicking the checkbox
in front of each field. A checked field is marked as 'Excluded'. These fields will still be
filled with a value in Update and Insert stored procedures, but the value will be the default value for the
T-SQL type of the field, from the list LLBLGen holds for each SQLServer type, if the field doesn't have a
default value defined, <i>or</i> the default value defined in SQLServer for the given field is used. See:
<a href="ref_types.htm">SqlServer, .NET type relations</a>, for details about which value will be chosen for
which field type. The exclusion of some fields is handy when you have f.e. ChangeDate fields in records. You
can now exclude these fields from the list of parameters that will be passed to the stored procedures
and the stored procedures themselves will take care of the correct value that will be put into these
fields. When a field is selected for exclusion, it's excluded for all tables. You shouldn't exclude
fields of type 'timestamp', since these are never updated manually anyway.</li>
</ul>
</p>
<div align="right" class="SmallFontTOC">
<hr size="1" width="60%" align="right">
LLBLGen v1.2 documentation. © 2002 <a href="http://www.sd.nl/" target="_blank">Solutions Design</a>
</div>
<br><br>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -