MySql Schema Install Script and Delimiters

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
10/27/2011 9:28:55 AM
Gravatar
Total Posts 81
Website Hobbyist and Software Engineer
Proud member of the mojoPortal team
www.doan.me

MySql Schema Install Script and Delimiters

I am still quite a novice when it comes to MySql, but I am building a feature and wanted to be able to support MySql as a database for the feature. I tried to mimic what I had done with MSSQL and created Stored Procedures for performing all transactions with the database. All is working well except for when I came to creating the Schema Install Script for MySql. I created a script and it runs fine with the MySql tools, but when it comes to running the script from the mojoPortal Setup it gets errors. After investigating the stack trace I am getting the idea that when the MySqlScript class performs its Execute method it is not liking/recognizing the Delimiter value that I use in my script ('$$'). From examples that I have seen for the MySqlScript, if you want to use delimiters you must set its Delimiter property to the delimiter value that you are using. From a quick look at some of the code in the stack trace it does not look like the mojoPortal Setup code sets that value for the MySqlScript object it creates.

Am I incorrect? Is there a "default" delimiter value that mojoPortal sets that I should be using in my Schema Install Script? Is there a way to tell Setup what delimiter value I am using?

Any guidance with this would be great.

Thanks!

10/27/2011 9:44:53 AM
Gravatar
Total Posts 18439

Re: MySql Schema Install Script and Delimiters

Hi Kerry,

Our MySql Data layer doesn't use any stored procedures so I'm not sure about any issues creating them from script. We are not setting the delimiter so it uses the default ; 

Changing that would break our installation scripts. I understand from this doc why one would need a different delimiter when running scripts with stored procedures because the procedures have multiple statements in them delimited by ;. But it would be hard to support that in our setup system because it would have to be context aware and know which scripts needed a different delimiter and which would need the default delimiter.

We do use stored procedures in our MS SQL data layer but doing so makes it more work to maintain. I find it much easier to maintain our other data layers because they mostly don't use stored procedures. We've supported use of MySql since way back before they even had stored procedures but once they had them I didn't see any great need to start using them.

To use stored procedures in your custom features MySql data layer you may need to implement your own routine for running the scripts. Probably much easier if you just implement your MySql data layer without them like we do. We have codesmith templates that can generate a lot of the starting code for MySql data layer by pointing the generator scripts at an MS SQL table.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.