- Jun 6, 2020
- 11,559
- 4,422
Having a background on Ruby On Rails there are 2 things i miss everytime i come back to B4x: ActiveRecord and Testings, so today i decided to tackle both them.
so far i have achived 20% of what i want to do, but i am very happy with the results.
My current approach consists of using the Type system of B4x to map them into the database. lets see the example:
B4X:
the type supplier matches to the table suppliers in the database (singular -plural), each field also match to a column. EXCEPT of course for the list, this one matches to the table invoices (hence the plural)
B4X:
the type invoice has a supplier_id, this way i am creating a One to Many relation ship.
The next step is simply to connect to a database and let the magic begin!
B4X:
so far i have achived 20% of what i want to do, but i am very happy with the results.
My current approach consists of using the Type system of B4x to map them into the database. lets see the example:
B4X:
Type supplier(id As String, nombre As String, nombre_corto As String, invoices As List)
the type supplier matches to the table suppliers in the database (singular -plural), each field also match to a column. EXCEPT of course for the list, this one matches to the table invoices (hence the plural)
B4X:
Type invoice(id As String, folio As String, supplier_id As String)
the type invoice has a supplier_id, this way i am creating a One to Many relation ship.
The next step is simply to connect to a database and let the magic begin!
B4X:
کد:
محتوای بلوک کدها در دسترس شما نیست. برای مشاهده بلوک کدها، وارد انجمن شوید یاثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید