This is a migrated thread and some comments may be shown as answers.

[Solved] Problem with drop table

2 Answers 69 Views
Data Storage for HTML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rafael
Top achievements
Rank 1
Rafael asked on 03 Feb 2014, 03:14 PM
After executing a drop table the .insert() methods do not create a new table, instead they try to insert as if the table still existed, even after executing .sync()

To the .insert() method work as expected and create a new table one have to execute .close() and then .open() again.

Should'nt .sync() be enough? If not, what is the rule? When to use .sync() and when reopen the table??

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 04 Feb 2014, 08:38 AM
Hi Rafael,

The behavior that you describe is expected, as the Data Storage engine cannot recreate a table that it has already registered as created, unless it is reinitialized. 

What the sync() method does is sync only changes made through the fluent API of the engine - inserts, updates and deletes. Since the table drop is done through a user-defined query and makes the actual database schema different from the one that the DataStorage registered on initialization, the engine is unaware of the difference. The only way to sync the changes in such scenario is to reinitialize the engine, meaning to close and open again the database connection, as you described.

Regards,
Tsvetina
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

0
Rafael
Top achievements
Rank 1
answered on 06 Feb 2014, 07:41 PM
Thanks for the explanation.
Tags
Data Storage for HTML
Asked by
Rafael
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Rafael
Top achievements
Rank 1
Share this question
or