Demo parsing for iOS coredata multi-Table query (2) -- insert Test Data

Source: Internet
Author: User

Demo parsing of IOS coredata multi-Table query (1) -- table Creation

Insert test data below:

Department * dept1 = [nsentitydescription insertnewobjectforentityforname: @ "department" inmanagedobjectcontext: Self. managedobjectcontext];

Dept1.dp _ deptname = @ "HR ";

Department * dept2 = [nsentitydescription insertnewobjectforentityforname: @ "department" inmanagedobjectcontext: Self. managedobjectcontext];

Dept2.dp _ deptname = @ "Dev ";

Department * dept3 = [nsentitydescription insertnewobjectforentityforname: @ "department" inmanagedobjectcontext: Self. managedobjectcontext];

Dept3.dp _ deptname = @ "pod ";

Salary * sy1 = [nsentitydescription insertnewobjectforentityforname: @ "salary" inmanagedobjectcontext: Self. managedobjectcontext];

Sy1.sy _ Level = @ "D ";

Sy1.sy _ scale = 0.1; // [nsnumber numberwithdouble: 0.1];

Salary * sy2 = [nsentitydescription insertnewobjectforentityforname: @ "salary" inmanagedobjectcontext: Self. managedobjectcontext];

Sy2.sy _ Level = @ "C ";

Sy2.sy _ scale = 0.15; // [nsnumber numberwithdouble: 0.15];

Salary * sy3 = [nsentitydescription insertnewobjectforentityforname: @ "salary" inmanagedobjectcontext: Self. managedobjectcontext];

Sy3.sy _ Level = @ "B ";

Sy3.sy _ scale = 0.4; // [nsnumber numberwithdouble: 0.4];

Salary * sy4 = [nsentitydescription insertnewobjectforentityforname: @ "salary" inmanagedobjectcontext: Self. managedobjectcontext];

Sy4.sy _ Level = @ "";

Sy4.sy _ scale = 0.8; // [nsnumber numberwithdouble: 0.8];

Post * pt1 = [nsentitydescription insertnewobjectforentityforname: @ "Post" inmanagedobjectcontext: Self. managedobjectcontext];

Pt1.pt _ name = @ "administrative specialist ";

Pt1.dept = dept1;

Pt1.salary = sy2;

Post * pt2 = [nsentitydescription insertnewobjectforentityforname: @ "Post" inmanagedobjectcontext: Self. managedobjectcontext];

Pt2.pt _ name = @ "Personnel Manager ";

Pt2.dept = dept1;

Pt2.salary = sy3;

Post * pt3 = [nsentitydescription insertnewobjectforentityforname: @ "Post" inmanagedobjectcontext: Self. managedobjectcontext];

Pt3.pt _ name = @ "Development Engineer ";

Pt3.dept = dept2;

Pt3.salary = sy2;

Post * Pt4 = [nsentitydescription insertnewobjectforentityforname: @ "Post" inmanagedobjectcontext: Self. managedobjectcontext];

Pt4.pt _ name = @ "architect ";

Pt4.dept = dept2;

Pt4.salary = sy3;

Post * pt5 = [nsentitydescription insertnewobjectforentityforname: @ "Post" inmanagedobjectcontext: Self. managedobjectcontext];

Pt5.pt _ name = @ "Project Manager ";

Pt5.dept = dept2;

Pt5.salary = sy3;

Post * pt6 = [nsentitydescription insertnewobjectforentityforname: @ "Post" inmanagedobjectcontext: Self. managedobjectcontext];

Pt6.pt _ name = @ "Test Engineer ";

Pt6.dept = dept2;

Pt6.salary = sy1;

Post * pT7 = [nsentitydescription insertnewobjectforentityforname: @ "Post" inmanagedobjectcontext: Self. managedobjectcontext];

Pt7.pt _ name = @ "sales representative ";

Pt7.dept = dept3;

Pt7.salary = sy1;

Post * pt8 = [nsentitydescription insertnewobjectforentityforname: @ "Post" inmanagedobjectcontext: Self. managedobjectcontext];

Pt8.pt _ name = @ "Sales Manager ";

Pt8.dept = dept3;

Pt8.salary = sy2;

Post * pt9 = [nsentitydescription insertnewobjectforentityforname: @ "Post" inmanagedobjectcontext: Self. managedobjectcontext];

Pt9.pt _ name = @ "Key Account Manager ";

Pt9.dept = dept3;

Pt9.salary = sy4;

Bank * BK1 = [nsentitydescription insertnewobjectforentityforname: @ "bank" inmanagedobjectcontext: Self. managedobjectcontext];

Bk1.bk _ name = @ "";

Bk1.bk _ address = @ "Guangzhou ";

Bank * BK2 = [nsentitydescription insertnewobjectforentityforname: @ "bank" inmanagedobjectcontext: Self. managedobjectcontext];

Bk2.bk _ name = @ "PUFA ";

Bk2.bk _ address = @ "Shanghai ";

Bank * bk3 = [nsentitydescription insertnewobjectforentityforname: @ "bank" inmanagedobjectcontext: Self. managedobjectcontext];

Bk3.bk _ name = @ "ICBC ";

Bk3.bk _ address = @ "Shenzhen ";

Employee * Em1 = [nsentitydescription insertnewobjectforentityforname: @ "employee" inmanagedobjectcontext: Self. managedobjectcontext];

Em1.em _ age = 20; // [nsnumber numberwithint: 20];

Em1.em _ name = @ "James ";

Em1.em _ sex = 1; // [nsnumber numberwithint: 1];

Em1.em _ bankcardid = @ "46326587439043 ";

Em1.dept = dept1;

Em1.post = pt1;

Em1.bank = bk3;

Employee * EM2 = [nsentitydescription insertnewobjectforentityforname: @ "employee" inmanagedobjectcontext: Self. managedobjectcontext];

Em2.em _ age = 18; // [nsnumber numberwithint: 18];

Em2.em _ name = @ "Li Si ";

Em2.em _ sex = 2; // [nsnumber numberwithint: 2];

Em2.em _ bankcardid = @ "32565443246567 ";

Em2.dept = dept1;

Em2.post = pt2;

Em2.bank = bk3;

Employee * em3 = [nsentitydescription insertnewobjectforentityforname: @ "employee" inmanagedobjectcontext: Self. managedobjectcontext];

Em3.em _ age = 26; // [nsnumber numberwithint: 26];

Em3.em _ name = @ "Owen ";

Em3.em _ sex = 2; // [nsnumber numberwithint: 2];

Em3.em _ bankcardid = @ "14354654656767 ";

Em3.dept = dept2;

Em3.post = pt3;

Em3.bank = BK2;

Employee * em4 = [nsentitydescription insertnewobjectforentityforname: @ "employee" inmanagedobjectcontext: Self. managedobjectcontext];

Em4.em _ age = 22; // [nsnumber numberwithint: 22];

Em4.em _ name = @ "James ";

Em4.em _ sex = 2; // [nsnumber numberwithint: 2];

Em4.em _ bankcardid = @ "9873425837433 ";

Em4.dept = dept2;

Em4.post = Pt4;

Em4.bank = BK2;

Employee * em5 = [nsentitydescription insertnewobjectforentityforname: @ "employee" inmanagedobjectcontext: Self. managedobjectcontext];

Em5.em _ age = 28; // [nsnumber numberwithint: 18];

Em5.em _ name = @ "Li Si ";

Em5.em _ sex = 1; // [nsnumber numberwithint: 2];

Em5.em _ bankcardid = @ "32565743246567 ";

Em5.dept = dept2;

Em5.post = pt5;

Em5.bank = bk3;

Employee * em6 = [nsentitydescription insertnewobjectforentityforname: @ "employee" inmanagedobjectcontext: Self. managedobjectcontext];

Em6.em _ age = 21; // [nsnumber numberwithint: 26];

Em6.em _ name = @ "Ouyang ";

Em6.em _ sex = 1; // [nsnumber numberwithint: 2];

Em6.em _ bankcardid = @ "14354614656767 ";

Em6.dept = dept2;

Em6.post = pt6;

Em6.bank = BK1;

Employee * em7 = [nsentitydescription insertnewobjectforentityforname: @ "employee" inmanagedobjectcontext: Self. managedobjectcontext];

Em7.em _ age = 22; // [nsnumber numberwithint: 22];

Em7.em _ name = @ "Wang Fei ";

Em7.em _ sex = 2; // [nsnumber numberwithint: 2];

Em7.em _ bankcardid = @ "9878429837433 ";

Em7.dept = dept3;

Em7.post = pT7;

Em7.bank = BK1;

Employee * em8 = [nsentitydescription insertnewobjectforentityforname: @ "employee" inmanagedobjectcontext: Self. managedobjectcontext];

Em8.em _ age = 26; // [nsnumber numberwithint: 18];

Em8.em _ name = @ "zhangqian ";

Em8.em _ sex = 1; // [nsnumber numberwithint: 2];

Em8.em _ bankcardid = @ "32565443246167 ";

Em8.dept = dept3;

Em8.post = pt8;

Em8.bank = BK2;

Employee * em9 = [nsentitydescription insertnewobjectforentityforname: @ "employee" inmanagedobjectcontext: Self. managedobjectcontext];

Em9.em _ age = 21; // [nsnumber numberwithint: 26];

Em9.em _ name = @ "Xie Yang ";

Em9.em _ sex = 1; // [nsnumber numberwithint: 2];

Em9.em _ bankcardid = @ "14354694656767 ";

Em9.dept = dept3;

Em9.post = pt9;

Em9.bank = BK1;

[Self savecontext];

Data in the database:

 

Demo parsing for iOS coredata multi-Table query (3) -- Query

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.