Datei: NDOInterfaces/IProvider.cs

Last Commit (4b748a1)
1 //
2 // Copyright (c) 2002-2024 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 using System.Data.Common;
26
27 namespace NDOInterfaces
28 {
29 ····/// <summary>
30 ····/// This interface creates objects for a specific ADO.NET data provider.
31 ····/// Implement this interface if a special data provider is needed.
32 ····/// NDO supplies implementations of IProvider for Microsoft SQL Server, Access and Oracle.
33 ····/// The provider should be registered with the NDOProviderFactory.
34 ····/// </summary>
35 ····public interface IProvider
36 ····{
37 ········/// <summary>
38 ········/// Factory method for new connection objects.
39 ········/// </summary>
40 ········/// <param name="parameters">Connection string</param>
41 ········/// <returns>An ADO.NET connection object</returns>
42 INdoDbConnection NewConnection( string parameters) ;
43
44 ········/// <summary>
45 ········/// Factory method for new command objects. Commands will be assinged to the given connection.
46 ········/// </summary>
47 ········/// <param name="connection">The connection over which the command will be executed</param>
48 ········/// <returns>An ADO.NET command object</returns>
49 IDbCommand NewSqlCommand( INdoDbConnection connection) ;
50
51 ········/// <summary>
52 ········/// Factory method for new data adapter objects.
53 ········/// </summary>
54 ········/// <param name="select">Command object for the SELECT statement</param>
55 ········/// <param name="update">Command object for the UPDATE statement</param>
56 ········/// <param name="insert">Command object for the INSERT statement</param>
57 ········/// <param name="delete">Command object for the DELETE statement</param>
58 ········/// <returns>An ADO.NET data adapter</returns>
59 ········DbDataAdapter NewDataAdapter(IDbCommand select, IDbCommand update, IDbCommand insert, IDbCommand delete);
60
61 ········/// <summary>
62 ········/// Factory method for new command builder objects.
63 ········/// </summary>
64 ········/// <param name="dataAdapter">The data adapter, which contains the SELECT command, from which all other commands will be constructed.</param>
65 ········/// <returns>A newly constructed CommandBuilder object</returns>
66 ········/// <remarks>This function is not used by the framework. It is only used by the mapping tool.</remarks>
67 ········object NewCommandBuilder(DbDataAdapter dataAdapter);
68
69 ········/// <summary>
70 ········/// This is a generic wrapper for the AddParameter methods of specialized ADO.NET providers.
71 ········/// Adds parameters to a given command object. The parameter types depend on the ADO.NET provider in use.
72 ········/// </summary>
73 ········/// <param name="command">Command object for which parameters are to be assigned.</param>
74 ········/// <param name="parameterName">Parameter name</param>
75 ········/// <param name="dbType">Parameter type code - value depends on the ADO.NET provider in use</param>
76 ········/// <param name="size">Parameter size. This value will be interpreted by the database.</param>
77 ········/// <param name="columnName">Name of the column, for which the command applies</param>
78 ········IDataParameter AddParameter(IDbCommand command, string parameterName, object dbType, int size, string columnName);
79 ········/// <summary>
80 ········/// This is a generic wrapper for the AddParameter methods of specialized ADO.NET providers.
81 ········/// Adds parameters to a given command object. The parameter types depend on the ADO.NET provider in use.
82 ········/// </summary>
83 ········/// <param name="command">Command object for which parameters are to be assigned.</param>
84 ········/// <param name="parameterName">Parameter name</param>
85 ········/// <param name="dbType">Parameter type code - value depends on the ADO.NET provider in use</param>
86 ········/// <param name="size">Parameter size. This value will be interpreted by the database.</param>
87 ········/// <param name="dir">A value indicating whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter.</param>
88 ········/// <param name="isNullable">Indicates whether the parameter accepts null values.</param>
89 ········/// <param name="precision">The maximum number of digits used to represent the Value property.</param>
90 ········/// <param name="scale">The number of decimal places to which Value is resolved.</param>
91 ········/// <param name="srcColumn">The name of the source column that is mapped to the DataSet and used for loading or returning the Value.</param>
92 ········/// <param name="srcVersion">The DataRowVersion to use when loading Value.</param>
93 ········/// <param name="value">The value of the parameter.</param>
94 ········IDataParameter AddParameter(IDbCommand command, string parameterName, object dbType, int size, ParameterDirection dir, bool isNullable, byte precision, byte scale, string srcColumn, DataRowVersion srcVersion, object value);
95
96 ········/// <summary>
97 ········/// Maps a given System.Type to a type code which represents the type in the database.
98 ········/// </summary>
99 ········/// <param name="t">A Type object.</param>
100 ········/// <returns>A DbType value representing the given type.</returns>
101 ········object GetDbType(Type t);
102
103 ········/// <summary>
104 ········/// Maps a type code name to the type code, which represents the type in the database.
105 ········/// Typically the type code names are the string representation of the enum name of the DbType value.
106 ········/// If the DbType enum contains a member Rawbyte, the String representation would be "Rawbyte".
107 ········/// GetDbType would return a MyDatabaseType.Rawbyte for the String "Rawbyte".
108 ········/// </summary>
109 ········/// <param name="dbTypeName">Type code name</param>
110 ········/// <returns>The DbType code</returns>
111 ········object GetDbType(string dbTypeName);
112
113 ········/// <summary>
114 ········/// Gets the string representation of the provider specific parameter type.
115 ········/// </summary>
116 ········/// <param name="parameter">An IDbDataParameter implementation.</param>
117 ········/// <returns>The string Representation of the parameter.</returns>
118 ········/// <remarks>
119 ········/// Each ADO.NET implementation uses it's own parameter types, e.g. SqlDbType for SqlParameter.
120 ········/// We need the names of this parameters to support the Loggin.
121 ········/// </remarks>
122 ········string GetDbTypeString( IDbDataParameter parameter );
123
124 ········/// <summary>
125 ········/// Gets a usefull length for a given type, i.e. the value 4 for the type System.Int32.
126 ········/// </summary>
127 ········/// <param name="t">A Type object</param>
128 ········/// <returns></returns>
129 ········int GetDefaultLength(Type t);
130
131 ········/// <summary>
132 ········/// Gets the wildcard character, i.e. '%' for SqlServer or '*' for Microsoft Access.
133 ········/// </summary>
134 ········string Wildcard {get;}
135
136 ········/// <summary>
137 ········/// Indicates whether the last automatically generated ID can be retrieved.
138 ········/// Returns true if a database provides automatically incremented IDs and its syntax has an expression
139 ········/// which retrieves the last generated ID; otherwise false.
140 ········/// </summary>
141 ········bool SupportsLastInsertedId {get;}
142
143 ········/// <summary>
144 ········/// Gets an expression in the SQL dialect of the database, which retrieves the ID of the last
145 ········/// inserted row, if the ID is automatically generated by the database.
146 ········/// </summary>
147 ········string GetLastInsertedId(string tableName, string columnName);
148
149 ········/// <summary>
150 ········/// Indicates whether a database accepts named parameters in parameter lists.
151 ········/// If this value is false, NDO will use unnamed standard SQL parameter lists.
152 ········/// </summary>
153 ········bool UseNamedParams {get;}
154
155
156 ········/// <summary>
157 ········/// Convert a plain name to a parameter name, i.e. the string "id" will be converted
158 ········/// to ":id" for oracle or "@id" for Sql Server.
159 ········/// </summary>
160 ········/// <param name="plainParameterName">The string to be converted</param>
161 ········/// <returns>The converted name.</returns>
162 ········string GetNamedParameter(string plainParameterName);
163
164 ········/// <summary>
165 ········/// Converts a plain name to a quoted name, if the database supports quoted names.
166 ········/// Most databases use their own quoting characters to distinguish names and keywords.
167 ········/// Implementers of IProvider should make shure that the name to convert is not yet converted.
168 ········/// </summary>
169 ········/// <param name="plainName"></param>
170 ········/// <returns></returns>
171 ········string GetQuotedName(string plainName);
172
173
174 ········/// <summary>
175 ········/// This property is for future use and is always set to false.
176 ········/// </summary>
177 ········bool UseStoredProcedure {get;}
178
179 ········/// <summary>
180 ········/// Converts a value to a string representation which can be used in SQL commands
181 ········/// for a given database.
182 ········/// </summary>
183 ········/// <param name="o">The object to be converted</param>
184 ········/// <returns></returns>
185 ········string GetSqlLiteral(object o);
186
187
188 ········/// <summary>
189 ········/// Determines whether a database supports bulk command strings.
190 ········/// </summary>
191 ········bool SupportsBulkCommands {get;}
192 ········
193
194 ········/// <summary>
195 ········/// Generate one big command string out of several partial commands to save roundtrips
196 ········/// to the server.
197 ········/// </summary>
198 ········/// <param name="commands"></param>
199 ········/// <returns></returns>
200 ········string GenerateBulkCommand(string[] commands);
201
202 ········/// <summary>
203 ········/// Gets the maximum length of a bulk command if such commands are supported.
204 ········/// </summary>
205 ········int MaxBulkCommandLength {get;}
206
207
208 ········/// <summary>
209 ········/// Returns string representation of all possible database specific data types
210 ········/// </summary>
211 ········string[] TypeNames { get; }
212
213 ········/// <summary>
214 ········/// Returns the name of all tables of a given connection
215 ········/// </summary>
216 ········/// <param name="conn">The connection</param>
217 ········/// <returns>The table names</returns>
218 string[] GetTableNames ( INdoDbConnection conn) ;
219
220 ········/// <summary>
221 ········/// Returns the name of all tables of a given connection
222 ········/// </summary>
223 ········/// <param name="conn">The connection</param>
224 ········/// <param name="owner">Database owner name</param>
225 ········/// <returns>The table names</returns>
226 string[] GetTableNames ( INdoDbConnection conn, string owner) ;
227
228 ········/// <summary>
229 ········/// Generates a DataSet with exactly the same structure elements as the database.
230 ········/// It maps all tables, columns, primary keys and foreign key constraints of the database
231 ········/// to the DataSet.
232 ········/// </summary>
233 ········/// <param name="conn">A valid connection object to be used to fetch the necessary data.</param>
234 ········/// <param name="owner">Fetches only tables of a specific owner space. If this parameter is null, all tables are fetched.</param>
235 ········/// <returns></returns>
236 DataSet GetDatabaseStructure ( INdoDbConnection conn, string owner) ;
237
238 ········/// <summary>
239 ········/// Gets the name of the provider. This name will be used as index for the ProviderFactory
240 ········/// </summary>
241 ········string Name { get; }
242
243 ········/// <summary>
244 ········/// Determines, if the provider accepts a batch of an insert command an a select
245 ········/// command to retrieve autonumbered ids.
246 ········/// </summary>
247 ········bool SupportsInsertBatch { get; }
248
249
250 ········/// <summary>
251 ········/// This is needed, if a provider supports retrieving of the last autonumber id
252 ········/// but doesn't support insert batches. In the RowUpdateHandler NDO can execute a separate statement
253 ········/// to retrieve the id. The standard implementation in NDOAbstractProvider is empty.
254 ········/// </summary>
255 ········/// <param name="handler"></param>
256 ········void RegisterRowUpdateHandler(IRowUpdateListener handler);
257
258 ········/// <summary>
259 ········/// True if the Database has a native Guid datatype.
260 ········/// The guid type is represented as string type in the schema, with an additional attribute msdata:DataType.
261 ········/// If the database doesn't support Guids the additional attribute has to be deleted before the first database operation.
262 ········/// Thus the Guid will be stored and read as string from the database.
263 ········/// </summary>
264 ········bool SupportsNativeGuidType { get; }
265
266 ········/// <summary>
267 ········/// Fetch limits are used for paging. If the database supports paging, it provides an addition to OrderBy which
268 ········/// allows to specify a count of rows to skip and a maximum count of rows to take.
269 ········/// </summary>
270 ········bool SupportsFetchLimit { get; }
271
272 ········/// <summary>
273 ········/// Fetch limits are used for paging. If the database supports paging, it provides an addition to OrderBy which
274 ········/// allows to specify a count of rows to skip and a maximum count of rows to take.
275 ········/// </summary>
276 ········/// <param name="skip"></param>
277 ········/// <param name="take"></param>
278 ········/// <returns>A string, which is concatenated to the OrderBy clause</returns>
279 ········string FetchLimit( int skip, int take );
280
281 ········/// <summary>
282 ········/// Creates a database.
283 ········/// </summary>
284 ········/// <param name="name">Name of the database.</param>
285 ········/// <param name="additionalData">Additional data needed to perform the creation.</param>
286 ········/// <returns>The connection string, which can be used to access the created database.
287 ········/// The default implementation always returns an empty string.</returns>
288 ········/// <remarks>
289 ········/// The data structure of the parameter object should match the data structure returned by the ShowCreateDialog function.
290 ········/// The default implementation uses the CREATE DATABASE statement end expects a NDOCreateDbParameter object as parameter.
291 ········/// <seealso cref="NDOAbstractProvider"/>
292 ········/// </remarks>
293 ········string CreateDatabase(string name, string connectionName = null, object additionalData = null);
294
295 ····}
296 }
297
New Commit (f856804)
1 //
2 // Copyright (c) 2002-2024 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 using System.Data.Common;
26
27 namespace NDOInterfaces
28 {
29 ····/// <summary>
30 ····/// This interface creates objects for a specific ADO.NET data provider.
31 ····/// Implement this interface if a special data provider is needed.
32 ····/// NDO supplies implementations of IProvider for Microsoft SQL Server, Access and Oracle.
33 ····/// The provider should be registered with the NDOProviderFactory.
34 ····/// </summary>
35 ····public interface IProvider
36 ····{
37 ········/// <summary>
38 ········/// Factory method for new connection objects.
39 ········/// </summary>
40 ········/// <param name="parameters">Connection string</param>
41 ········/// <returns>An ADO.NET connection object</returns>
42 IDbConnection NewConnection( string parameters) ;
43
44 ········/// <summary>
45 ········/// Factory method for new command objects. Commands will be assinged to the given connection.
46 ········/// </summary>
47 ········/// <param name="connection">The connection over which the command will be executed</param>
48 ········/// <returns>An ADO.NET command object</returns>
49 IDbCommand NewSqlCommand( IDbConnection connection) ;
50
51 ········/// <summary>
52 ········/// Factory method for new data adapter objects.
53 ········/// </summary>
54 ········/// <param name="select">Command object for the SELECT statement</param>
55 ········/// <param name="update">Command object for the UPDATE statement</param>
56 ········/// <param name="insert">Command object for the INSERT statement</param>
57 ········/// <param name="delete">Command object for the DELETE statement</param>
58 ········/// <returns>An ADO.NET data adapter</returns>
59 ········DbDataAdapter NewDataAdapter(IDbCommand select, IDbCommand update, IDbCommand insert, IDbCommand delete);
60
61 ········/// <summary>
62 ········/// Factory method for new command builder objects.
63 ········/// </summary>
64 ········/// <param name="dataAdapter">The data adapter, which contains the SELECT command, from which all other commands will be constructed.</param>
65 ········/// <returns>A newly constructed CommandBuilder object</returns>
66 ········/// <remarks>This function is not used by the framework. It is only used by the mapping tool.</remarks>
67 ········object NewCommandBuilder(DbDataAdapter dataAdapter);
68
69 ········/// <summary>
70 ········/// This is a generic wrapper for the AddParameter methods of specialized ADO.NET providers.
71 ········/// Adds parameters to a given command object. The parameter types depend on the ADO.NET provider in use.
72 ········/// </summary>
73 ········/// <param name="command">Command object for which parameters are to be assigned.</param>
74 ········/// <param name="parameterName">Parameter name</param>
75 ········/// <param name="dbType">Parameter type code - value depends on the ADO.NET provider in use</param>
76 ········/// <param name="size">Parameter size. This value will be interpreted by the database.</param>
77 ········/// <param name="columnName">Name of the column, for which the command applies</param>
78 ········IDataParameter AddParameter(IDbCommand command, string parameterName, object dbType, int size, string columnName);
79 ········/// <summary>
80 ········/// This is a generic wrapper for the AddParameter methods of specialized ADO.NET providers.
81 ········/// Adds parameters to a given command object. The parameter types depend on the ADO.NET provider in use.
82 ········/// </summary>
83 ········/// <param name="command">Command object for which parameters are to be assigned.</param>
84 ········/// <param name="parameterName">Parameter name</param>
85 ········/// <param name="dbType">Parameter type code - value depends on the ADO.NET provider in use</param>
86 ········/// <param name="size">Parameter size. This value will be interpreted by the database.</param>
87 ········/// <param name="dir">A value indicating whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter.</param>
88 ········/// <param name="isNullable">Indicates whether the parameter accepts null values.</param>
89 ········/// <param name="precision">The maximum number of digits used to represent the Value property.</param>
90 ········/// <param name="scale">The number of decimal places to which Value is resolved.</param>
91 ········/// <param name="srcColumn">The name of the source column that is mapped to the DataSet and used for loading or returning the Value.</param>
92 ········/// <param name="srcVersion">The DataRowVersion to use when loading Value.</param>
93 ········/// <param name="value">The value of the parameter.</param>
94 ········IDataParameter AddParameter(IDbCommand command, string parameterName, object dbType, int size, ParameterDirection dir, bool isNullable, byte precision, byte scale, string srcColumn, DataRowVersion srcVersion, object value);
95
96 ········/// <summary>
97 ········/// Maps a given System.Type to a type code which represents the type in the database.
98 ········/// </summary>
99 ········/// <param name="t">A Type object.</param>
100 ········/// <returns>A DbType value representing the given type.</returns>
101 ········object GetDbType(Type t);
102
103 ········/// <summary>
104 ········/// Maps a type code name to the type code, which represents the type in the database.
105 ········/// Typically the type code names are the string representation of the enum name of the DbType value.
106 ········/// If the DbType enum contains a member Rawbyte, the String representation would be "Rawbyte".
107 ········/// GetDbType would return a MyDatabaseType.Rawbyte for the String "Rawbyte".
108 ········/// </summary>
109 ········/// <param name="dbTypeName">Type code name</param>
110 ········/// <returns>The DbType code</returns>
111 ········object GetDbType(string dbTypeName);
112
113 ········/// <summary>
114 ········/// Gets the string representation of the provider specific parameter type.
115 ········/// </summary>
116 ········/// <param name="parameter">An IDbDataParameter implementation.</param>
117 ········/// <returns>The string Representation of the parameter.</returns>
118 ········/// <remarks>
119 ········/// Each ADO.NET implementation uses it's own parameter types, e.g. SqlDbType for SqlParameter.
120 ········/// We need the names of this parameters to support the Loggin.
121 ········/// </remarks>
122 ········string GetDbTypeString( IDbDataParameter parameter );
123
124 ········/// <summary>
125 ········/// Gets a usefull length for a given type, i.e. the value 4 for the type System.Int32.
126 ········/// </summary>
127 ········/// <param name="t">A Type object</param>
128 ········/// <returns></returns>
129 ········int GetDefaultLength(Type t);
130
131 ········/// <summary>
132 ········/// Gets the wildcard character, i.e. '%' for SqlServer or '*' for Microsoft Access.
133 ········/// </summary>
134 ········string Wildcard {get;}
135
136 ········/// <summary>
137 ········/// Indicates whether the last automatically generated ID can be retrieved.
138 ········/// Returns true if a database provides automatically incremented IDs and its syntax has an expression
139 ········/// which retrieves the last generated ID; otherwise false.
140 ········/// </summary>
141 ········bool SupportsLastInsertedId {get;}
142
143 ········/// <summary>
144 ········/// Gets an expression in the SQL dialect of the database, which retrieves the ID of the last
145 ········/// inserted row, if the ID is automatically generated by the database.
146 ········/// </summary>
147 ········string GetLastInsertedId(string tableName, string columnName);
148
149 ········/// <summary>
150 ········/// Indicates whether a database accepts named parameters in parameter lists.
151 ········/// If this value is false, NDO will use unnamed standard SQL parameter lists.
152 ········/// </summary>
153 ········bool UseNamedParams {get;}
154
155
156 ········/// <summary>
157 ········/// Convert a plain name to a parameter name, i.e. the string "id" will be converted
158 ········/// to ":id" for oracle or "@id" for Sql Server.
159 ········/// </summary>
160 ········/// <param name="plainParameterName">The string to be converted</param>
161 ········/// <returns>The converted name.</returns>
162 ········string GetNamedParameter(string plainParameterName);
163
164 ········/// <summary>
165 ········/// Converts a plain name to a quoted name, if the database supports quoted names.
166 ········/// Most databases use their own quoting characters to distinguish names and keywords.
167 ········/// Implementers of IProvider should make shure that the name to convert is not yet converted.
168 ········/// </summary>
169 ········/// <param name="plainName"></param>
170 ········/// <returns></returns>
171 ········string GetQuotedName(string plainName);
172
173
174 ········/// <summary>
175 ········/// This property is for future use and is always set to false.
176 ········/// </summary>
177 ········bool UseStoredProcedure {get;}
178
179 ········/// <summary>
180 ········/// Converts a value to a string representation which can be used in SQL commands
181 ········/// for a given database.
182 ········/// </summary>
183 ········/// <param name="o">The object to be converted</param>
184 ········/// <returns></returns>
185 ········string GetSqlLiteral(object o);
186
187
188 ········/// <summary>
189 ········/// Determines whether a database supports bulk command strings.
190 ········/// </summary>
191 ········bool SupportsBulkCommands {get;}
192 ········
193
194 ········/// <summary>
195 ········/// Generate one big command string out of several partial commands to save roundtrips
196 ········/// to the server.
197 ········/// </summary>
198 ········/// <param name="commands"></param>
199 ········/// <returns></returns>
200 ········string GenerateBulkCommand(string[] commands);
201
202 ········/// <summary>
203 ········/// Gets the maximum length of a bulk command if such commands are supported.
204 ········/// </summary>
205 ········int MaxBulkCommandLength {get;}
206
207
208 ········/// <summary>
209 ········/// Returns string representation of all possible database specific data types
210 ········/// </summary>
211 ········string[] TypeNames { get; }
212
213 ········/// <summary>
214 ········/// Returns the name of all tables of a given connection
215 ········/// </summary>
216 ········/// <param name="conn">The connection</param>
217 ········/// <returns>The table names</returns>
218 string[] GetTableNames ( IDbConnection conn) ;
219
220 ········/// <summary>
221 ········/// Returns the name of all tables of a given connection
222 ········/// </summary>
223 ········/// <param name="conn">The connection</param>
224 ········/// <param name="owner">Database owner name</param>
225 ········/// <returns>The table names</returns>
226 string[] GetTableNames ( IDbConnection conn, string owner) ;
227
228 ········/// <summary>
229 ········/// Generates a DataSet with exactly the same structure elements as the database.
230 ········/// It maps all tables, columns, primary keys and foreign key constraints of the database
231 ········/// to the DataSet.
232 ········/// </summary>
233 ········/// <param name="conn">A valid connection object to be used to fetch the necessary data.</param>
234 ········/// <param name="owner">Fetches only tables of a specific owner space. If this parameter is null, all tables are fetched.</param>
235 ········/// <returns></returns>
236 DataSet GetDatabaseStructure ( IDbConnection conn, string owner) ;
237
238 ········/// <summary>
239 ········/// Gets the name of the provider. This name will be used as index for the ProviderFactory
240 ········/// </summary>
241 ········string Name { get; }
242
243 ········/// <summary>
244 ········/// Determines, if the provider accepts a batch of an insert command an a select
245 ········/// command to retrieve autonumbered ids.
246 ········/// </summary>
247 ········bool SupportsInsertBatch { get; }
248
249
250 ········/// <summary>
251 ········/// This is needed, if a provider supports retrieving of the last autonumber id
252 ········/// but doesn't support insert batches. In the RowUpdateHandler NDO can execute a separate statement
253 ········/// to retrieve the id. The standard implementation in NDOAbstractProvider is empty.
254 ········/// </summary>
255 ········/// <param name="handler"></param>
256 ········void RegisterRowUpdateHandler(IRowUpdateListener handler);
257
258 ········/// <summary>
259 ········/// True if the Database has a native Guid datatype.
260 ········/// The guid type is represented as string type in the schema, with an additional attribute msdata:DataType.
261 ········/// If the database doesn't support Guids the additional attribute has to be deleted before the first database operation.
262 ········/// Thus the Guid will be stored and read as string from the database.
263 ········/// </summary>
264 ········bool SupportsNativeGuidType { get; }
265
266 ········/// <summary>
267 ········/// Fetch limits are used for paging. If the database supports paging, it provides an addition to OrderBy which
268 ········/// allows to specify a count of rows to skip and a maximum count of rows to take.
269 ········/// </summary>
270 ········bool SupportsFetchLimit { get; }
271
272 ········/// <summary>
273 ········/// Fetch limits are used for paging. If the database supports paging, it provides an addition to OrderBy which
274 ········/// allows to specify a count of rows to skip and a maximum count of rows to take.
275 ········/// </summary>
276 ········/// <param name="skip"></param>
277 ········/// <param name="take"></param>
278 ········/// <returns>A string, which is concatenated to the OrderBy clause</returns>
279 ········string FetchLimit( int skip, int take );
280
281 ········/// <summary>
282 ········/// Creates a database.
283 ········/// </summary>
284 ········/// <param name="name">Name of the database.</param>
285 ········/// <param name="additionalData">Additional data needed to perform the creation.</param>
286 ········/// <returns>The connection string, which can be used to access the created database.
287 ········/// The default implementation always returns an empty string.</returns>
288 ········/// <remarks>
289 ········/// The data structure of the parameter object should match the data structure returned by the ShowCreateDialog function.
290 ········/// The default implementation uses the CREATE DATABASE statement end expects a NDOCreateDbParameter object as parameter.
291 ········/// <seealso cref="NDOAbstractProvider"/>
292 ········/// </remarks>
293 ········string CreateDatabase(string name, string connectionName = null, object additionalData = null);
294
295 ····}
296 }
297