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

Sproc support for Oracle and SQL Server #83

Merged
merged 42 commits into from
Aug 16, 2014
Merged

Conversation

colinbull
Copy link
Collaborator

Lots of changes here... but to summarize this PR provides the following,

  • Support for stored procedures
    • On oracle multiple OUT cursors are supported
    • Oracle packages, procedures and functions
    • Clob, Blobs and XML types are mapped to their .NET counterpart, this is achieved by simply finding and extracting the parameter value.
    • MARS sprocs on sql server
  • Support for scalar valued functions
  • Because it some DB's oracle don't expose any information about the schema of the cursor returned the SqlEntity now has a SqlEntity.MapTo<'a>() function. This is pretty niave at the minute but works for Records and class types. Additionally, has some mapping conventions, underscores are removed and are matched on lower case strings.
  • MapTo<'a> has an overload so you have tighter control over how individual properties are mapped. See the SqlServerTests.fsx or Oracle.fsx for an example.

Support for other providers should be along the lines of a copy of one oracle or SqlServer I should imagine but I focused on these two first, MySql will be next.

Cheers

Colin

should really do this for all of the DB's 👍
Should now be able to Quote Unions and Records
Note: Postgresql is the only one not working for the minute because of
the manual type mapping that is required. Seems to be a problem with how
the actual driver is implemented.
This might seem a wierd thing to to in a type provider but since there
is no way to reason about the type set returned from a sproc when it is
a ref cursor or a MARS set, this seemed like the most natural thing to
do.
This enables various scenarios like mapping Json or Xml into a type
richer than a string.
Are named parameters on DU's not supported on travis?
@colinbull
Copy link
Collaborator Author

Might want to leave this open until PostgreSQL and MySql support is sorted..

@colinbull
Copy link
Collaborator Author

Quick update, MYSQL support is nearly done, but has been way more of a PITA than the other providers, Postgre is next but I have spiked this and looks straight forward.

@pezipink
Copy link
Contributor

Great work Colin, I am looking forward to seeing the results of all this effort. I'd hoped you would be around at the F# meetup last week so we could discuss, but alas !

@colinbull
Copy link
Collaborator Author

Yeah, it is kinda hard for me to get down there these days as I'm contracting 9-5 in Coventry. Hoping to make the next one though whenever that is.

@colinbull
Copy link
Collaborator Author

To summarize all of these commits add sproc support, for MySQL, MS SqlServer, Oracle and PostgreSQL. There isn't quiet feature parity across all of these providers, mainly because some drivers / databases just do not yield this information. However Oracle and SQL Server are the most complete.

@pezipink
Copy link
Contributor

Is this ready to be merged now then in your opinion Colin ?

@colinbull
Copy link
Collaborator Author

Yep, it all hangs together. The best way to get the final bugs out will be to test on real world databases.

@colinbull
Copy link
Collaborator Author

So whats the plan for this, with regards to @simonhdickson splitting apart of stuff?

@simonhdickson
Copy link
Contributor

I think if your stuff is ready to merge then I'll merge it into my split branch too, that branch isn't ready to merge into master yet.

@pezipink
Copy link
Contributor

I'll merge this to master a bit later hopefully when I have got some time to test it all post-merge

@colinbull
Copy link
Collaborator Author

Groovy, there are a set of DB scripts that I have been using for the test DB's here if that is any help, I also have a set of VM's with the databases installed but thats about 40GB, which is a little large to commit.

pezipink added a commit that referenced this pull request Aug 16, 2014
Sproc support for Oracle and SQL Server
@pezipink pezipink merged commit 9d71c29 into fsprojects:master Aug 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants