Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlpp11-connector-odbc v0.01 #67

Closed
Erroneous1 opened this issue Feb 23, 2016 · 5 comments
Closed

sqlpp11-connector-odbc v0.01 #67

Erroneous1 opened this issue Feb 23, 2016 · 5 comments

Comments

@Erroneous1
Copy link
Contributor

I made an ODBC connector for sqlpp11. From what I can tell, using an ODBC connector for MySQL will allow you to connect to a MySQL database without becoming GPL because ODBC uses replaceable binaries (.so/.dll files) for the connectors and MySQL's components can easily be replaced by any other ODBC compliant database. While ODBC is available on Windows I don't think sqlpp11 is capable of wide characters, so ASCII encoded SQL would be a requirement. For thread safety, I would not share a connection object between threads, but you could pass the connection_config object to make a new connection in each thread.

Let me know if there are any issues I should correct.

@rbock
Copy link
Owner

rbock commented Feb 23, 2016

Hi,

That sounds very promising! As far as I can tell from your description, there are no critical issues.

Regarding encoding: I use sqlpp11 with UTF-8 most of the time.

I haven't really thought about wide strings yet. Assuming you don't need table or column names to be presented internally as wide character sequences, the main thing would be to allow wide character strings as text, I think. That might be just a few lines of code in the main library, actually. And then you could work with a serializer that produces SQL with wide characters...

Maybe you want to experiment with that?

Let me know when you think it is ready to be tested or used by others. I will add a link to sqlpp11's readme.

@Erroneous1
Copy link
Contributor Author

I use UTF-8 myself as well because I'm mainly a Linux developer. When I do have to do Windows I always just do everything in ASCII because wide characters make no sense to me in a UTF-8 enabled world.

I think I should test update, remove, and the dynamic_ variants before I'd say it is ready, but if those behave the same way as either select or insert I'd say it should be ready now. BTW, is there a way to iterate through a results row by column, say for printing the values? In my ODBCTest.cpp I've got some functions to print out the returned results, but it would be nice if I could iterate over the columns instead of breaking everything up into different lines (especially since "NULL" isn't the same type as a given column so I can't use a ternary operator).

@rbock
Copy link
Owner

rbock commented Feb 23, 2016

As of now, there is no way to iterate through the columns. But it should be quite simple to add an accept method that takes a visitor argument.

Actually, there already are such methods, see for instance _bind() in result_row.h.

You could either submit a pull request with an accept method or write an issue (the latter will probably take a few days to get dealt with).

@rbock
Copy link
Owner

rbock commented Apr 17, 2016

Hi,

Any update on the odbc connector? Do you think it makes sense to link to it already?

Best,

Roland

@Erroneous1
Copy link
Contributor Author

Yes link away. For some reason I thought you meant binary link instead of hyper link.

I tested insert, update, select, and delete. Should work fine, though I personally am considering it experimental until I finish a project using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants