This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, our company is using a MyISAM MySql database.
Currently, there are some problems any time you add a table from the Server Explorer into the LightSpeed Model class. 1. It doesn't recognize that unsigned columns are unsigned (i.e. if the table column is an unsigned int, the type in the LightSpeed Model class will be an Int32 instead of a UInt32). 2. If the table name has no underscores, and is a single word (for example, the table is called "item"), then the table name in the LightSpeed Model class is left blank, and you have to manually type it in.
Also, there are way too many of the following errors: "InnerException: When casting from a number, the value must be a number less than infinity." This error occurs when the MySql column is an unsigned number (byte, short, int, etc.) and the LightSpeed Model class is a signed type. There needs to be a more elegant default behaviour for this case. It should not be throwing exceptions. We would like to purchase this software but the bugs are making it prohibitively difficult to work with. |
|
|
Thanks for letting us know about the issues with unsigned handling. We will look into these and hopefully have a fix for you soon. Regarding the Table Name attribute not being inferred, this is because if the table name is the same as the entity class name, LightSpeed automatically infers the table name at run time. The Table Name attribute is required only if the table name is different from the entity class name (or the plural thereof if LightSpeedContext.PluralizeTableNames is true). For example, if your entity is called Item, and your table is called Item (or Items), when the Table Name attribute is not required. So you shouldn't need to type it in. If this isn't working for you, please send us your LightSpeed model and your MySQL CREATE script and we will look into it. |
|
|
It's not inferring correctly - it is trying to look for a table name d"Item" (with a capital "I") when in fact the table name is "item" (with a lowercase "I"). So you have to manually name the table in the LightspeedModel class for it to work properly. |
|
|
Hmm, normally MySQL is case-insensitive, so when LightSpeed issues a query that refers to the Item table, MySQL maps that to the item table. This appears to be working for me using both the InnoDB and MyISAM engines (and using MySQL Administrator to create test tables). Is your MySQL database set up to be case-sensitive? If so, could you send me your CREATE script so I can reproduce the behaviour? Thanks! Just as an update on the unsigned issues, we have a fix for the designer so that it will infer UIntXx rather than IntXx for unsigned columns, and should have this in the next nightly build. We are looking at the casting issue. |
|
|
Hi, thank you. Here is the creation script:
CREATE TABLE `npc` (
I don't know if the "latin1" charset is what's messing it up or not ... I'm not very familiar with the MySql database.
Thanks a lot for the help so far. I am liking your software a lot from what I've seen - with just a few bug fixes I think it will be perfect for our needs |
|
|
Hmm, I tried that with the default entity class name of "Npc" (and no table name) and it worked okay. One thing I noticed was that the version of MySQL that we test against (5.0) did not accept the DEFAULT CHARSET table option -- it required DEFAULT CHARACTER SET. So I wonder if we are running different versions of MySQL with potentially different behaviour. Could you check which version of MySQL you are running? Could you also provide me a couple more bits of information about what happens when you try to query this table using the "Npc" capitalisation (i.e. with the Table Name attribute blanked out): 1. The SQL log. You can capture this by setting LightSpeedContext.Logger = new ConsoleLogger() and running your app under the debugger -- the SQL will show up in the Debug window. 2. The exception message and trace that you get when the query fails. Thanks for your patience and your help in tracking the problem down! |
|
|
I took out the "npc" under the table name attribute and left it as default, and I get this error: "MySqlException was unhandled. Table 'TDL_Game.Npc' doesn't exist" Where TDL_Game is the name of our database. The table definitely exists (it's called "npc") and the code works fine if I manually set the table name attribute to "npc".
My coworkers says the version of MySql is 5.0.45-LOG. The version of LightSpeed we are using is: 2.0.717.9215 Here is the full dump of the exception:
A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll
|
|
|
What OS is your MySQL server running on? Apparently MySQL's case sensitivity depends on the case sensitivity of the underlying file system, so if you are running on a Unix-based system, that could explain why you are seeing different results to us. Could you also check the value of the lower_case_table_names system variable? (I am making the assumption here that case-sensitivity is not an inherent part of your design, and that you would be willing to turn off case-sensitivity if that turns out to be the issue. Obviously if I am wrong and you do want to retain case-sensitivity then let me know we will review how we can support that in the designer.) By the way, the fix to generate UInt data types from unsigned MySQL columns has now been committed and will be in nightly builds numbered 20081007 and above. This may take a few days to actually make it onto the Web site though because of a server move. Let us know if you want it urgently. |
|
|
Yeah, the OS on the server is Unix-based. I will ask one of my coworkers who is more knowledgeable in MySql to check out the lower_case_table_names variable. I don't want to accidentally break anything :) Thank you so much for the fix. We can wait for the nightly build to show up, we're not in a super rush. |
|
|
Okay, that probably explains the behaviour. If your design permits, we would recommend turning off case sensitivity. I believe you can do this even on Unix by setting the lower_case_table_names variable to 1. Section 9.2.2 of the MySQL manual has more info (and provides some recommendations for the Unix/Windows cross-platform scenario), but you'll want to check with your MySQL expert(s) whether they're comfortable with doing this (again, see that section of the manual for considerations about changing the lower_case_table_names setting of an already existing database). As you are clearly planning to do, please sanity check anything I say or suggest with your MySQL expert(s) -- I'm not very knowledgeable about MySQL and I may be getting things wrong. |
|
|
Thank you, I will talk with the database guy over here.
I downloaded the nightly build and it fixed the signed/unsigned feature, which is awesome. The last remaining bug is that in the designer, it keeps wanting to change the Byte values into Int16's. For some reason it is not recognizing that TINYINTS correspond to Byte values. |
|
|
Just as a heads up SpinMasterStudios, could you please update your email address? It appears that it is incorrect as I keep getting bounced emails stating your mailbox doesn't exist when our forums try to email you a notification of a new post :-) Clicking on your name in one of your forum replies should provide this capability. Thanks, John-Daniel |
|
|
We were converting tinyints to shorts instead of bytes. I have committed a fix and tinyints will be mapped to bytes in future nightlies (numbered 20081009 and above). (Also, I noticed that the Update Database feature wasn't handling unsigned types, so if you run into that problem, that also will be fixed in the next nightly.) |
|