![]() |
|
Модераторы: Poseidon, Snowy, bems, MetalFan |
![]()
|
|
| MacTep |
|
|||
|
Эксперт ![]() ![]() ![]() Профиль Группа: Завсегдатай Сообщений: 1292 Регистрация: 4.8.2003 Где: г. Самара Репутация: 4 Всего: 4 |
Как бороться с этой ошибкой и вообще, что она означает?
-------------------- (A)bort, (R)etry, (I)gnore = Haфиг, Heфиг, Пoфиг ... :) |
|||
|
||||
| Alex |
|
|||
![]() Эксперт ![]() ![]() ![]() ![]() Профиль Группа: Экс. модератор Сообщений: 4147 Регистрация: 25.3.2002 Где: Москва Репутация: 80 Всего: 162 |
Database index out of date error
This is a BDE/Paradox error message. For newbies, BDE error messages are daunting, cryptic messages. Actually, even for seasoned veterans, they can sometimes be real "stumpers." Unfortunately, there's no real good reference available that I know of, so all I can offer with respect to this error message is my experience. The "Index out of date" message can mean a couple of things: 1. 1. One of the more common causes of this error is one in which you have a couple of copies of a table existing on your network or machine. For instance, when I develop applications, I have my application tables residing in my development system, then have copies of them on my network. When I need to update my tables, I usually do the updates in my development system, then copy them over to my deployment system on the network. I've run into this exact error when I've copied only the table (.DB) file and not its accompanying index file(s) (.PX, .X01, .Y01, etc) as well. You see, when you update a table by changing it in any way, its index files are also resynched to reflect the changes. So if you copy just the table to a new place on your system and don't include its family members, you'll index files that aren't in synch with your table. Okay that's one cause. 2. 2. The next cause could be just this: One of your indexes is corrupt. This could be due to sector errors on your hard disk, or the rare, but possible, direct corruption of an index. This usually happens if your program abended while performing an update to a table with an index of some sort. In that case, the index doesn't get updated. But in any case, the only way I know of to correct the problem is to do the following: 1. Open up your table in Database Desktop. 2. Restructure it. 3. Define/Rebuild all your indexes. 4. Save the file. Взято с Delphi Knowledge Base http://www.baltsoft.com/ BLOB has been modified., Index is out of date Объяснение от Борланд: Index out Date ($2F02) is an error that occurs while using Paradox tables when the data in a table and a corresponding index is not consistent. In most cases (see below for the one exception), short of malicious behavior such as renaming an index, adding some data to the table, then renaming the index back, there is no programmatic way to cause this error to occur. There is no way to determine which index is out of date. All indexes must be recreated. Blob has been modified ($3302) is an error that occurs when the Blob portion of the record contained in the .DB file has become inconsistent with the Blob portion in the .MB file. This could occur when the write to the .DB file was successful but the .MB file did not get updated, or visa-versa. There are a few mechanisms to fix a table where these errors have occurred. 1. First try re-starting the application. It is possible that the BDE has become unstable and is reporting incorrect errors. Also try opening the table with a different application. 2. Use Paradox 7 or 8 to run the Table Repair utility. Please see original documentation for more information. 3. Run TUtility and rebuild the table. TUtility is an unsupported utility available for download from the Borland web site in the {Utilities, programs and updates section}. 4. Delete all indexes and recreate them (Index out Date ($2F02) error only). To do this you'll need to know the structure of all your indexes (including primary) before recreating them, which means you need to know the structure of all indexes before the error occurs. There are 8 known possible causes for this error. 1. Incorrectly setting the LOCAL SHARE property. Most commonly this occurs via Peer-to-Peer networking. In this case the two different database engines are on two CPUs, even though they may be the same version. See { BDE setup for Peer-To-Peer(Non-Dedicated) Networks} for additional information on Peer-to-Peer setup. Another condition is when two different database engines execute on the same CPU concurrently and access data locally. This would be true when any combination of following are used concurrently: The Paradox Engine, BDE 16 bit, BDE 32 bit, Paradox for DOS. In this case each engine must set LOCAL SHARE to TRUE. Note that if use two applications which both use the same database engine (for example: Delphi 3 and C++ Builder 3) concurrently are run LOCAL SHARE does not need to be set to TRUE. In this case, all locking and cached data is in a central memory pool which all BDE applications have access to. Also, if two different database engines use data remotely, LOCAL SHARE must be set to TRUE. Code should be used at startup to check the setting of local share. Look at the {DbiOpenCfgInfoList } BDE API function call for more information. 2. Error transmitting data from the workstation to the server. Most commonly, this occurs with bad network hardware (cable, card, hub, etc.). This has been determined to be a problem even though there were no other errors are detected in data transmission. To determine if this is the cause for your error, try eliminating one CPU at a time from using the data and see if the problem continues. 3. Bad VREDIR.VXD on any client accessing tables Windows 95 ONLY: Several versions (notably 4.00.1113 and 4.00.1114) of the file VREDIR.VXD may need to be updated. Reports have shown that using the original release of VREDIR.VXD (4.00.950) and a new release (4.00.1116) do not result in the errors "Blob has been modified" and/or "Index is out of date." If any one of the clients has a "bad" version of this device driver, the error can occur on any machine, not just the machine with the bad driver. This error most likely occurs in 16Bit versions of the Borland Database Engine, although it still can occur in 32Bit versions. For further information on the update of VREDIR.VXD, Please check the following Microsoft Articles: {Q174371} and {Q165403} 4. For Windows 95 clients only, when using data on Windows NT: Add the following key in your registry: HKEY_LOCAL_MACHINESystemCurrentControlSetServicesVxDVredir Then create the string or Binary Value (either one works) with a name of DiscardCacheonOpen and make it equal to 1. Note that this an undocumented registry entry obtained from Microsoft. Questions on its functionality should be directed to Microsoft. 5. Problem with opportunistic locking Windows NT ONLY: Try turning off opportunistic locking in the Windows NT registry: See Microsoft Article {Q129202} Note: Borland internal testing has not indicated this setting to be significant. However, some Borland customers have indicated this to solve the problem. 6. Improperly closing files such as due to loss of power or restarting a workstation or the server without closing files first may cause this problem. Paradox tables are not designed to withstand such behavior. If this is a possibility in your environment, we recommend you use a Client Server database that can recover from such conditions. 7. Extremely large numbers of indexes, especially involving Referential Integrity can cause this problem and especially when using Windows NT as the server. Borland recommends using a Client Server database under this condition. However, if you are using Windows NT as your server, switching to Novell Netware or Windows 95 as the server may resolve the problem as well. 8. The one programmatic way you can make this error occur is if you attempt to post a duplicate value to a unique, non-primary index at the same time you attempt to open the same table. This problem only occurs if local share is set to False and only occurs on local drives. Unverified solutions 1. Windows 95 Only: Bring up the network properties screen on all Workstations and enter the netBEUI properties screen. On the advanced tab, make sure that "Set this protocol to be the default protocol" is checked. 2. Windows 95 Only: If the previous suggestion did not work, try removing the following protocols in order. Remove one at a time and then re-test your problem: 1. NETBIOS support for IPX/SPX-compatible Protocol 2. TCP/IP 3. IPX/SPX-compatible Protocol If the problem disappears, attempt to add back in all protocols except for the last one that was taken out. Again, make sure netBEUI's default protocol check box is checked. 3. Windows NT Only used as a Workstation: On the Network Bindings page of the Network Properties, set the NetBEUI Protocol to be at the top of all services. The TCP/IP stack is known for having a lot of overhead that might cause timing problems. Since NT will send requests back in the same protocol as it is sent, changing the bindings on a NT machine used as a server will have no effect. Other resources 1. {The Delphi Magazine} has a number of interesting articles on this subject as well. See { www.itecuk.com/Delmag/Paradox.htm} for details. -------------------------------------------------------------------------------- Примечание от Vit: Обычно такие ошибки возникают из-за проблем с кэшированием измений в базе данных, особенно при использовании BLOB/Memo полей и особенно при многопользовательском доступе. В простейшем случае снизить частоту возникновения этой ошибки на несколько порядков помогает вызов метода FlushBuffers после каждого изменения таблицы:
Это сообщение отредактировал(а) alex-co - 24.7.2004, 06:38 -------------------- Написать можно все - главное четко представлять, что ты хочешь получить в конце. |
|||
|
||||
| MacTep |
|
|||
|
Эксперт ![]() ![]() ![]() Профиль Группа: Завсегдатай Сообщений: 1292 Регистрация: 4.8.2003 Где: г. Самара Репутация: 4 Всего: 4 |
Блин, еще бы так хорошо знать английский, как знает его Borland.
-------------------- (A)bort, (R)etry, (I)gnore = Haфиг, Heфиг, Пoфиг ... :) |
|||
|
||||
| Alex |
|
|||
![]() Эксперт ![]() ![]() ![]() ![]() Профиль Группа: Экс. модератор Сообщений: 4147 Регистрация: 25.3.2002 Где: Москва Репутация: 80 Всего: 162 |
А примечание от Vita не помогло?
-------------------- Написать можно все - главное четко представлять, что ты хочешь получить в конце. |
|||
|
||||
| MacTep |
|
|||
|
Эксперт ![]() ![]() ![]() Профиль Группа: Завсегдатай Сообщений: 1292 Регистрация: 4.8.2003 Где: г. Самара Репутация: 4 Всего: 4 |
А вот примечание от Vit'а очень помогло! Это просто супер! Я только с помощью этого примечания и разрулил всю ситуацию с этой ошибкой. Теперь у меня все работает. Вечером напишу небольшой отзыв-статью по поводу моих ошибок и по поводу того, как я их исправил. Думаю, что новичкам в программировании баз данных это обязательно нужно знать, просто необходимо!!!
-------------------- (A)bort, (R)etry, (I)gnore = Haфиг, Heфиг, Пoфиг ... :) |
|||
|
||||
| MacTep |
|
||||
|
Эксперт ![]() ![]() ![]() Профиль Группа: Завсегдатай Сообщений: 1292 Регистрация: 4.8.2003 Где: г. Самара Репутация: 4 Всего: 4 |
Итак, как и обещал, пишу несколько советов-полезностей для тех, кто только начинает писать базы данных на Delphi. Все, что здесь будет написано, связано с сортировкой набора данных (НД) в базе данных (БД). База данных, используемая мной, была Paradox. Писал базу при помощи BDE (думаю, что это и есть самое интересное во всех моих проблемах).
Итак, на форме есть DataSource1, Table1, Query1 и DBGrid. В данный момент весь НД отображается при помощи Table1 в DBGrid'е. Что делать, если вдруг мне понадобилось сделать так, чтобы НД стал отсортирован по какому-либо полю? Есть два (по крайней мере, я столько знаю, может их и больше) выходов из сложившейся ситуации: 1) отсортировать НД при помощи индексов в таблице; 2) отсортировать при помощи SQL-запроса (ORDER BY). Рассмотрим первый случай. Вроде все легко: создаем таблицу, в ней создаем индекс по какому-либо полю (выбираем в Database Desktop опцию Secondary Indexes; выбираем поле, которое будет проиндексировано; даем название индексу; сохраняем таблицу). Я так все и делал. В итоге, при использовании такого кода при нажатии на кнопку на форме:
получал такую ошибку: Index is out of date. Долго я ломал голову над этой фигней, перечитал по этой теме кучу литературы и в интернете и в книгах, которые были дома. В итоге совершенно случайно я взял и первое поле в базе дыннх взял и сделал ключевым (поставил звездочку в графе Key для этого поля в утилите Database Desktop). После этого ошибка пропала и программа стала работать как часы. Супер!!! Радости моей не было конца потому, что это уже стало делом принципа - научиться сортировать НД в TTable, и не через SQL-запрос (см. ниже). А теперь случай номер два. Можно отсортировать так при помощи компонента TQuery. Здесь создаем такой код (учитывая то, что НД еще не переведен в подчинение к TQuery):
Вот такие пироги!!! С сортировкой все! Еще один вопрос, который я задавал на форуме, был насчет того, как сохранить изменения, сделанные в базе данных (например, после занесения новой записи в НД). Просто после такой операции у меня получалось, что информация в файле базы данных вовсе не созхраняется. Т.е., если я выйду из Delphi и запущу exe'шник, который Delphi создала, то я увижу на экране старую БД без каких-либо изменения. Помог в данном случае совет Vit'а: я просто стал перед выходом из программы (а можно это делать после каждого изменения НД) вызывал такой код: Table1.FlushBuffers. Вот и все! Удачи всем! Надеюсь, что чем-то помог тем, кто отважится на написание баз данных в Delphi! P.S. Для администрации: думаю, что это будет интересно и возможно нужно поместить в DRKB. Скромное предположение! -------------------- (A)bort, (R)etry, (I)gnore = Haфиг, Heфиг, Пoфиг ... :) |
||||
|
|||||
![]()
|
| Правила форума "Delphi: Общие вопросы" | |
|
|
Запрещается! 1. Публиковать ссылки на вскрытые компоненты 2. Обсуждать взлом компонентов и делиться вскрытыми компонентами
Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, Snowy, MetalFan, bems, Poseidon, Rrader. |
| 0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) | |
| 0 Пользователей: | |
| « Предыдущая тема | Delphi: Общие вопросы | Следующая тема » |
|
|
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности Powered by Invision Power Board(R) 1.3 © 2003 IPS, Inc. |