Implementation n for n relationship in Delphi

Asked

Viewed 899 times

1

It may be something simple for most, but I would like to know how to implement in practice a n-to-n relationship between Mysql tables using Delphi.

I created the diagram of my BD in Mysql Workbench, created DB, all right. My question is: the tables created automatically when an n to n relationship is made I need to create a routine to save the data in this table when registering new records, or is it possible to do this automatically?

Complementing the post:

The system I’m running is for satisfaction research. I’ll have the tables: Client: Customer data searched: Research: Registration of research. Questions_search: table n:n joining the survey with the questions that are part of the survey Questions: Questions from all surveys Questions_options _answer: table n:n that joins the answer options of the question (they are all multiple-choice answers for each question) Options: All response options Answers: Table of the survey itself, which joins the question, the answer option Customer Reply: Connect the customer with the answers given.

For the registration of questions and answers, I think calm because I have to register first the questions and answers, to then connect the two in table n:n, the same in the register of response options. My question is really due to the table Answers_client, because when I register a new answer, I will already have to register in this table. I was wondering if you have anything automatic to save this related data.

In Delphi I will use the standard components for access to Databases, or even Zeos Access. Below the diagram.

Perhaps as I do not know very well this part of DB modeling, it may be that there is a simpler way to create this system, maintaining the flexibility of creating new searches, questions and response options.

Diagrama

  • Take a look at these links, maybe you can find something that can help. http://www.devmedia.com.br/master-detail-simples-e-descomplicado-para-iniciantes-delphi/20370 http://www.devmedia.com.br/quick-tips-mestre-detalhe-em-delphi/15676

  • Hey, got your problem solved?

1 answer

1

Delphi does not do this automatically. What you can do is implement an event afterpost of life and record the records in the N to N.

  • Thank you Edgar. And have some system that does automatically?

  • @user3771516 It is possible to do this with Hibernate, but I don’t think you have it for Delphi. You would have to do a webservice in java or .net and summon it using Delphi.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.