Core-Data – migrate ordinary SQLITE3 database to core data?

I have a normal pre-populated database. I want to migrate it to the core data of my application. What is the best way to achieve this? By the way, I did these things and copied recipes.sqlite database from apple’s sample.exported table sql. Renamed the column names according to the core data table columns (similar to this-use the id “primary key” of Z_PK). Use mine The values ​​fill that table. But I can’t understand the column names Z_ENT and Z_OPT. Does anyone know how to easily migrate the pre-populated sqlite3 database to core data.

Thank you

Don’t try to create Core Data SQLite files manually. This is a failed path; every time.

If you have a pre-existing SQLite file, then use a direct SQLite tool to access it and use Core Data to import it into Core Data. After storing the data in the Core Data stack, save the file, and then Use the generated SQLite file.

The internal structure of the Core Data SQLite file is designed to be opaque and should not be reverse engineered. Apple does not guarantee that the file structure remains the same. They have changed many times since the release of Core Data To get it.

Import

To import, it’s just like any other file:

>You stand up to the core data stack.>You traverse each Each row in the table and non-Core Data database.>Create a new Core Data object for each row.>Insert the data from the old row into the new object.

I There is a normal pre-populated database. I want to migrate it to the core data of my application. What is the best way to achieve this? By the way, I did these things and copied recipes.sqlite database from apple’s sample.exported table sql. Renamed the column names according to the core data table columns (similar to this-use the id “primary key” of Z_PK). Use mine The values ​​fill that table. But I can’t understand the column names Z_ENT and Z_OPT. Does anyone know how to easily migrate the pre-populated sqlite3 database to core data.

Thank you

Don’t try to create the Core Data SQLite file manually. This is a failed path; every time.

If you have a pre-existing SQLite file, then use the direct SQLite tool to access it, and use Core Data to import it into Core Data. After storing the data in the Core Data stack, save the file, and then use the generated SQLite file.

The internal structure of the Core Data SQLite file is designed to be opaque and should not be reverse-engineered. Apple does not guarantee that the file structure remains the same. They have changed it many times since the release of Core Data.

Import< /p>

To import, it’s just like any other file:

>You stand up to the core data stack.>You iterate over each table and each row in the non-Core Data database.> Create a new Core Data object for each row.>Insert the data in the old row into the new object.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 279 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.