Datei: NDOInterfaces/ISqlGenerator.cs
Last Commit (2a2e7ba)
1 | // |
2 | // Copyright (c) 2002-2019 Mirko Matytschak |
3 | // (www.netdataobjects.de) |
4 | // |
5 | // Author: Mirko Matytschak |
6 | // |
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
8 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation |
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
10 | // Software, and to permit persons to whom the Software is furnished to do so, subject to the following |
11 | // conditions: |
12 | |
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions |
14 | // of the Software. |
15 | // |
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. |
21 | |
22 | |
23 | using System; |
24 | using System.Data; |
25 | |
26 | namespace NDOInterfaces |
27 | { |
28 | ····/// <summary> |
29 | ····/// Determines, where the primary key constraint is located in the DDL code. |
30 | ····/// </summary> |
31 | ····public enum PrimaryConstraintPlacement |
32 | ····{ |
33 | ········/// <summary> |
34 | ········/// PK constraint is located at the end of a column definition. |
35 | ········/// </summary> |
36 | ········InColumn, |
37 | ········/// <summary> |
38 | ········/// PK constraint is located like a row in the table definition. |
39 | ········/// This is standard and the case for most databases. |
40 | ········/// </summary> |
41 | ········InTable, |
42 | ········/// <summary> |
43 | ········/// PK constraint is located after the table definition. This can be used |
44 | ········/// to create the constraint with ALTER TABLE statements. |
45 | ········/// </summary> |
46 | ········AfterTable |
47 | ····} |
48 | |
49 | ····/// <summary> |
50 | ····/// This interface is used to write DDL language providers. |
51 | ····/// </summary> |
52 | ····public interface ISqlGenerator |
53 | ····{ |
54 | ········/// <summary> |
55 | ········/// Gets the name of the NDO provider, which should be used to generate the table and column names. |
56 | ········/// </summary> |
57 | ········string ProviderName |
58 | ········{ |
59 | ············get ; |
60 | ········} |
61 | |
62 | ········/// <summary> |
63 | ········/// This is used by the enhancer to get and set the ndo provider, the generator belongs to. |
64 | ········/// </summary> |
65 | ········IProvider Provider |
66 | ········{ |
67 | ············get; set; |
68 | ········} |
69 | |
70 | ········/// <summary> |
71 | ········/// Sets the message adapter object, where warnings and error messages are written to. |
72 | ········/// </summary> |
73 | ········/// <param name="messages">The message adapter object.</param> |
74 | ········void SetMessageAdapter(IMessageAdapter messages); |
75 | |
76 | ········/// <summary> |
77 | ········/// Statements to delete a table before it is newly created. |
78 | ········/// </summary> |
79 | ········/// <param name="tableName">Name of the table.</param> |
80 | ········/// <returns>A DDL string</returns> |
81 | ········string DropTable(string tableName); |
82 | |
83 | ········/// <summary> |
84 | ········/// Any statements necessary, before a table description begins. |
85 | ········/// </summary> |
86 | ········/// <param name="connectionString">Connection string, corresponding to the class, |
87 | ········/// for which a table is to be constructed.</param> |
88 | ········/// <returns>A DDL string.</returns> |
89 | ········string ConnectToDatabase(string connectionString); |
90 | |
91 | ········/// <summary> |
92 | ········/// Code to start a table description. |
93 | ········/// </summary> |
94 | ········/// <param name="tableName">Qualified name of the table.</param> |
95 | ········/// <returns>A DDL string.</returns> |
96 | ········/// <remarks>After this code the column descriptions are placed.</remarks> |
97 | ········string BeginnTable(string tableName); |
98 | |
99 | ········/// <summary> |
100 | ········/// Code to end a table description. |
101 | ········/// </summary> |
102 | ········/// <param name="tableName">Qualified name of the table.</param> |
103 | ········/// <returns>A DDL string.</returns> |
104 | ········string EndTable(string tableName); |
105 | |
106 | ········/// <summary> |
107 | ········/// Determines, where the primary key constraint must be placed. |
108 | ········/// </summary> |
109 | ········PrimaryConstraintPlacement PrimaryConstraintPlacement |
110 | ········{ |
111 | ············get ; |
112 | ········} |
113 | |
114 | ········/// <summary> |
115 | ········/// Determines, if a field length may be placed in the DDL. |
116 | ········/// </summary> |
117 | ········/// <param name="t">Sytem.Type for which the column is to be prepared.</param> |
118 | ········/// <returns>True, if a field length can be placed in the DDL.</returns> |
119 | ········bool LengthAllowed(Type t); |
120 | |
121 | ········/// <summary> |
122 | ········/// Determines, if a field length may be placed in the DDL. |
123 | ········/// </summary> |
124 | ········/// <param name="dbType">A database specific column type name.</param> |
125 | ········/// <returns>True, if a field length can be placed in the DDL.</returns> |
126 | ········bool LengthAllowed(string dbType); |
127 | |
128 | |
129 | ········/// <summary> |
130 | ········/// Maps a certain System.Type to a database specific column type |
131 | ········/// </summary> |
132 | ········/// <param name="t">The System.Type to convert.</param> |
133 | ········/// <param name="size">The intended size of the type. If type is string, the value -1 means, that a CLOB type should be returned.</param> |
134 | ········/// <returns>A type string</returns> |
135 | ········string DbTypeFromType(Type t, int size = 0); |
136 | |
137 | ········/// <summary> |
138 | ········/// DDL for auto increment columns. |
139 | ········/// </summary> |
140 | ········/// <returns>A DDL string</returns> |
141 | string AutoIncrementColumn( string columnName, Type dataType, string columnType, string width) ; |
142 | |
143 | ········/// <summary> |
144 | ········/// DDL for primary key columns, which are not autoincremented. |
145 | ········/// </summary> |
146 | ········/// <remarks> |
147 | ········/// A DDL generator should implement this function, |
148 | ········/// if PrimaryConstraintPlacement has the value InColumn. |
149 | ········/// </remarks> |
150 | ········string PrimaryKeyColumn(string columnName, Type dataType, string columnType, string width); |
151 | |
152 | ········/// <summary> |
153 | ········/// True, if the column DDL syntax of a primary key column is different |
154 | ········/// to the DDL of an ordinary column. |
155 | ········/// </summary> |
156 | ········bool HasSpecialAutoIncrementColumnFormat |
157 | ········{ |
158 | ············get ; |
159 | ········} |
160 | |
161 | ········/// <summary> |
162 | ········/// Creates the DDL for creating primary key constraints. |
163 | ········/// </summary> |
164 | ········/// <param name="primaryKeyColumns">All columns, building the primary key.</param> |
165 | ········/// <param name="constraintName">Name of the constraint.</param> |
166 | ········/// <param name="tableName">Qualified name of the table.</param> |
167 | ········/// <returns>A DDL string.</returns> |
168 | ········string CreatePrimaryKeyConstraint(DataColumn[] primaryKeyColumns, string constraintName, string tableName); |
169 | |
170 | ········/// <summary> |
171 | ········/// Creates the DDL for creating foreign key constraints. |
172 | ········/// </summary> |
173 | ········/// <param name="sourceColumns">Colums, building the foreign Key in the current table.</param> |
174 | ········/// <param name="relatedColumns">Primary key columns, to which the source columns relate.</param> |
175 | ········/// <param name="constraintName">Name of the constraint.</param> |
176 | ········/// <param name="relatedTableName">Name of the related table.</param> |
177 | ········/// <returns>A DDL string.</returns> |
178 | ········string CreateForeignKeyConstraint(DataColumn[] sourceColumns, DataColumn[] relatedColumns, string constraintName, string relatedTableName); |
179 | |
180 | |
181 | ········/// <summary> |
182 | ········/// Writes an expression, which determines, whether a column allows NULL values. |
183 | ········/// </summary> |
184 | ········/// <param name="allowNull">If true, the column should allow null values, otherwise not.</param> |
185 | ········/// <returns>A DDL string.</returns> |
186 | ········string NullExpression(bool allowNull); |
187 | |
188 | |
189 | ········/// <summary> |
190 | ········/// Creates an index in the database. |
191 | ········/// </summary> |
192 | ········/// <param name="indexName">Name of the index.</param> |
193 | ········/// <param name="tableName">Name of the owning table.</param> |
194 | ········/// <param name="indexColums">An array of DataColumn objects which denotes the columns to be indexed.</param> |
195 | ········/// <returns></returns> |
196 | ········string CreateIndex(string indexName, string tableName, DataColumn[] indexColums); |
197 | |
198 | ········/// <summary> |
199 | ········/// Creates the part of a Alter Table statement, which adds a column. NDO will add the type |
200 | ········/// and Null/Non Null expressions. |
201 | ········/// </summary> |
202 | ········/// <returns>A DDL string.</returns> |
203 | ········/// <remarks> |
204 | ········/// Here is an Expample: |
205 | ········/// <code> |
206 | ········/// -- The next line will be generated by NDO |
207 | ········/// ALTER Table myTable |
208 | ········/// -- The next line should be generated by AddColumn |
209 | ········/// ADD COLUMN |
210 | ········/// -- The next line will be generated by NDO (it's exacly a column definition). |
211 | ········/// myColumn INTEGER NOT NULL; |
212 | ········/// </code> |
213 | ········/// </remarks> |
214 | ········string AddColumn(); |
215 | |
216 | ········/// <summary> |
217 | ········/// Creates the part of a Alter Table statement, which drops a column. |
218 | ········/// </summary> |
219 | ········/// <param name="colName">Name of the column to be dropped.</param> |
220 | ········/// <returns>A DDL string.</returns> |
221 | ········/// <remarks> |
222 | ········/// Here is an Expample: |
223 | ········/// <code> |
224 | ········/// -- The next line will be generated by NDO |
225 | ········/// ALTER Table myTable |
226 | ········/// -- The next line should be generated by RemoveColumn |
227 | ········/// DROP myColumn |
228 | ········/// -- The next line will be generated by NDO |
229 | ········/// ; |
230 | ········/// </code> |
231 | ········/// </remarks> |
232 | ········string RemoveColumn(string colName); |
233 | |
234 | ········/// <summary> |
235 | ········/// Creates the part of a Alter Table statement, which renames a column.········ |
236 | ········/// </summary> |
237 | ········/// <param name="tableName">Name table to be altered.</param> |
238 | ········/// <param name="oldName">Name of the column to be renamed.</param> |
239 | ········/// <param name="newName">New name of the column.</param> |
240 | ········/// <param name="typeName">An expression like 'CHAR(200) NOT NULL'.</param> |
241 | ········/// <returns>A DDL string.</returns> |
242 | ········/// <remarks> |
243 | ········/// Here is an Expample: |
244 | ········/// <code> |
245 | ········/// -- All lines should be generated by RenameColumn |
246 | ········/// ALTER Table myTable |
247 | ········///·· ALTER oldName TO newName |
248 | ········/// </code> |
249 | ········/// If RenameColumn returns an empty string, NDO tries to synthesize the rename function |
250 | ········/// with a sequence of ADD COLUMN, UPDATE and DROP COLUMN statements. |
251 | ········/// </remarks> |
252 | ········string RenameColumn(string tableName, string oldName, string newName, string typeName); |
253 | |
254 | ········/// <summary> |
255 | ········/// Creates the part of a Alter Table statement, which changes a column type. NDO will add the type |
256 | ········/// and Null/Non Null expressions. |
257 | ········/// </summary> |
258 | ········/// <returns>A DDL string.</returns> |
259 | ········/// <remarks> |
260 | ········/// Here is an Expample: |
261 | ········/// <code> |
262 | ········/// -- The next line will be generated by NDO |
263 | ········/// ALTER Table myTable |
264 | ········/// -- The next line should be generated by AlterColumnType |
265 | ········/// ALTER COLUMN |
266 | ········/// -- The next line will be generated by NDO (it's exacly a column definition) |
267 | ········/// myColumn nvarchar(255) NOT NULL; |
268 | ········/// </code> |
269 | ········/// </remarks> |
270 | ········string AlterColumnType(); |
271 | |
272 | |
273 | ····} |
274 | } |
275 |
New Commit (1e68dc7)
1 | // |
2 | // Copyright (c) 2002-2019 Mirko Matytschak |
3 | // (www.netdataobjects.de) |
4 | // |
5 | // Author: Mirko Matytschak |
6 | // |
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
8 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation |
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
10 | // Software, and to permit persons to whom the Software is furnished to do so, subject to the following |
11 | // conditions: |
12 | |
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions |
14 | // of the Software. |
15 | // |
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. |
21 | |
22 | |
23 | using System; |
24 | using System.Data; |
25 | |
26 | namespace NDOInterfaces |
27 | { |
28 | ····/// <summary> |
29 | ····/// Determines, where the primary key constraint is located in the DDL code. |
30 | ····/// </summary> |
31 | ····public enum PrimaryConstraintPlacement |
32 | ····{ |
33 | ········/// <summary> |
34 | ········/// PK constraint is located at the end of a column definition. |
35 | ········/// </summary> |
36 | ········InColumn, |
37 | ········/// <summary> |
38 | ········/// PK constraint is located like a row in the table definition. |
39 | ········/// This is standard and the case for most databases. |
40 | ········/// </summary> |
41 | ········InTable, |
42 | ········/// <summary> |
43 | ········/// PK constraint is located after the table definition. This can be used |
44 | ········/// to create the constraint with ALTER TABLE statements. |
45 | ········/// </summary> |
46 | ········AfterTable |
47 | ····} |
48 | |
49 | ····/// <summary> |
50 | ····/// This interface is used to write DDL language providers. |
51 | ····/// </summary> |
52 | ····public interface ISqlGenerator |
53 | ····{ |
54 | ········/// <summary> |
55 | ········/// Gets the name of the NDO provider, which should be used to generate the table and column names. |
56 | ········/// </summary> |
57 | ········string ProviderName |
58 | ········{ |
59 | ············get ; |
60 | ········} |
61 | |
62 | ········/// <summary> |
63 | ········/// This is used by the enhancer to get and set the ndo provider, the generator belongs to. |
64 | ········/// </summary> |
65 | ········IProvider Provider |
66 | ········{ |
67 | ············get; set; |
68 | ········} |
69 | |
70 | ········/// <summary> |
71 | ········/// Sets the message adapter object, where warnings and error messages are written to. |
72 | ········/// </summary> |
73 | ········/// <param name="messages">The message adapter object.</param> |
74 | ········void SetMessageAdapter(IMessageAdapter messages); |
75 | |
76 | ········/// <summary> |
77 | ········/// Statements to delete a table before it is newly created. |
78 | ········/// </summary> |
79 | ········/// <param name="tableName">Name of the table.</param> |
80 | ········/// <returns>A DDL string</returns> |
81 | ········string DropTable(string tableName); |
82 | |
83 | ········/// <summary> |
84 | ········/// Any statements necessary, before a table description begins. |
85 | ········/// </summary> |
86 | ········/// <param name="connectionString">Connection string, corresponding to the class, |
87 | ········/// for which a table is to be constructed.</param> |
88 | ········/// <returns>A DDL string.</returns> |
89 | ········string ConnectToDatabase(string connectionString); |
90 | |
91 | ········/// <summary> |
92 | ········/// Code to start a table description. |
93 | ········/// </summary> |
94 | ········/// <param name="tableName">Qualified name of the table.</param> |
95 | ········/// <returns>A DDL string.</returns> |
96 | ········/// <remarks>After this code the column descriptions are placed.</remarks> |
97 | ········string BeginnTable(string tableName); |
98 | |
99 | ········/// <summary> |
100 | ········/// Code to end a table description. |
101 | ········/// </summary> |
102 | ········/// <param name="tableName">Qualified name of the table.</param> |
103 | ········/// <returns>A DDL string.</returns> |
104 | ········string EndTable(string tableName); |
105 | |
106 | ········/// <summary> |
107 | ········/// Determines, where the primary key constraint must be placed. |
108 | ········/// </summary> |
109 | ········PrimaryConstraintPlacement PrimaryConstraintPlacement |
110 | ········{ |
111 | ············get ; |
112 | ········} |
113 | |
114 | ········/// <summary> |
115 | ········/// Determines, if a field length may be placed in the DDL. |
116 | ········/// </summary> |
117 | ········/// <param name="t">Sytem.Type for which the column is to be prepared.</param> |
118 | ········/// <returns>True, if a field length can be placed in the DDL.</returns> |
119 | ········bool LengthAllowed(Type t); |
120 | |
121 | ········/// <summary> |
122 | ········/// Determines, if a field length may be placed in the DDL. |
123 | ········/// </summary> |
124 | ········/// <param name="dbType">A database specific column type name.</param> |
125 | ········/// <returns>True, if a field length can be placed in the DDL.</returns> |
126 | ········bool LengthAllowed(string dbType); |
127 | |
128 | |
129 | ········/// <summary> |
130 | ········/// Maps a certain System.Type to a database specific column type |
131 | ········/// </summary> |
132 | ········/// <param name="t">The System.Type to convert.</param> |
133 | ········/// <param name="size">The intended size of the type. If type is string, the value -1 means, that a CLOB type should be returned.</param> |
134 | ········/// <returns>A type string</returns> |
135 | ········string DbTypeFromType(Type t, int size = 0); |
136 | |
137 | ········/// <summary> |
138 | ········/// DDL for auto increment columns. |
139 | ········/// </summary> |
140 | ········/// <returns>A DDL string</returns> |
141 | string AutoIncrementColumn( string columnName, Type dataType, string columnType, string width, bool isPrimary) ; |
142 | |
143 | ········/// <summary> |
144 | ········/// DDL for primary key columns, which are not autoincremented. |
145 | ········/// </summary> |
146 | ········/// <remarks> |
147 | ········/// A DDL generator should implement this function, |
148 | ········/// if PrimaryConstraintPlacement has the value InColumn. |
149 | ········/// </remarks> |
150 | ········string PrimaryKeyColumn(string columnName, Type dataType, string columnType, string width); |
151 | |
152 | ········/// <summary> |
153 | ········/// True, if the column DDL syntax of a primary key column is different |
154 | ········/// to the DDL of an ordinary column. |
155 | ········/// </summary> |
156 | ········bool HasSpecialAutoIncrementColumnFormat |
157 | ········{ |
158 | ············get ; |
159 | ········} |
160 | |
161 | ········/// <summary> |
162 | ········/// Creates the DDL for creating primary key constraints. |
163 | ········/// </summary> |
164 | ········/// <param name="primaryKeyColumns">All columns, building the primary key.</param> |
165 | ········/// <param name="constraintName">Name of the constraint.</param> |
166 | ········/// <param name="tableName">Qualified name of the table.</param> |
167 | ········/// <returns>A DDL string.</returns> |
168 | ········string CreatePrimaryKeyConstraint(DataColumn[] primaryKeyColumns, string constraintName, string tableName); |
169 | |
170 | ········/// <summary> |
171 | ········/// Creates the DDL for creating foreign key constraints. |
172 | ········/// </summary> |
173 | ········/// <param name="sourceColumns">Colums, building the foreign Key in the current table.</param> |
174 | ········/// <param name="relatedColumns">Primary key columns, to which the source columns relate.</param> |
175 | ········/// <param name="constraintName">Name of the constraint.</param> |
176 | ········/// <param name="relatedTableName">Name of the related table.</param> |
177 | ········/// <returns>A DDL string.</returns> |
178 | ········string CreateForeignKeyConstraint(DataColumn[] sourceColumns, DataColumn[] relatedColumns, string constraintName, string relatedTableName); |
179 | |
180 | |
181 | ········/// <summary> |
182 | ········/// Writes an expression, which determines, whether a column allows NULL values. |
183 | ········/// </summary> |
184 | ········/// <param name="allowNull">If true, the column should allow null values, otherwise not.</param> |
185 | ········/// <returns>A DDL string.</returns> |
186 | ········string NullExpression(bool allowNull); |
187 | |
188 | |
189 | ········/// <summary> |
190 | ········/// Creates an index in the database. |
191 | ········/// </summary> |
192 | ········/// <param name="indexName">Name of the index.</param> |
193 | ········/// <param name="tableName">Name of the owning table.</param> |
194 | ········/// <param name="indexColums">An array of DataColumn objects which denotes the columns to be indexed.</param> |
195 | ········/// <returns></returns> |
196 | ········string CreateIndex(string indexName, string tableName, DataColumn[] indexColums); |
197 | |
198 | ········/// <summary> |
199 | ········/// Creates the part of a Alter Table statement, which adds a column. NDO will add the type |
200 | ········/// and Null/Non Null expressions. |
201 | ········/// </summary> |
202 | ········/// <returns>A DDL string.</returns> |
203 | ········/// <remarks> |
204 | ········/// Here is an Expample: |
205 | ········/// <code> |
206 | ········/// -- The next line will be generated by NDO |
207 | ········/// ALTER Table myTable |
208 | ········/// -- The next line should be generated by AddColumn |
209 | ········/// ADD COLUMN |
210 | ········/// -- The next line will be generated by NDO (it's exacly a column definition). |
211 | ········/// myColumn INTEGER NOT NULL; |
212 | ········/// </code> |
213 | ········/// </remarks> |
214 | ········string AddColumn(); |
215 | |
216 | ········/// <summary> |
217 | ········/// Creates the part of a Alter Table statement, which drops a column. |
218 | ········/// </summary> |
219 | ········/// <param name="colName">Name of the column to be dropped.</param> |
220 | ········/// <returns>A DDL string.</returns> |
221 | ········/// <remarks> |
222 | ········/// Here is an Expample: |
223 | ········/// <code> |
224 | ········/// -- The next line will be generated by NDO |
225 | ········/// ALTER Table myTable |
226 | ········/// -- The next line should be generated by RemoveColumn |
227 | ········/// DROP myColumn |
228 | ········/// -- The next line will be generated by NDO |
229 | ········/// ; |
230 | ········/// </code> |
231 | ········/// </remarks> |
232 | ········string RemoveColumn(string colName); |
233 | |
234 | ········/// <summary> |
235 | ········/// Creates the part of a Alter Table statement, which renames a column.········ |
236 | ········/// </summary> |
237 | ········/// <param name="tableName">Name table to be altered.</param> |
238 | ········/// <param name="oldName">Name of the column to be renamed.</param> |
239 | ········/// <param name="newName">New name of the column.</param> |
240 | ········/// <param name="typeName">An expression like 'CHAR(200) NOT NULL'.</param> |
241 | ········/// <returns>A DDL string.</returns> |
242 | ········/// <remarks> |
243 | ········/// Here is an Expample: |
244 | ········/// <code> |
245 | ········/// -- All lines should be generated by RenameColumn |
246 | ········/// ALTER Table myTable |
247 | ········///·· ALTER oldName TO newName |
248 | ········/// </code> |
249 | ········/// If RenameColumn returns an empty string, NDO tries to synthesize the rename function |
250 | ········/// with a sequence of ADD COLUMN, UPDATE and DROP COLUMN statements. |
251 | ········/// </remarks> |
252 | ········string RenameColumn(string tableName, string oldName, string newName, string typeName); |
253 | |
254 | ········/// <summary> |
255 | ········/// Creates the part of a Alter Table statement, which changes a column type. NDO will add the type |
256 | ········/// and Null/Non Null expressions. |
257 | ········/// </summary> |
258 | ········/// <returns>A DDL string.</returns> |
259 | ········/// <remarks> |
260 | ········/// Here is an Expample: |
261 | ········/// <code> |
262 | ········/// -- The next line will be generated by NDO |
263 | ········/// ALTER Table myTable |
264 | ········/// -- The next line should be generated by AlterColumnType |
265 | ········/// ALTER COLUMN |
266 | ········/// -- The next line will be generated by NDO (it's exacly a column definition) |
267 | ········/// myColumn nvarchar(255) NOT NULL; |
268 | ········/// </code> |
269 | ········/// </remarks> |
270 | ········string AlterColumnType(); |
271 | |
272 | |
273 | ····} |
274 | } |
275 |