Any recommended SQL query builders?

Game development with Board Game Arena Studio
User avatar
Vikti
Posts: 7
Joined: 08 January 2021, 23:56

Any recommended SQL query builders?

Post by Vikti »

Hi,

I'm just starting with BGA game development. Going through the tutorial, I was terrified that we are expected to write pure SQL. This is terrible developer experience, given the possibility of typos and the difficulty of debugging, I expect to save much time by using a query builder. After a quick googling, my best idea is to try adding https://github.com/nilportugues/php-sql-query-builder/

Does anyone have any experience with using a query builder in BGA? Do you have any recommended library to use?
User avatar
Hornir91
Posts: 38
Joined: 15 October 2018, 06:39

Re: Any recommended SQL query builders?

Post by Hornir91 »

Hi.

You shouldn't panic about SQL, because most of the time you need to write simple INSERT INTO, SELECT or UPDATE queries. You have also an access to DB, so you can actually test your queries on tables before implementing it in the code.

Also you can use Deck class with specific methods to query the DB.

You can already check how queries are build in Gomoku tutorial. https://en.doc.boardgamearena.com/Tutorial_gomoku
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Any recommended SQL query builders?

Post by Tisaac »

I have a custom query builder for BGA that I use in all my projects, with custom improved Deck module that works hand by hand, tell me if you're interested ;)
User avatar
Vikti
Posts: 7
Joined: 08 January 2021, 23:56

Re: Any recommended SQL query builders?

Post by Vikti »

Hi @Tisaac!

Yes, please! I'm definitely interested!

Could you share your code with me (under a permissive License).
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: Any recommended SQL query builders?

Post by RicardoRix »

I think the real answer is here, just learn SQL, it's not that tricky. As Hornir suggests, it's largely just SELECT, UPDATE.
Probably less tricky than using some else's library. And if you do use a library then it's likely you're still going to need some underlying SQL understanding to use it properly. For example, BGA provide some functions but you will still need to know SQL to know where the limitations might lie.
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Any recommended SQL query builders?

Post by Tisaac »

RicardoRix wrote: 10 January 2021, 15:42 I think the real answer is here, just learn SQL, it's not that tricky. As Hornir suggests, it's largely just SELECT, UPDATE.
Probably less tricky than using some else's library. And if you do use a library then it's likely you're still going to need some underlying SQL understanding to use it properly. For example, BGA provide some functions but you will still need to know SQL to know where the limitations might lie.
This is not about learning sql, but about saving time and make stuff more easier to read.
Query builder allow you construct partial queries that you can manipulate as any object and also auto cast when fetching. Really save me a lot of time on my games
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: Any recommended SQL query builders?

Post by RicardoRix »

Tisaac wrote: 10 January 2021, 16:36 This is not about learning sql,
Why not? Do you regret learning it?
Do you not have to have some SQL experience to use your query builder?

This feels like a run before you can walk scenario.
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Any recommended SQL query builders?

Post by Tisaac »

RicardoRix wrote: 10 January 2021, 17:24
Tisaac wrote: 10 January 2021, 16:36 This is not about learning sql,
Why not? Do you regret learning it?
Do you not have to have some SQL experience to use your query builder?

This feels like a run before you can walk scenario.
No, I am just saying this is not the topic. He is not asking about whether he should learn sql or not.
Of course knowing basic sql is a must have skills.
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: Any recommended SQL query builders?

Post by RicardoRix »

Tisaac wrote: 10 January 2021, 17:33 No, I am just saying this is not the topic. He is not asking about whether he should learn sql or not.
Of course knowing basic sql is a must have skills.
I agree, and using a library or tools is a good idea, but being 'terrified' of writing SQL suggests he doesn't know it.
User avatar
tchobello
Posts: 693
Joined: 18 March 2012, 13:19

Re: Any recommended SQL query builders?

Post by tchobello »

Tisaac wrote: 10 January 2021, 16:36
RicardoRix wrote: 10 January 2021, 15:42 I think the real answer is here, just learn SQL, it's not that tricky. As Hornir suggests, it's largely just SELECT, UPDATE.
Probably less tricky than using some else's library. And if you do use a library then it's likely you're still going to need some underlying SQL understanding to use it properly. For example, BGA provide some functions but you will still need to know SQL to know where the limitations might lie.
This is not about learning sql, but about saving time and make stuff more easier to read.
Query builder allow you construct partial queries that you can manipulate as any object and also auto cast when fetching. Really save me a lot of time on my games
well, sorry , but I tend to agree with Ricardo on this...

It's quite impossible, for starters on BGA, to understand what advanced developers have done here...
they are re-writing quite everything, creating their own tools, modules, objects everywhere and so on.
yes, they are saving time, doing it their own way... on each project.

But when I want to read it, it feels like reading 'Choose Your Own Adventure'...

Sometimes, I feel like a dinosaur.
Post Reply

Return to “Developers”