matriphe / mssql2mysql

Simple MS SQL to MySQL PHP script converter
30 stars 26 forks source link

Handling a negative maximum length #3

Closed surfer190 closed 9 years ago

surfer190 commented 9 years ago

I noticed that for a particular field a value of -1 was returned from the information_schema query for $row['CHARACTER_MAXIMUM_LENGTH'].

The resulting mysql create script was trying to create a field of negative length. To handle this I suggest:

if ($row['CHARACTER_MAXIMUM_LENGTH'] < 0){
                            $row['CHARACTER_MAXIMUM_LENGTH'] = 255;
                        }

What is you opinion?

matriphe commented 9 years ago

Hmm.. I've never found this. I think it's a good patch. :D

matriphe commented 9 years ago

Done, @surfer190