Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DbMetal: Don't know how to convert the SQL type 'system' into a managed type. Parameter name: dataType #238

Open
GoogleCodeExporter opened this issue Apr 24, 2015 · 9 comments

Comments

@GoogleCodeExporter
Copy link


What steps will reproduce the problem?
1.Using MySql Database having stored procedure returning recordset
2.after debuging LoadStoredProcedures function gives error due to retrun 
type of Stored Procedure is System.Byte[]


What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
0.20

Please provide any additional information below.

Original issue reported on code.google.com by singhaln...@gmail.com on 14 Apr 2010 at 1:37

@GoogleCodeExporter
Copy link
Author

We should look into migrating the MySql support to using DbSchemaLoader so that 
we can 
let MySql.Data.dll perform type conversions instead of using 
SchemaLoader.TypeMapping.cs.

Original comment by jonmpr...@gmail.com on 14 Apr 2010 at 3:20

  • Added labels: Component-DbMetal, Component-MySQL, Priority-Medium, Type-Defect

@GoogleCodeExporter
Copy link
Author

Whenever we work with dblinq version 0.19 and 0.20.1, it give an error 
first of all not to work with stored procedure error to 'dont know how 
to convert sqltype system to manged code' whereas perivious version 
0.17 generate the stored procedure . other problem  is MySql datatype 
time is defined by c# System.Timespan but dbmetal convert it to 
datetime in cs file when fetching data it gives an error. Please help 
me out or if this is a bug then can i expect the fix in next release? 

Original comment by singhaln...@gmail.com on 23 Apr 2010 at 3:33

@GoogleCodeExporter
Copy link
Author

up!

thx

Original comment by cldelaro...@gmail.com on 7 Jul 2010 at 3:01

@GoogleCodeExporter
Copy link
Author

I took a look at the source and have a *horrible* hack to get it working 
(needed a fix in a hurry).. I'll attempt to outline the problem so someone else 
with better regex knowledge can fix it properly!

>> HACK >> 
1- Download the source, and change line 48 of IDataTypeExtensions.cs to read; 
if (match.Success && rawType != "System.Byte[]")
2- On line 217 of SchemaLoader.TypeMapping.cs, add in another case statement; 
case "system.byte[]":
Rebuild and it should run ok (does for me, anyway)

>> ISSUE >> 
The regex used in UnpackRawDbType catches the System.Byte[] raw data type and 
matches the sqltype as "system", which doesn't correspond to any known data 
type. 

Hope that helps someone.

Original comment by keith.la...@gmail.com on 13 Aug 2010 at 6:32

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Hi everyone,

DbLinq version: 0.20.1
OS:     Win7 x64
MySQL:      5.5
.NET connector: 6.2.2.0

According to my investigation this bug has to do with determining proper return 
type for a MySQL function.  There's a total of 3 code modifications
to resolve the problem.  It would be great if someone with better knowledge of 
dblinq could validate the fixes and incorporate them into the 
next release.

Code change #1 - fixing the code generation problem

1) Open file:   src\DbLinq.MySql\MySqlSchemaLoader.StoredProcedures.cs
2) Find method ReadProcedure
3) Find line below and change the call to use GetString instead of GetAsString 
like below:

procedure.returns = rdr.GetString(field++);
//procedure.returns = rdr.GetAsString(field++);

Code change #2 - remove ` character that was preventing at least in my case 
proper compilation of generated code

One of ways to resolve this issue is to modify the file below.  There might be 
a better place for this change...

1) Open file \src\DbLinq.MySql\MySqlSchemaLoader.cs
2) Find function ParseProcParams 
3) Replace line: 
string paramString = inputData.param_list; 
with
string paramString = inputData.param_list.Replace("`", string.Empty);

Code change #3 - The IExecuteResult was failing the compilation.

There are two ways to fix one.  I went with a)
a) Use fully qualified path (with namespace) for IExecuteResult
b) Include namespace 

1) Open file \src\DbMetal\Generator\CodeDomGenerator.cs
2) Go to line 537 and replace 

new CodeTypeReference("IExecuteResult"),
with
new CodeTypeReference("System.Data.Linq.IExecuteResult"),


Phew... it works now =D

Original comment by ipsoft...@gmail.com on 14 Nov 2010 at 5:10

@GoogleCodeExporter
Copy link
Author

Please, try out the solution on the link below:
http://code.google.com/p/dblinq2007/issues/detail?id=132#c2

Original comment by tos.oliv...@gmail.com on 1 Apr 2012 at 1:21

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Hi,
Has this issue been resolved? I am still getting the same error of "DbMetal: 
Don't know how to convert the SQL type 'system' into a managed type. Parameter 
name: dataType" when i run the file "run_myMetal.bat". :-(

@ipsoft...@gmail.com : I am new to the C# world. First thing that i need is 
Linq to MySql to work. Is it in a stable stage now? When i do the changes 
mentioned by you, should i build the DbMetal.exe again from the src or is it 
referred internally.
Little more elaboration on the steps you have mentioned will help a lot.

Thanks,
Yogi

Original comment by worldofy...@gmail.com on 6 Apr 2012 at 4:26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant