MySQLPreparedStatement

Next version: “Prepared Statement Helper”, choose database server type, go.

Roger that!

I could need the help of our community please.

Which is the best Database Field Type to Xojo Type conversion for each Database Type please?

I’ve always tried to match them as closely as possible - and that’s going to depend on what database you’re using.

MySQL has types that should match almost identically to those in Xojo

Thank you Norman. As soon as i’ve released my update, i will post my matching list into this thread. So we can find possibly better matches in my app.

I am stuck a bit now, while working on multiple servertype support.

In a Module i have a Global Database Property (myDatabase), which will be set to the correct servertype at runtime (myDatabase = New mySQLCommunityServer f.e.).
But since i do set the type of Database at runtime, i can’t use the PORT property anymore. I always get the “Element does not exist” error when i call “myDatabase.Port =…”.

If its just a Database then thats correct

You’d actually have to either

  1. cast to the right type
  2. have a factory method you pass the right set of parameters to they creates the instance & sets the properties (using a cast) then returns that as a Database

I’m sure there are other ways but at some point you are likely going to need to cast it so do that in one & only one spot to localize and issues

Thank you. That works great.

Updated the App for Windows and Macintosh, to 1.2.
Added Support for MSSQL, SQLite, ODBC, Oracle and PostgreSQL PreparedStatements.
I am sure, there are some issues with the PreparedStatements of the non-mySQL Statements, but i need your help to iron them out please.
You can find the latest version at: http://www.schneppi-software.de/produkte/mysqlpsh/

Sascha - I tried ODBC with the DNS in the Name field and the Login and Password filled in. The Application crashes as soon as I click connect.

I also do not see a way to select a file for an SQLite database.

You may also want to rename you application now that you are supporting more than MySQL.

This looks very promising :slight_smile:

On my OS X Machine it also crashes as soon as it tries to connect.

This is the Code used to establish the ODBC Host connection:

[code]myDatabase = New ODBCDatabase
ODBCDatabase(myDatabase).DataSource = “”

myDatabase.Host = Window_Main.TextField_Host.Text
myDatabase.UserName = Window_Main.TextField_LoginName.Text
myDatabase.Password = Window_Main.TextField_Passwort.Text

If myDatabase.Connect Then 'This is where it crashes
Return True
Else
Return False
End If
[/code]

Try

[code]myDatabase = New ODBCDatabase
ODBCDatabase(myDatabase).DataSource = Window_Main.TextField_Host.Text

’ myDatabase.Host = Window_Main.TextField_Host.Text <- replaced by above
myDatabase.UserName = Window_Main.TextField_LoginName.Text
myDatabase.Password = Window_Main.TextField_Passwort.Text

If myDatabase.Connect Then 'This is where it crashes
Return True
Else
Return False
End If [/code]

I have found specifying the DataSource much more reliable than trying to get the selection dialog to appear.

You could change the “Host” label to “DataSource” if ODBCDatabase is selected.

Good idea! Thank you.

[quote=37598:@Sascha S]Updated the App for Windows and Macintosh, to 1.2.
Added Support for MSSQL, SQLite, ODBC, Oracle and PostgreSQL PreparedStatements.[/quote]

Amazing work, Sasha.

I suggest “Xojo Prepared Statements Helper”.

It’s getting great.

Another idea Sascha - The ability to override the field type that you set as the default. As an example when I use ODBC to connect to FileMaker all numbers are mapped to the Xojo Double type. Since many are actually integers it would be helpful to be able to flag them as such. Of course this adds the complexity of saving the override values in some fashion for repeat use.

Yea, Sascha, what I’m saying is that the lingua file looks like good english to me. Unless I’m missing something. See what I’m sayin:

Not sure what else to do with it. I started going through each node but I don’t know if that needs to happen. Let me know what to do.

If you just want to translate it to english, there’s nothing to do (unless i misspelled something) because i already translated it to english.
On a german system you should see my app running in german mode an on non-german systems, it should run in english mode.

This is really a great idea and something i will definitely add. But it will take some time because i need to extend the UI and rework most of the code.

It may later look like the UI in the image below.
You could then change the Field to Type conversion, by dragging and dropping the Types.

The english you made is good! So how do we get it into the UI? Do we import it somehow or do you add it in? Sorry, never used Lingua before.

I think we are talking past each other.
The program is primarily available in English. Only on German systems, it should start in German language.
So if you do not use a german system, you should always already see an English program.