![]() |
![]() |
![]() |
| Home | News | Forum | Documentation | Purchase | Download | Customers | Links |
|
The basic task of OLEDB provider for InterBase as any other component of access to the databases is control of the information that selected from the database. Since IBProvider is general-purpose engine, there are realized in it the solutions intended both for the use in the trivial tasks, and in the tasks of operating with volumes of data. Effectiveness is ensured due to the specialized mechanisms of control of the set of rows. At the current moment you can use:
Read-only row setsThe row sets, which do not make it possible to modify selected data, are the most highly productive method of information processing. Fundamental characteristics
Automatic creation and use of temporary file is one of the most important characteristics of IBProvider. By change of " Memory Usage" property value you can yourself regulate the threshold of the start of the mechanism of data unloading into temporary file. This mechanism is present in both types of read-only row sets. This is explained by the fact that even with the unidirectional access you can have a simultaneous access to the data of several rows. Therefore if user begins to retain more than can be placed in the indicated RAM volume, provider nevertheless will unload the part of the data into temporary file. Why swap-file and support from the operating system are not used?
Updateble row setsFor the tasks, in which it is necessary not only to select data, but also to have a possibility to modify it and to save some changes back into the database, they are realized two kinds of row sets optimized for these purposes in provider:
The identical mechanism of rows control is used for the both types of row sets. However, the realization of delayed transmission of changes somewhat more complex, and therefore it requires more resources. Basic characteristics
Page organization and caching In the process of design and testing of the productivity of local storage different schemes of data storage were tested. However, after a series of experiments we arrived at the classical architecture of storage of all data within the framework of one file. Presentation of set in the form of list ensures a good productivity of operations of row insert and deleting. However, it combines very badly with the operation of scrolling and access to row via the absolute index. In particular when using IRowsetScroll::GetApproximatePosition method to obtain the absolute row index provider sorts out all elements of list. At the same time IBProvider traces the total number of rows in the set; therefore overhead expenses for obtaining of this information are absent. Nevertheless, the standard methods of navigation on the set with the use of sequential access or bookmarks ensure a good productivity. It is reached due to the fact that when navigating only row headers are selected - data are stored separately. List of delayed changes ensures the priority of the fixation of changes in database. Other positive side of this list keeping is the possibility of the rapid enumeration of rows that expect update. Storing of data in IB-format The identical method of storage is used also in the read-only row sets, but in this case this presentation gives the following advantages:
Since OLEDB types cover the much wider spectrum of data than InterBase supports, the built-in type converter takes basic load. Failure resistance At first sight the task of the setting of new values of columns includes no any complexities. However, taking into account
many problems appear linked with the guarantee of integrity of the settings of new row data. Briefly problem was solved as follows:
This scheme with such level of failure resistance was created for only purpose - to exclude the place leakage in the structured storage. Automatic and controlled modes of record of changes in database To save the changes in row set provider uses the usual interface of interaction with the database server in form of the parameterized SQL queries. Automatic mode is used for the tasks, in which the user does not have a possibility to tune the created row set. For example, when using tools of the review of the database tables through IBProvider or using the provider as linked MSSQL server. Since, in the general case, it is impossible to automate the process of the generation of SQL queries for the record of changes in database, therefore into IBProvider there is realized the support only of simplest queries of the form "select * from table", where table - table with the primary key. To execute row set update in automatic mode provider are carried out system queries for obtaining the additional table information:
On the ground of this information provider can form correctly the necessary SQL queries. In spite of the closure of automatic process, you have the possibility to make prompts concerning the generation of the queries. See row set properties " auto_insert_field_rule" and " auto_update_field_rule". Manipulating by these properties it is possible to process correctly the presence of columns with the values by default (DEFAULT) and to minimize net traffic passing only new data of row. Furthermore, if the possibility to set the property of the opened row set presents nevertheless, then it is possible to determine the rules of the generation of the primary keys of new rows. It needs to indicate to row set via " auto_gen_key_rule" property what generators must be used for what columns. Controlled mode. For overcoming the restrictions of the automatic mode IBProvider makes it possible to explicitly determine the queries, which should be used for the backward record of changes in database. Three properties are determined for this in row set: " delete_sql", " insert_sql", " update_sql". For the tying SQL queries to the structure of the selected set the composite parameters are used:
parameter = <prefix> { <param_type> | <gen_param_type> . <gen_name> } . <column_id>
When determining the names of generators, tables and columns it is possible to use the quoted names. After changing the value of the property " named_param_prefix" (default value is colon), it is possible to change the prefix of the parameters of the query. Example:
Original query insert_sql delete_sql update_sql If you want to have a normal work with table CUSTOMER (database employers.gdb) you should either remove or rewrite the trigger SET_CUST_NO Focus attention, when provider forms the query parameters it uses data in format of column linked with the parameter. Therefore if the type of column will differ from the expected type of the parameter then server will have to carry out the necessary conversions. The incapacity to carry out the conversions between BLOB and strings is among the known restrictions of the mechanism of the conversion in some versions of InterBase. The indicated restriction does not apply to the execution of parameterized queries through the commands, in which the data transmission in format that server expects is ensured. Disconnected row set In the case if it is necessary to select and modify data without backward record of changes in database, it is possible to set row set property " disconnected_rowset" to true. The creation of the external mechanism of backward record of changes with using of commands is one of the ultimate purposes of this mode. During the creation of this mechanism it is also expedient to turn on the mode of the delayed changes ( See the rowset property IRowsetUpdate), which makes it possible to organize the transaction changes of row set. Pool of SQL queries The pool of SQL queries functions for increasing the productivity of the operations of record of changes in database at the level of each row set that supports update. This mechanism allows saving and repeatedly using of the previously executed queries. In the general case the value of the query execution is summarized from following expenditures:
InterBase SQL server allows:
The largest effect from the use of the pool appears in the automatic mode with the record only of modified data. For example, there is the table with the columns (A1, A2, A3), in which one time you change only one column. In this case provider will generate queries of the form:
Additionally two system queries for obtaining are added to these queries
The optimum pool size ( See the rowset property query_pool_size) to do this work is equal to three.
In this case during further modification of any column A1... A3 there is chance of the repeated execution of the already prepared query. The search for the suitable query is achieved through the comparison of SQL text. If identical query absents in pool then provider will re-prepare query with the maximum dead time. Focus attention that provider re-prepares queries used for the system needs. In the case of using the controlled mode the optimum size of pool is the sum of SQL queries, enumerated in properties " delete_sql", " insert_sql", " update_sql", and the number of generators indicated in the parameters GEN_XXX of queries " insert_sql". Manipulating by property " query_pool_size" it is possible
Focus attention that " query_pool_size" determines the maximum number of queries. Queries are created as far as necessary. Separate transactions for read and write The updatable row sets support two methods of the database change recording - with the use of the main transaction, in which data reading is produced, and with the use of other short transaction. Furthermore, you can indicate "mutable" mode:
The kind of transactions for data modification is determined by the row set property " modify_trans_type". Special possibilities By default updatable row set have some standard settings, which completely ensure the expected behavior. However, OLEDB specification determines the specific mode, which can be required for some class of the tasks:
|
|||||||||||||
| Site Build No. 3.0.0.1660 | |||||||||||||