Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SQL Connector Module  (Read 7269 times)

0 Members and 1 Guest are viewing this topic.

Niely

  • Full Member
  • ***
  • Posts: 101
    • View Profile
SQL Connector Module
« on: November 06, 2015, 07:50:21 pm »
Hello

A lot of games, and other applications of which the developing can be made easier and more productive using SFML, still require a database (for storing scores, or other data).

But SFML doesn't have an option, feature, or module to connect easily to a (My)SQL-database.
It'd be nice if SFML would have this, because I personally like the style of SFML more than the one of other libraries, and than the developer ain't forced to bloat his program with loads of different libraries; but can stick to a few, or even just one or two.

Maybe, this could be a handy feature for in the (far) future? :)

Thanks for reading,

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
SQL Connector Module
« Reply #1 on: November 06, 2015, 08:19:56 pm »
Getting such code right, efficient and then maintain it all is a lot of work that I don't see our team is having.
Then you need to start thinking of what to support. MySQL, PostgreSQL, SQLite, etc...
Honestly there are a ton of very good, well maintained and iften quite modern libraries out there, that do a way better job than we ever could.

If you're afraid of using libraries, then C++ is not really the place to be... ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SQL Connector Module
« Reply #2 on: November 06, 2015, 08:23:15 pm »
I don't think this fits in with a "multimedia library". And besides, there are already many libraries available that let you access databases. Why would SFML need to duplicate their functionality? Just use other libs for DB stuff.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: SQL Connector Module
« Reply #3 on: November 07, 2015, 10:42:00 am »
Yep, I agree. While having a simple and built-in database interface would be nice, it's really too much work to do and not really "edge case" implementation variety wise.

I often thought about a simple class to load and save settings in some way (possibly JSON or INI). While this wouldn't be as mighty as a full DBI, it would fit a lot better within the scope achievable right now and would also be more than enough for most common tasks or problems. Plus it wouldn't add more (significant) dependencies to SFML, considering there are many header only or minimalistic implementations out there.

Niely

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Re: SQL Connector Module
« Reply #4 on: November 07, 2015, 04:52:02 pm »
Getting such code right, efficient and then maintain it all is a lot of work that I don't see our team is having.
Then you need to start thinking of what to support. MySQL, PostgreSQL, SQLite, etc...
Honestly there are a ton of very good, well maintained and iften quite modern libraries out there, that do a way better job than we ever could.

If you're afraid of using libraries, then C++ is not really the place to be... ;)

Well, it's not that I'm afraid of using them (however, sometimes the building and adding to VS can be a real pain). But because I'm still a very beginner in C++ I don't think using tons of libraries are good for learning purposes, If I'd be able to understand the pure code after the libraries, and I'd know what's under the hood, I'd learn more from the language. SFML allows me to inspect that, other's would be harder.

But I understand that such a module indeed would be to much work.
I think I'll go with SQLAPI or maybe even MySQL-Connector/C++.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: SQL Connector Module
« Reply #5 on: November 07, 2015, 04:55:25 pm »
I would really suggest that you choose a library like CppDB which will give you an abstraction over your database backend. That way you can easily change your actual DB provider without changing your own code.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SQL Connector Module
« Reply #6 on: November 07, 2015, 05:04:17 pm »
I often thought about a simple class to load and save settings in some way (possibly JSON or INI).
No need to add anything to SFML for something like that. There are many existing good options available for something like that.
IMHO some good options are:
Libconfig : http://www.hyperrealm.com/libconfig/
PicoJSON : https://github.com/kazuho/picojson
« Last Edit: November 07, 2015, 05:13:33 pm by Jesper Juhl »

Satus

  • Guest
Re: SQL Connector Module
« Reply #7 on: November 07, 2015, 05:55:56 pm »
PicoJSON : https://github.com/kazuho/picojson

+1 to PicoJSON, I use it in my projects and it is very simple yet powerful.

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: SQL Connector Module
« Reply #8 on: November 07, 2015, 06:42:31 pm »
My personal favorite and pretty similar to picojson is:
https://github.com/nlohmann/json

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: SQL Connector Module
« Reply #9 on: November 08, 2015, 10:12:17 am »
No need to add anything to SFML for something like that. There are many existing good options available for something like that.
IMHO some good options are:
Libconfig : http://www.hyperrealm.com/libconfig/
PicoJSON : https://github.com/kazuho/picojson
Yep, picojson is what I've had in mind as well and since it's so easy to add, I didn't bother with it so far - there are more important things. :)

My personal favorite and pretty similar to picojson is:
https://github.com/nlohmann/json
Wow, didn't know that library. How does it compare to picojson (performance/memory footprint)? This looks very easy and intuitive to use, essentially what I've had in mind (since picojson wants you to check types etc. first).
« Last Edit: November 08, 2015, 10:14:59 am by Mario »

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: SQL Connector Module
« Reply #10 on: November 08, 2015, 01:14:29 pm »
To be honest, I can't really say how they compare in performance/memory footprint. For what I do/did with the libraries I can only say that they were more than fast enough.

The reason I switched to the nlohmann modern json was purely a syntax decision. It just felt more natural to use.