Include mysql

Hello,
i want to use mysql in JUCE (plugin) for the scool. However, I can only integrate the mysql folder in VST3, so I cannot make queries in PluginEditor.cpp. I downloaded mysql-connector and mysql-for-visualStudio. And have this involved. In the EQ_ShareCode on properties there is no selector “Linker” so I cannot integrate mysql either.

EQ_ShareCode

EQ_VST3

I also tried to download this package with NuGet, but I cannot download a certain package.
Is there another way to include mysql in EQ_ShareCode?

Another possibility would be to create a SQL.cpp and SQL.h file in the EQ_VST3 folder and to query it from there.
Selection_019

Unfortunately I don’t know how to use the value of a variable from SQL.cpp in PluginEditor.cpp. Even if I
create a function in SQL.cpp and use it in PluginEditor.cpp an error occurs

(ERROR: Reference to unresolved external symbol “” int_cdecl mainSQL (void) “(? MainSQL @@ YAHXZ) in function” “public: void_cdecl EQAudioProcessorEdior :: resize (void)” (? Resized @ EQAudioProcessorEditor @@ UEAAXXZ))

Thanks in advance

Integrating SQL is a bit of a funky ride. If possible, you might want to consider integrating SQL Lite into your project instead as there’s an effort to provide an amalgamated package of it: SQLite Download Page

You would apply the amalgamation by dropping in its .h and .c files into your project.

An alternative to the amalgamation would be to use Vinnie’s SQLite module (although, it is fairly dated now and would probably require some tweaking): VFLib/modules/vf_sqlite at master · vinniefalco/VFLib · GitHub


JUCE doesn’t provide integrating projects with NuGet. That being said, I sense some confusion because NuGet is intended for C#/.NET apps (at least to my knowledge!).

1 Like

oke thanks I’ll try that :slight_smile:

is it also possible to use the sqlite framework to connect to the mysql database?

Or do I have to create a database with sqlite to connect to it?

I have already created a website where I create, read and update the database users with php. I used mysql for that. Otherwise I have to recreate the database with sqlite and I also have to recreate the php file

AFAIK you have to convert between the formats… Maybe someone has a better idea though.

1 Like

You almost definitely want the MySQL library as a dependency of your sharedcode target not the vst3 target since your editor is in the sharedcode target. In cmake that happens if you make sql a lib dependency of your main plugin but don’t know what environment you are using,

1 Like

I’m still quite a beginner when it comes to programming. I just geoogleted what CMake files are, how I understood that you can edit files (programs). But how do you make the SharedCode file into the main plug-in so that I can integrate the mysql into it?

Selection_019

In this picture sql.cpp and h should be in EQ shared source not vst3.

I’m not sure how you got it into vst3 but undo that and put it in shared and it should work

1 Like

When you edit the project, instead of clicking proprties on the Project EQ_VST3 you open the properties of EQ_SharedCode. That’s the whole secret.
The other targets will include all contents of EQ_SharedCode indirectly, that’s why you would add common things there. And juce makes sure that all you need to worry about is in SharedCode.

1 Like

I actually only created two files and named them SQL.cpp and SQL.h. I created these files in VST3 because that is the only place of the three where I can integrate mysql

When I go to properties in EQ_VST3 there is a selector called “Linker”, but when I go to EQ_ShareCode
Go to properties the “Linker” selector is not available. I would need the selector “Linker” to include mysql, unless there is another way to include mysql

Ok I see. The SharedCode doesn’t produce a binary itself, so it doesn’t get linked.

You should still add your code the SQL.h and SQL.cpp in the SharedCode (even better add them in the Projucer! because the project files will get overwritten whenever you save in the Projucer).

The include path goes into the compiler settings of SharedCode, but the library and the library path go in all targets, i.e. EQ_Standalone and EQ_VST3.

The best way is to add the paths into Projucer, like mentioned before. To do so click on your exporter and add the library in the field “Extra libraries”, the header path in “Additionall Include Paths” and the linker path as well. Then save the project in Projucer and make sure VisualStudio reloads the project.

2 Likes

Yes that’s a fundamental point too. With juce your visual studio project snd so on are transient things which are a result of a build with projucer or more recently cmake. So don’t edit your visual studio file directly but rather modify your projucer or cmake settings accordingly

2 Likes

i have another error i google a bit but i think it should work

thank you all :slight_smile:

I have a quick question
I have created an application to test whether the SQL script works.

As I said, I have several errors. I found out why, for this I deleted the “Additional dependencies” in my sample SQL script. So the same errors have come. Sorry that I have the language in German. I’m here in Properties-> Configuration Properties-> Linker-> Input

My only question would be how do I add these additional dependencies in JUCE.

About the error: (reference to unresolved external symbol “mysql_error” in function resized) instead of “mysql_error” are “mysql_init”, “mysql_real_connect”, “mysql_query” and “mysql_store_result”

I hope this helps:

Hover over the “i” it says don’t add platform specific decorators, so the lib and the suffix .lib need to go…

Good luck

1 Like

Thank you that should work like this. But if I could still ask, the debugger says “No more available memory in heap” (Files from BinaryData * .cpp) should I delete these BinaryData files and have them debugged again?

I tried a little bit. I dragged this folder into the Projecer, but I figured out that it is not necessary. Now everything works as it should

thank you all :slight_smile: