CRUD...ing Databases

pliroforikos

Active Member
Licensed User
After my previous question about variables the next one trouble i think is to make CRUD functions for a database project.
It is boring especially if you have too many tables. It's worst when we need to change database design.

So my question in this:
How are you dealing with CRUDs. Which is the most efficient method?
 

Daestrum

Expert
Licensed User
Longtime User
I have never tried using B4X - I just use Ruby on Rails to do it.
 

aeric

Expert
Licensed User
Longtime User
After my previous question about variables the next one trouble i think is to make CRUD functions for a database project.
It is boring especially if you have too many tables. It's worst when we need to change database design.

So my question in this:
How are you dealing with CRUDs. Which is the most efficient method?
Not very sure about your question. I think you should go through the SQL tutorial.
Basically you can run 2 functions.
If you are using SELECT (Retrieve data) then you use ExecQuery (or ExecQuerySingleResult).
If you are using UPDATE, INSERT or DELETE then you just use ExecNonQuery.
 

pliroforikos

Active Member
Licensed User
Not very sure about your question. I think you should go through the SQL tutorial.
Basically you can run 2 functions.
If you are using SELECT (Retrieve data) then you use ExecQuery (or ExecQuerySingleResult).
If you are using UPDATE, INSERT or DELETE then you just use ExecNonQuery.
Thank you
I'm talking about repeating the same functions for different tables in the database which I find an incredibly boring process.
So i need thoughts about organizing the procedure.
 

sfsameer

Well-Known Member
Licensed User
Longtime User
Thank you
I'm talking about repeating the same functions for different tables in the database which I find an incredibly boring process.
So i need thoughts about organizing the procedure.
You could make a procedures for :

1- Update and insert
SQL:
 IF EXISTS(......)
 BEGIN
 .....Here put the update
 
END
ELSE
BEGIN
INSERT
.....Here put the insert

END
END

2- Select and delete
3- Use CASE scenarios meaning you could create one procedure for all of you table for adding and updating the data and you can update and add to the desired table according to the CASE description

Database management is a really big topic and that's why there are database administrator, database analyst , database quality manager and many many more job titles and each title has his own specific role

:)
 

aeric

Expert
Licensed User
Longtime User
Thank you
I'm talking about repeating the same functions for different tables in the database which I find an incredibly boring process.
So i need thoughts about organizing the procedure.
Not sure about others. I usually don’t make it more encapsulated. This will make another person taking my code even harder to understand my code in the future. I think it will make the code even difficult to modify for a specific scenario.
 
Top