Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc6c8473d6 | ||
|
|
7f0542b133 | ||
|
|
9f187b5dd0 |
No files matched your search
@@ -15,5 +15,3 @@ Makefile.in
|
||||
mono-*.tar.gz
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
mono.pc
|
||||
mono.spec
|
||||
@@ -1,90 +1,3 @@
|
||||
2003-05-02 Miguel de Icaza <[email protected]>
|
||||
|
||||
* runtime/Makefile.am ($(monobins_DATA)): Use explicit file names
|
||||
for the target exe binaries.
|
||||
|
||||
Copy cilc.exe and secutil.exe from the right paths to the right
|
||||
location.
|
||||
|
||||
Add missing assemblies.
|
||||
|
||||
2003-05-02 Alp Toker <[email protected]>
|
||||
|
||||
* data/config.in: new dll mapping entry for libglade
|
||||
|
||||
2003-05-01 Duncan Mak <[email protected]>
|
||||
|
||||
* scripts/Makefile.am:
|
||||
* runtime/Makefile.am: Install cilc and ilasm.
|
||||
|
||||
2003-04-29 Dietmar Maurer <[email protected]>
|
||||
|
||||
* mono/tests/Makefile.am (JITTEST_PROG): use mini/mono
|
||||
|
||||
2003-04-16 Charles Iliya Krempeaux <[email protected]>
|
||||
|
||||
* doc/web/team.xml : Added myself to it.
|
||||
|
||||
2003-04-10 Duncan Mak <[email protected]>
|
||||
|
||||
* doc/web/render-team-page.cs: Make the names of the element be
|
||||
lowercase instead. BenM says this makes it XHTML compliant; heck,
|
||||
I'm generating this from an XmlDocument already, why not make it
|
||||
XHTML compliant?
|
||||
|
||||
2003-04-10 Duncan Mak <[email protected]>
|
||||
|
||||
* doc/web/render-team-page.cs (Compare): Correctly fix
|
||||
ContributorComparer.
|
||||
(RenderHtml): Add some SetAttribute loving to make it render prettier.
|
||||
|
||||
* doc/web/team.xml: Revert excessive indenting.
|
||||
|
||||
2003-04-07 Martin Baulig <[email protected]>
|
||||
|
||||
* mono/mini/: Added this directory to the build; install `mini'
|
||||
and `libmini.la'.
|
||||
|
||||
2003-04-07 Duncan Mak <[email protected]>
|
||||
|
||||
* doc/web/render-team-page.cs: Fix ContributorComparer.
|
||||
|
||||
2003-04-04 Duncan Mak <[email protected]>
|
||||
|
||||
* doc/web/render-team-page.cs: Make it use 'none.png' if no image
|
||||
are specified in the XML.
|
||||
|
||||
* doc/web/team.xml: Remove the comment.
|
||||
|
||||
* doc/web/render-team-page.cs: Make it not output a full HTML file.
|
||||
|
||||
2003-04-04 Duncan Mak <[email protected]>
|
||||
|
||||
* doc/web/commands:
|
||||
* doc/web/makefile: Add team page information.
|
||||
|
||||
* doc/web/team.xml:
|
||||
* doc/web/render-team-page.cs: Code for rendering a team page.
|
||||
|
||||
2003-04-02 Duncan Mak <[email protected]>
|
||||
|
||||
* doc/web/makefile: Add a new make target for generating a team
|
||||
page on go-mono.com.
|
||||
|
||||
2003-04-04 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Added check for GC_gcj_malloc.
|
||||
|
||||
2003-04-04 Martin Willemoes Hansen <[email protected]>
|
||||
|
||||
* man/sqlsharp.1: changed pass= to password= for the
|
||||
PostgreSql provider.
|
||||
|
||||
>>>>>>> 1.166
|
||||
2003-03-31 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* data/machine.config: added SessionStateModule to httpModules section.
|
||||
|
||||
2003-02-13 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* data/machine.config: added default sessionState section and handler.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
AC_INIT(README)
|
||||
AC_CANONICAL_SYSTEM
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(mono,0.24)
|
||||
AM_INIT_AUTOMAKE(mono, 0.23)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
#
|
||||
@@ -186,10 +186,6 @@ case "x$gc" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "x$gc" = xboehm; then
|
||||
AC_CHECK_FUNCS(GC_gcj_malloc)
|
||||
fi
|
||||
|
||||
if test x$platform_win32 = xno; then
|
||||
dnl ******************************************************************
|
||||
dnl *** Check for large file support ***
|
||||
@@ -563,7 +559,6 @@ mono/monograph/Makefile
|
||||
mono/jit/Makefile
|
||||
mono/io-layer/Makefile
|
||||
mono/handles/Makefile
|
||||
mono/mini/Makefile
|
||||
runtime/Makefile
|
||||
scripts/Makefile
|
||||
man/Makefile
|
||||
|
||||
@@ -12,6 +12,5 @@
|
||||
<dllmap dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0.so" />
|
||||
<dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0.so" />
|
||||
<dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0.so" />
|
||||
<dllmap dll="libglade-2.0-0.dll" target="libglade-2.0.so" />
|
||||
<dllmap dll="oci" target="clntsh" />
|
||||
</configuration>
|
||||
@@ -35,7 +35,6 @@
|
||||
<httpModules>
|
||||
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule, System.Web" />
|
||||
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule, System.Web" />
|
||||
<add name="SessionStateModule" type="System.Web.SessionState.SessionStateModule, System.Web" />
|
||||
</httpModules>
|
||||
<authentication mode="Forms">
|
||||
<forms name=".MONOAUTH" loginUrl="login.aspx" protection="All" timeout="30" path="/">
|
||||
|
||||
@@ -5,7 +5,7 @@ WEB_FILES= \
|
||||
oledb papers \
|
||||
passport plans porting postgresql ppc projects rationale \
|
||||
resources roadmap runtime sqlclient sqlite sybase tdsclient \
|
||||
tds-providers team status testing thanks tools \
|
||||
tds-providers team status team testing thanks tools \
|
||||
porting anoncvs monodoc-xml winforms
|
||||
|
||||
OTHERS= pending resources-pending todo mono-build.sh mono-build-w32.sh
|
||||
|
||||
@@ -9,10 +9,8 @@
|
||||
|
||||
There is work underway for both systems. The Web Forms
|
||||
support is more advanced at this point, and various ".aspx"
|
||||
programs can be run using the Mono runtime, including IBuySpy.
|
||||
|
||||
ASP.NET works either embedded into
|
||||
our XSP server test server or the mod_mono Apache module.
|
||||
programs can be run using the Mono runtime (embedded into
|
||||
either the XSP server or the mod_mono Apache module).
|
||||
|
||||
We are now working bug fixing and adding missing features
|
||||
after making the whole pipeline compatible with MS.
|
||||
@@ -21,15 +19,15 @@
|
||||
SoapFormatter as part of the remoting infrastructure already
|
||||
(contributed by Jesus), most people will be using the ASP.NET
|
||||
Web Services support. Work for the supporting class libraries
|
||||
just started recently.
|
||||
|
||||
The major missing element is a complete XmlSerializer.
|
||||
just started recently.
|
||||
|
||||
** HttpRuntime
|
||||
|
||||
Patrik has authored most of the HttpRuntime support (both on
|
||||
the System.Web and on the foundation).
|
||||
|
||||
We are currently working on this.
|
||||
|
||||
** XSP
|
||||
|
||||
This is where initial development of the .aspx/.ascx/.asax compiler
|
||||
@@ -41,7 +39,7 @@
|
||||
classes of this new server can be reused/extended to make an apache
|
||||
module/cgi using mono (MonoWorkerRequest and MonoApplicationHost).
|
||||
|
||||
There is also a set of .aspx pages to test the server along with
|
||||
There is also a bunch of .aspx pages to test the server along with
|
||||
a few user controls under xsp/test.
|
||||
|
||||
You can check it out from CVS and run 'make install' to test it.
|
||||
@@ -58,12 +56,18 @@
|
||||
DataGrid and DataList controls are being finished by Gaurav.
|
||||
Xml control needs some work on System.Xml related to XSL.
|
||||
|
||||
Help in making the controls better is appreciated.
|
||||
** Extending ASP.NET
|
||||
|
||||
** ASP.NET and free controls.
|
||||
Currently you have to reference in your ASP.NET the control
|
||||
and all of its properties, which works fine if you have a GUI
|
||||
designer, but is harder for people used to develop using text
|
||||
editors.
|
||||
|
||||
We want to encourage developers to create open source controls
|
||||
that can be used both on Mono's ASP.NET and Microsoft's ASP.NET.
|
||||
Since we have a parser, we could extend this parser to allow
|
||||
people to still use ASP.NET controls, using a simpler syntax.
|
||||
For example people doing blogs and editing their templates
|
||||
over the web probably do not want to use direct ASP.NET but a
|
||||
wrapper around it.
|
||||
|
||||
* Web Forms: The pieces (historical)
|
||||
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
* Mono Books
|
||||
|
||||
<a href="http://www.amazon.de/exec/obidos/ASIN/3827264928/qid=1050051051/sr=2-1/ref=sr_2_3_1/028-2755135-1623712">
|
||||
Mono: .NET-kompatible Anwendungen mit dem Open Source-Framework
|
||||
</a>
|
||||
|
||||
* C# Books
|
||||
|
||||
A Programmer's Introduction to C# - Second Edition: Eric Gunnerson
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
* MCS: The Ximian C# compiler
|
||||
|
||||
The Mono C# compiler is considered feature complete at this
|
||||
point and relatively mature. MCS is able to compile itself
|
||||
and many more C# programs (there is a test suite included that
|
||||
you can use). It is routinely used to compile Mono, roughly
|
||||
half a million lines of C# code.
|
||||
MCS is currently able to compile itself and many more C#
|
||||
programs (there is a test suite included that you can use).
|
||||
It is routinely used to compile Mono, roughly half a million
|
||||
lines of C# code.
|
||||
|
||||
* Pending tasks
|
||||
|
||||
There are a few known bugs in the Mono C# compiler, but
|
||||
they are very very few at this point,
|
||||
We are in feature completion mode right now. There are still
|
||||
a couple of areas that are not covered by the Mono compiler, but
|
||||
they are very very few at this point (security attributes),
|
||||
you can also browse the MCS <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FMCS&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&form_name=query">bugs</a> from Bugzilla.
|
||||
|
||||
A test suite is maintained to track the progress of
|
||||
|
||||
@@ -20,11 +20,6 @@
|
||||
|
||||
**** TODO
|
||||
<ul>
|
||||
* The current implementation of <code>CryptoStream</code> is
|
||||
very limited and contain known bugs (<a
|
||||
href="http://bugzilla.ximian.com/show_bug.cgi?id=40689">
|
||||
40689</a>). The class need to be re-designed.
|
||||
|
||||
* Support for adding/modifying OID using the
|
||||
<code>machine.config</code> configuration file (algorithms
|
||||
are done).
|
||||
@@ -59,10 +54,9 @@
|
||||
classes named <code>*CryptoServiceProvider</code>, with the
|
||||
exception of <code>RNGCryptoServiceProvider</code> (which
|
||||
resides in the runtime).
|
||||
|
||||
* Look at assembly Mono.Security.Win32 if you require more
|
||||
compatiblity with the Microsoft implementation (like accessing
|
||||
a particuliar keypair container inside a specific CSP).
|
||||
a particuliar keypair container in a CSP).
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -75,13 +69,13 @@
|
||||
|
||||
* Software Publisher Certificates (SPC) used by Authenticode
|
||||
(tm) to sign assemblies are supported (extraction from PE
|
||||
files) but <b>not yet</b> validated.
|
||||
files) but <b>not</b> validated.
|
||||
|
||||
* Unit tests are generated from a set of existing certificates
|
||||
(about a dozen) each having different properties. Another
|
||||
set of certificates (more than 300) are used for a more
|
||||
complete test (but isn't part of the standard test suite for
|
||||
size and time consideration, i.e. a 3.5Mb C# source file).
|
||||
size and time consideration).
|
||||
</ul>
|
||||
|
||||
**** TODO
|
||||
@@ -110,10 +104,6 @@
|
||||
CryptoAPI's validation) when <code>IsCurrent</code> is called.
|
||||
See assembly <b>Microsoft.Web.Services</b> for more details.
|
||||
|
||||
* The class Mono.Security.X509.X509Certificate (in Mono.Security
|
||||
assembly) is becoming a much better alternative - and will
|
||||
continue to evolve to support the security tools.
|
||||
|
||||
* Microsoft implementation of <code>X509Certificate</code> is
|
||||
done by using CryptoAPI (unmanaged code). From the exceptions
|
||||
thrown Authenticode(tm) support is done via COM.
|
||||
@@ -149,51 +139,30 @@
|
||||
<hr>
|
||||
** Assembly: Mono.Security
|
||||
|
||||
<b>Rational</b>
|
||||
This assembly provides the missing pieces to .NET security. On Windows
|
||||
CryptoAPI is often used to provide much needed functionalities (like
|
||||
some cryptographic algorithms, code signing, X.509 certificates).
|
||||
|
||||
*** Namespace: Mono.Security
|
||||
<ul>
|
||||
* Structures (ASN1, PKCS7) and primitives (PKCS1).
|
||||
</ul>
|
||||
*** Namespace: Mono.Security.Authenticode
|
||||
<ul>
|
||||
* Code signing and verification.
|
||||
* Support for SPC files and PVK files.
|
||||
</ul>
|
||||
*** Namespace: Mono.Security.Cryptography
|
||||
<ul>
|
||||
* Additional algorithms: MD2, ARCFOUR (required for SSL)
|
||||
* Convertion helpers
|
||||
</ul>
|
||||
*** Namespace: Mono.Security.X509
|
||||
<ul>
|
||||
* X.509 certificate building and decoding.
|
||||
</ul>
|
||||
*** Namespace: Mono.Security.X509.Extensions
|
||||
<ul>
|
||||
* X.509 extensions (from X.509, PKIX, Netsapce, Microsoft,
|
||||
Entrust...).
|
||||
</ul>
|
||||
|
||||
**** Status
|
||||
<ul>
|
||||
* Some part of the work has not yet been commited (cleaning up).
|
||||
* Work has been under way for quite some time - and should
|
||||
start hitting CVS soon.
|
||||
|
||||
* A big part of this assembly is also included inside Mono's
|
||||
corlib. The class are duplicated in this assembly so the
|
||||
functionalities can be used without a dependency on Mono's
|
||||
functionalities can be used with a dependency on Mono's
|
||||
corlib (which depends on Mono's runtime).
|
||||
|
||||
* Unit test coverage isn't (yet) complete.
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
** Assembly: Mono.Security.Win32
|
||||
|
||||
<b>Rational</b>
|
||||
This assembly goal is to provide maximum compatibility with CryptoAPI
|
||||
to application running with Mono's runtime on the Windows operating
|
||||
system.
|
||||
@@ -203,9 +172,6 @@
|
||||
</code> configuration file (and then only if this increased
|
||||
compatibility is required by an application).
|
||||
|
||||
See the file <code>/mcs/class/Mono.Security.Win32/README</code> for
|
||||
complete instructions.
|
||||
|
||||
*** Namespace: Mono.Security.Cryptography
|
||||
|
||||
**** Status
|
||||
@@ -227,18 +193,11 @@
|
||||
* Wrapper classes for unmanaged versions of symmetric
|
||||
encryption algorithms (like DES, TripleDES, RC2 and others
|
||||
present in default CSP).
|
||||
|
||||
* Wrapper classes for unmanaged versions of asymmetric
|
||||
algorithms (like DSA and RSA) which persist their keypair
|
||||
into the specified CSP.
|
||||
</ul>
|
||||
|
||||
**** Ideas
|
||||
<ul>
|
||||
* Similar assembly could be created for <a href="http://www.openssl.org">
|
||||
OpenSSL</a>, NSS, crypto++, cryptlib ... for improved
|
||||
performance and/or HSM support under Linux.
|
||||
</ul>
|
||||
<hr>
|
||||
** Assembly: Microsoft.Web.Services
|
||||
|
||||
@@ -259,8 +218,8 @@
|
||||
Microsoft before commiting anything related to WS-Security into CVS.
|
||||
</b>
|
||||
|
||||
*** Namespace: Microsoft.Web.Services.Security [*]
|
||||
*** Namespace: Microsoft.Web.Services.Timestamp [*]
|
||||
*** Namespace: Microsoft.Web.Services.Security
|
||||
*** Namespace: Microsoft.Web.Services.Timestamp
|
||||
|
||||
**** Status
|
||||
<ul>
|
||||
@@ -272,8 +231,8 @@
|
||||
**** Status
|
||||
<ul>
|
||||
* Nothing (yet) commited in CVS. However the classes in this
|
||||
namespace are outside WS-Security scope. So development, for
|
||||
those, could be done without signing any agreements.
|
||||
namespace are outside WS-Security scope. So development
|
||||
could be done without signing any agreements.
|
||||
</ul>
|
||||
|
||||
**** TODO
|
||||
@@ -302,9 +261,6 @@
|
||||
* <code>cert2spc</code> is a tool to transform multiple X.509
|
||||
certificates and CRLs into a Software Publisher Certificate
|
||||
(SPC) file - which is a long name for a simple PKCS#7 file.
|
||||
|
||||
* <code>makecert</code> to create X.509 test certificates that
|
||||
can be used (once transformed in SPC) to sign assemblies.
|
||||
</ul>
|
||||
|
||||
**** TODO
|
||||
@@ -318,20 +274,20 @@
|
||||
for signing and validating Authenticode(tm) signatures on
|
||||
assemblies (or any PE file).
|
||||
|
||||
* <code>makecert</code> to create X.509 test certificates that
|
||||
can be used (once transformed in SPC) to sign assemblies.
|
||||
|
||||
* Other tools like a, GUI-based, certificate manager...
|
||||
</ul>
|
||||
|
||||
Note that many of the tools requires the class library and/or the
|
||||
runtime to be ready for them. E.g. StrongName and Authenticode signatures
|
||||
tools are of limited use until supported by the runtime.
|
||||
runtime to be ready for them.
|
||||
|
||||
<hr>
|
||||
** Other stuff
|
||||
|
||||
<ul>
|
||||
* SSL/TLS for secure communication (a prototype is under way).
|
||||
Some work is already visible in Mono.Security assembly (e.g.
|
||||
RC4).
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -344,7 +300,7 @@
|
||||
|
||||
Write some documentation on the cryptographic classes for the
|
||||
<a href="http://go-mono.com/tutorial/html/en/index.html">Mono
|
||||
Handbook</a> as I'm not a very good writer (at least in English).
|
||||
Handbook</a> as I'm not a good writer (at least in English).
|
||||
|
||||
Optimization can also be done on algorithms as crypto is never fast
|
||||
enough. Just be sure to test every optimization (using the unit test)
|
||||
@@ -355,4 +311,4 @@
|
||||
informations about the status of the cryptographic classes.
|
||||
|
||||
<hr>
|
||||
Last reviewed: April 7, 2003 (post mono 0.23)
|
||||
Last reviewed: March 4, 2003 (post mono 0.21)
|
||||
@@ -13,145 +13,6 @@
|
||||
section</a>, the <a
|
||||
href="http://www.go-mono.org/faq.html">FAQ</a>.
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr bgcolor="#DDDDDD">
|
||||
<td>
|
||||
<b>Release 0.23</b><br>
|
||||
<a href="archive/mono-0.23">Release notes</a><br>
|
||||
March 5, 2003
|
||||
</td>
|
||||
<td>
|
||||
<table cellspacing="1" cellpadding="3">
|
||||
<tr bgcolor="#BBBBBB">
|
||||
<td>
|
||||
<b>Source Code</b>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li><a href="archive/mcs-0.23.tar.gz">Mono Class Libraries and C# Compiler.</a>
|
||||
<li><a href="archive/mono-0.23.tar.gz">Mono Runtime</a>
|
||||
<li><a href="archive/gc6.1.tar.gz">Boehm GC 6.1</a>
|
||||
<li><a href="archive/xsp-0.3.tar.gz">XSP web server (0.3)</a>
|
||||
<li><a href="archive/mono-debugger-0.2.2.tar.gz">Mono Debugger 0.2.2</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#BBBBBB">
|
||||
<td>
|
||||
<b>Source RPMs</b><br>
|
||||
(No RPMS for XSP).
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li><a href="archive/libgc-6.1-1.src.rpm">libgc-6.1-1.src.rpm</a>
|
||||
<li><a href="archive/mono-0.23-1.src.rpm">mono-0.23-1.src.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#999999">
|
||||
<b>Red Hat 7.3/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/redhat-73-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-73-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-73-i386/mono-0.23-1.i386.rpm">mono-0.23-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-73-i386/mono-devel-0.23-1.i386.rpm">mono-devel-0.23-1.i386.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td bgcolor="#999999">
|
||||
<b>Red Hat 7.2/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/redhat-72-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-72-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-72-i386/mono-0.23-1.i386.rpm">mono-0.23-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-72-i386/mono-devel-0.23-1.i386.rpm">mono-devel-0.23-1.i386.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#999999">
|
||||
<b>Red Hat 7.1/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/redhat-71-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-71-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-71-i386/mono-0.23-1.i386.rpm">mono-0.23-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-71-i386/mono-devel-0.23-1.i386.rpm">mono-devel-0.23-1.i386.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td bgcolor="#999999">
|
||||
<b>Mandrake 8.2/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/mandrake-82-i386/libgc-6.1-1.i586.rpm">libgc-6.1-1.i586.rpm</a>
|
||||
<li><a href="archive/mandrake-82-i386/libgc-devel-6.1-1.i586.rpm">libgc-devel-6.1-1.i586.rpm</a>
|
||||
<li><a href="archive/mandrake-82-i386/mono-0.23-1.i586.rpm">mono-0.23-1.i586.rpm</a>
|
||||
<li><a href="archive/mandrake-82-i386/mono-devel-0.23-1.i586.rpm">mono-devel-0.23-1.i586.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#999999">
|
||||
<b>SuSE 8.0/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/suse-80-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/suse-80-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/suse-80-i386/mono-0.23-1.i386.rpm">mono-0.23-1.i386.rpm</a>
|
||||
<li><a href="archive/suse-80-i386/mono-devel-0.23-1.i386.rpm">mono-devel-0.23-1.i386.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td bgcolor="#999999">
|
||||
<b>Red Hat 8.0/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/redhat-80-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-80-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-80-i386/mono-0.23-1.i386.rpm">mono-0.23-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-80-i386/mono-devel-0.23-1.i386.rpm">mono-devel-0.23-1.i386.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#999999">
|
||||
<b>Windows Setup Wizard (NT/2000/XP)</b>
|
||||
<ul>
|
||||
<li><a href="archive/mono-0.23-win32-2.exe">Mono-Setup</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td bgcolor="#999999">
|
||||
<b>Linux S/390</b>
|
||||
<ul>
|
||||
<li><a href="archive/s390/libgc-6.1-1.s390.rpm">libgc-6.1-1.s390.rpm</a>
|
||||
<li><a href="archive/s390/libgc-devel-6.1-1.s390.rpm">libgc-devel-6.1-1.s390.rpm</a>
|
||||
<li><a href="archive/s390/mono-0.23-1.s390.rpm">mono-0.23-1.s390.rpm</a>
|
||||
<li><a href="archive/s390/mono-devel-0.23-1.s390.rpm">mono-devel-0.23-1.s390.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr bgcolor="#CCCCC">
|
||||
<td>
|
||||
<b>Regression Tests</b><br>
|
||||
</td>
|
||||
<td>
|
||||
You can get binaries for the Mono Regression Test
|
||||
Suite <a href="archive/mono-tests.tar.gz">here</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
* Older Releases:
|
||||
|
||||
We provide binaries for older releases until we have packages for the new release.
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr bgcolor="#DDDDDD">
|
||||
@@ -171,7 +32,7 @@
|
||||
<li><a href="archive/mcs-0.22.tar.gz">Mono Class Libraries and C# Compiler.</a>
|
||||
<li><a href="archive/mono-0.22.tar.gz">Mono Runtime</a>
|
||||
<li><a href="archive/gc6.1.tar.gz">Boehm GC 6.1</a>
|
||||
<li><a href="archive/xsp-0.3.tar.gz">XSP web server (0.3)</a>
|
||||
<!-- <li><a href="archive/xsp-0.3.tar.gz">XSP web server (0.3)</a> -->
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -190,7 +51,66 @@
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td bgcolor="#999999">
|
||||
<b>Red Hat 7.3/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/redhat-73-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-73-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-73-i386/mono-0.22-1.i386.rpm">mono-0.22-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-73-i386/mono-devel-0.22-1.i386.rpm">mono-devel-0.22-1.i386.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td bgcolor="#999999">
|
||||
<b>Red Hat 7.2/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/redhat-72-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-72-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-72-i386/mono-0.22-1.i386.rpm">mono-0.22-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-72-i386/mono-devel-0.22-1.i386.rpm">mono-devel-0.22-1.i386.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#999999">
|
||||
<b>Red Hat 7.1/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/redhat-71-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-71-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-71-i386/mono-0.22-1.i386.rpm">mono-0.22-1.i386.rpm</a>
|
||||
<li><a href="archive/redhat-71-i386/mono-devel-0.22-1.i386.rpm">mono-devel-0.22-1.i386.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td bgcolor="#999999">
|
||||
<b>Mandrake 8.2/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/mandrake-82-i386/libgc-6.1-1.i586.rpm">libgc-6.1-1.i586.rpm</a>
|
||||
<li><a href="archive/mandrake-82-i386/libgc-devel-6.1-1.i586.rpm">libgc-devel-6.1-1.i586.rpm</a>
|
||||
<li><a href="archive/mandrake-82-i386/mono-0.22-1.i586.rpm">mono-0.22-1.i586.rpm</a>
|
||||
<li><a href="archive/mandrake-82-i386/mono-devel-0.22-1.i586.rpm">mono-devel-0.22-1.i586.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#999999">
|
||||
<b>SuSE 8.0/x86</b>
|
||||
<ul>
|
||||
<li><a href="archive/suse-80-i386/libgc-6.1-1.i386.rpm">libgc-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/suse-80-i386/libgc-devel-6.1-1.i386.rpm">libgc-devel-6.1-1.i386.rpm</a>
|
||||
<li><a href="archive/suse-80-i386/mono-0.22-1.i386.rpm">mono-0.22-1.i386.rpm</a>
|
||||
<li><a href="archive/suse-80-i386/mono-devel-0.22-1.i386.rpm">mono-devel-0.22-1.i386.rpm</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr> -->
|
||||
<!-- <td bgcolor="#999999"> -->
|
||||
<!-- <b>Debian packages</b> -->
|
||||
<!-- <ul> -->
|
||||
<!-- <li><a href="http://www.atoker.com/mono/">Alp's web site</a> -->
|
||||
<!-- </ul> -->
|
||||
<!-- </td> -->
|
||||
<!-- </tr> -->
|
||||
<tr> -->
|
||||
<td bgcolor="#999999">
|
||||
<b>Windows Setup Wizard (NT/2000/XP)</b>
|
||||
<ul>
|
||||
@@ -215,6 +135,11 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
der Releases:
|
||||
|
||||
We provide binaries for older releases until we have packages for the new release.
|
||||
<table>
|
||||
<tbody>
|
||||
<tr bgcolor="#DDDDDD">
|
||||
@@ -261,6 +186,14 @@
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#999999">
|
||||
<b>Windows Setup Wizard (NT/2000/XP)</b>
|
||||
<ul>
|
||||
<li><a href="archive/mono-0.21-win32-1.exe">Mono-Setup</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -617,7 +550,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
* Binaries for other platforms.
|
||||
inaries for other platforms.
|
||||
|
||||
Already daily volunteer's made binaries:
|
||||
|
||||
@@ -626,9 +559,9 @@
|
||||
* <a href="http://www.superin.formativ.net/mono/mono.htm">Windows</a> (works without cygwin!)
|
||||
</ul>
|
||||
|
||||
* Snapshots
|
||||
apshots
|
||||
|
||||
<a name="snapshots">
|
||||
ame="snapshots">
|
||||
|
||||
<a href="http://www.go-mono.com/snapshots">Nightly snapshots</a> of
|
||||
the CVS repository are made every day at 10pm EST (Boston
|
||||
@@ -638,7 +571,7 @@
|
||||
The <a href="anoncvs.html">anoncvs</a> mirrors provided by
|
||||
Hispalinux are updated every six hours.
|
||||
|
||||
* Compiling the code
|
||||
mpiling the code
|
||||
|
||||
There are a number of ways of compiling Mono
|
||||
|
||||
@@ -652,8 +585,8 @@
|
||||
|
||||
(which is an easy way to get the latest CVS information)
|
||||
|
||||
<a name="scripts">
|
||||
* Compiling with scripts
|
||||
ame="scripts">
|
||||
mpiling with scripts
|
||||
|
||||
There are scripts to help build mono for both Unix and Windows. Get
|
||||
<a href="mono-build.sh">mono-build.sh</a> for Unix, or <a
|
||||
@@ -684,14 +617,14 @@
|
||||
set your CVSROOT environment variable before running the script to
|
||||
select a particular cvs server.
|
||||
|
||||
<a name="install">
|
||||
** Building the software manually
|
||||
ame="install">
|
||||
uilding the software manually
|
||||
|
||||
You will need to obtain the Mono dependencies first: <a
|
||||
href="http://www.gtk.org">glib 2.x</a> and
|
||||
<a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a>.
|
||||
|
||||
*** Building on Linux
|
||||
Building on Linux
|
||||
|
||||
<ul>
|
||||
Unpack the Mono runtime distribution:
|
||||
@@ -733,9 +666,9 @@
|
||||
</ul>
|
||||
|
||||
|
||||
*** On Windows, to install and work on the compiler and the class libraries:
|
||||
On Windows, to install and work on the compiler and the class libraries:
|
||||
|
||||
**** Install Cygwin and the GNU build tools, Microsoft's .NET Framework SDK and the precompiled GLIB 2.0 and pkg-config libraries.
|
||||
Install Cygwin and the GNU build tools, Microsoft's .NET Framework SDK and the precompiled GLIB 2.0 and pkg-config libraries.
|
||||
|
||||
<ul>
|
||||
|
||||
@@ -764,7 +697,7 @@
|
||||
</pre>
|
||||
</ul>
|
||||
|
||||
*** On Windows, to compile the mono runtime:
|
||||
On Windows, to compile the mono runtime:
|
||||
|
||||
<ul>
|
||||
|
||||
@@ -783,7 +716,7 @@
|
||||
|
||||
</ul>
|
||||
|
||||
* Software resources and notes
|
||||
ftware resources and notes
|
||||
|
||||
The required and additional software can be downloaded here:
|
||||
|
||||
@@ -818,7 +751,7 @@
|
||||
</ul>
|
||||
|
||||
|
||||
*** Notes on compiling GLIB 2.0 and pkg-config from source:
|
||||
Notes on compiling GLIB 2.0 and pkg-config from source:
|
||||
|
||||
|
||||
<ul>
|
||||
@@ -833,13 +766,13 @@
|
||||
<nobr><tt>extern char *strsignal (int sig);</tt></nobr> to
|
||||
<nobr><tt>extern const char *strsignal (int sig);</tt></nobr>.
|
||||
|
||||
<pre>
|
||||
tar xzvf pkg-config-0.8.0.tar.gz
|
||||
cd pkg-config-0.8.0
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
make install
|
||||
</pre>
|
||||
>
|
||||
xzvf pkg-config-0.8.0.tar.gz
|
||||
kg-config-0.8.0
|
||||
nfigure --prefix=/usr
|
||||
|
||||
install
|
||||
e>
|
||||
|
||||
* Download, compile and install <a href="ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.7.tar.gz">libiconv</a> from source.<br>
|
||||
If you dont have MS Visual C/C++ 4.0 or 5.0 or 6.0 you can also try
|
||||
@@ -854,8 +787,8 @@ make install
|
||||
|
||||
</ul>
|
||||
|
||||
<a name="upgrading">
|
||||
** Upgrading
|
||||
ame="upgrading">
|
||||
pgrading
|
||||
|
||||
To upgrade your Mono installation from CVS, it is very
|
||||
important that you update your Mono and MCS modules from CVS
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
The Boehm GC system needs to catch your calls to the pthreads
|
||||
layer, so in each file where you use pthread.h you should
|
||||
include the <gc/gc.h> file.
|
||||
include the <gc/gc.h> file.
|
||||
|
||||
* Exposing C code to the CIL universe
|
||||
|
||||
@@ -273,15 +273,6 @@
|
||||
It may not be possible to manage exceptions in that case,
|
||||
though. I need to think more about it.
|
||||
|
||||
** Threading issues
|
||||
|
||||
If your application creates threads on its own, and you want them to
|
||||
be able to call code into the CIL universe with Mono, you have to
|
||||
register the thread with Mono before issuing the call.
|
||||
|
||||
To do so, call the mono_thread_attach() function before you execute
|
||||
any managed code from the thread
|
||||
|
||||
* Samples
|
||||
|
||||
See the sample programs in mono/sample/embed for examples of
|
||||
|
||||
@@ -271,30 +271,6 @@ A: Gtk# is a set of bindings for the Gtk+ toolkit for C# (and other
|
||||
CIL-enabled languages). System.Windows.Forms is an API defined
|
||||
by Microsoft to build GUI applications.
|
||||
|
||||
Q: Why not implement System.Windows.Forms on top of Gtk# or Qt#?
|
||||
|
||||
A: There are several reasons for this.
|
||||
|
||||
First of all, Gtk+ and Qt are standard toolkits on Linux, and their
|
||||
proponents want to use their favorite toolkits when writing
|
||||
applications.
|
||||
|
||||
Related to this is the idea that System.Windows.Forms is
|
||||
brain-dead in certain areas, such as internationalization.
|
||||
System.Windows.Forms uses explicit sizes for all controls, as opposed
|
||||
to Gtk+ and Qt which use a box/packing model, which can better deal with
|
||||
the different string lengths different languages will have.
|
||||
|
||||
Next is compatibility. It is not possible to implement
|
||||
System.Windows.Forms on top of Gtk+/Qt and have 100% compatibility,
|
||||
because System.Windows.Forms exposes <i>lots</i> of Win32-isms, such as the
|
||||
Win32 message loop. In order to maintain compatibility, Wine must be used,
|
||||
and this is being done; see the
|
||||
<a href="/winforms.html">System.Windows.Forms effort page</a>.
|
||||
|
||||
Additionally, Wine apps don't currently fit in -- visually -- with
|
||||
Gtk+ or Qt apps.
|
||||
|
||||
Q: Will I be able to run my smart clients on systems powered by Mono?
|
||||
|
||||
A: As long as your applications are 100% .NET and do not make use
|
||||
@@ -585,11 +561,10 @@ A: Yes. The CLI contains enough information about a class that
|
||||
exposing it to other RPC systems (like CORBA) is really simple, and
|
||||
does not even require support from an object.
|
||||
|
||||
<a href="http://remoting-corba.sourceforge.net/">Remoting.CORBA</a> is
|
||||
a CORBA implementation that is gaining momentum.
|
||||
|
||||
Building an implementation of the Bonobo interfaces once this is ready
|
||||
should be relatively simple.
|
||||
We will be implementing CORBA inter-operation as an extension to the
|
||||
Mono classes so that we can integrate with Bonobo, just like
|
||||
Microsoft provides COM inter-operation classes and support
|
||||
mechanisms.
|
||||
|
||||
Q: Can I serialize my objects to other things other than XML?
|
||||
|
||||
@@ -598,49 +573,21 @@ A: Yes, although the serializing tools have not yet been planned, and
|
||||
|
||||
Q: Will Mono use ORBit?
|
||||
|
||||
A: There are a few advantages in using ORBit, like reusing existing code
|
||||
and leveraging all the work done on it. Michael Meeks has posted
|
||||
a few <a href="http://lists.ximian.com/archives/public/mono-list/2002-September/008592.html">reasons</a>,
|
||||
as well as some <a href="http://lists.ximian.com/archives/public/mono-list/2002-September/008657.html">ideas</a>
|
||||
that could be used to reuse ORBit.
|
||||
|
||||
Most users are likely to choose a native .NET solution, like <a href="http://cvs.gnome.org/bonsai">Remoting.CORBA</a>
|
||||
|
||||
A: No. Mono will be using a new implementation of CORBA that isn't still started.
|
||||
|
||||
<a name="monodoc"></a>
|
||||
** MonoDoc
|
||||
|
||||
Q: What is MonoDoc?
|
||||
|
||||
A: MonoDoc is a graphical documentation browser for the Mono class
|
||||
libraries. Currently, monodoc consists of a Gtk# application and is
|
||||
in heavy development.
|
||||
A: MonoDoc is a graphical documentation editor and viewer. Currently, MonoDoc
|
||||
consists of a Gtk# application and is in heavy development. There is also a
|
||||
Qt# version of it.
|
||||
|
||||
|
||||
<a name="devel"></a>
|
||||
** Development Tools and Issues
|
||||
|
||||
Q: I am having trouble compiling a new version of Mono from CVS, it
|
||||
complains about my runtime being out of sync.
|
||||
|
||||
A: Jonathan Pryor has provided the following answer:
|
||||
|
||||
To upgrade your class libraries and compiler, see the See
|
||||
README.building in the MCS directory.
|
||||
|
||||
The single biggest source of confusion seems to be the "Your
|
||||
runtime is out of sync" messages. Realize that this is *normal*
|
||||
while BUILDING. Think about it: you're building a new class
|
||||
library with the old runtime. If the new class library references
|
||||
a function that the old runtime knows nothing about, the runtime
|
||||
system issues this warning.
|
||||
|
||||
Basically what needs to happen is for a new mono runtime to be
|
||||
compiled, then the corlib class library be compiled, and once this
|
||||
is done, install the new runtime, followed by corlib.
|
||||
|
||||
Once this is done, you can continue building your entire
|
||||
environment.
|
||||
|
||||
Q: Will it be possible to use the CLI features without using byte codes
|
||||
or the JIT?
|
||||
|
||||
@@ -864,12 +811,12 @@ A: You can get very good tools for doing Java development on free
|
||||
|
||||
Q: Could Java target the CLI?
|
||||
|
||||
A: Yes, Java could target the CLI, Microsoft's J# compiler does that.
|
||||
A: Yes, Java could target the CLI. We have details on a <a
|
||||
href="ideas.html#guavac">project</a> that someone could take on to
|
||||
make this happen.
|
||||
|
||||
The <a href="http://weblog.ikvm.net/">IKVM</a> project builds a
|
||||
Java runtime that works on top of .NET and on top of Mono. IKVM is
|
||||
essentially a JIT compiler that translates from JVM bytecodes into
|
||||
CIL instructions, and then lets the native JIT engine take over.
|
||||
Microsoft has an implementation of the Java language called J# that
|
||||
can target the CIL execution engine.
|
||||
|
||||
Q: Is it possible to write a JVM byte code to CIL converter?
|
||||
|
||||
@@ -891,8 +838,6 @@ A: Yes, it is possible. Here are a few starting point:
|
||||
be translated into the equivalent "meaning" in CLR-land.
|
||||
</ul>
|
||||
|
||||
See also the <a href="http://weblog.ikvm.net/">IKVM project</a>
|
||||
|
||||
Q: Could mono become a hybrid CIL/java platform?
|
||||
|
||||
A: No. It is quite far from the philosophy of the project. The idea of Mono
|
||||
@@ -907,8 +852,9 @@ A: No. It is quite far from the philosophy of the project. The idea of Mono
|
||||
|
||||
Q: Do you plan to implement a Javascript compiler?
|
||||
|
||||
A: Yes. The beginnings of the JScript compiler can be found on CVS.
|
||||
Cesar coordinates this effort.
|
||||
A: Yes. Eto Demerzal has started a Rhino port to C#.
|
||||
After this is completed, we will begin developing
|
||||
the JavaScript compiler.
|
||||
|
||||
Q: Can Mono or .NET share system classes (loaded from mscore.dll and other
|
||||
libs) or will it behave like Sun's Java VM?
|
||||
@@ -950,13 +896,10 @@ A: Embracing a good technology is good. Extending technologies in
|
||||
encourage you to make those classes operate correctly well in both
|
||||
Mono and .NET.
|
||||
|
||||
Today Mono ships with a number of extra libraries that were
|
||||
developed either by members of the Mono community, or other
|
||||
groups.
|
||||
|
||||
Q: Is there any way I can develop the class libraries using Linux yet?
|
||||
|
||||
A: Yes. Mono has been selfhosting since March 2002.
|
||||
A: Yes. Some class libraries can be developed on Linux. Search for
|
||||
Paolo's post (he lists which classes can be compiled fine now).
|
||||
|
||||
Q: Is there any way I can install a known working copy of mono in /usr,
|
||||
and an experimental copy somewhere else, and have both copies use
|
||||
@@ -1188,61 +1131,27 @@ Q: Could patents be used to completely disable Mono (either submarine
|
||||
patents filed now, or changes made by Microsoft specifically to
|
||||
create patent problems)?
|
||||
|
||||
A: First some background information.
|
||||
A: No. First, its basic functional capabilities have pre-existed too
|
||||
long to be held up by patents. The basic components of Mono are
|
||||
technologically equivalent to Sun's Java technology, which has been
|
||||
around for years.
|
||||
|
||||
The .NET Framework is divided in two parts: the ECMA/ISO covered
|
||||
technologies and the other technologies developed on top of it like
|
||||
ADO.NET, ASP.NET and Windows.Forms.
|
||||
Mono will also implement multi-language and
|
||||
multi-architecture support, but there are previous technologies
|
||||
such as UCSD p-code and ANDF that also support multiple languages
|
||||
using a common intermediate language. The libraries are similar
|
||||
to other language's libraries, so again, they're too similar to
|
||||
be patentable in large measure.
|
||||
|
||||
Mono implements the ECMA/ISO covered parts, as well as being a
|
||||
project that aims to implement the higher level blocks like
|
||||
ASP.NET, ADO.NET and Windows.Forms.
|
||||
|
||||
The Mono project has gone beyond both of those components and has
|
||||
developed and integrated third party class libraries, the most
|
||||
important being: Debugging APIs, integration with the Gnome
|
||||
platform (Accessibility, Pango rendering, Gdk/Gtk, Glade, GnomeUI),
|
||||
Mozilla, OpenGL, extensive database support (Microsoft only
|
||||
supports a couple of providers out of the box, while Mono has
|
||||
support for 11 different providers), our POSIX integration
|
||||
libraries and finally the embedded API (used to add scripting to
|
||||
applications and host the CLI, or for example as an embedded
|
||||
runtime in Apache).
|
||||
|
||||
The core of the .NET Framework, and what has been patented by
|
||||
Microsoft falls under the ECMA/ISO submission. Jim Miller at
|
||||
Microsoft has made a statement on the patents covering ISO/ECMA,
|
||||
(he is one of the inventors listed in the patent): <a
|
||||
href="https://mailserver.di.unipi.it/pipermail/dotnet-sscli/msg00218.html">here</a>.
|
||||
|
||||
Basically a grant is given to anyone who want to implement those
|
||||
components for free and for any purpose.
|
||||
|
||||
The controversial elements are the ASP.NET, ADO.NET and
|
||||
Windows.Forms subsets. Those are convenient for people who need
|
||||
full compatibility with the Windows platform, but are not required
|
||||
for the open source Mono platform, nor integration with today's
|
||||
Mono's rich support of Linux.
|
||||
|
||||
The Mono strategy for dealing with these tehcnologies is as
|
||||
follows: (1) work around the patent by using a different
|
||||
implementation techinque that retains the API, but changes the
|
||||
mechanism; if that is not possible, we would (2) remove the pieces
|
||||
of code that were covered by those patents, and also (3) find prior
|
||||
art that would render the patent useless.
|
||||
However, if Microsoft does patent some technology, then our plan is
|
||||
to either (1) work around it, (2) chop out patented pieces, (3)
|
||||
find prior art that would render the patent useless.
|
||||
|
||||
Not providing a patented capability would weaken the
|
||||
interoperability, but it would still provide the free software /
|
||||
open source software community with good development tools, which
|
||||
is the primary reason for developing Mono.
|
||||
|
||||
The patents do not apply in countries where software patents are
|
||||
not allowed.
|
||||
|
||||
For Linux server and desktop development, we only need the ECMA
|
||||
components, and things that we have developed (like Gtk#) or Apache
|
||||
integration.
|
||||
|
||||
<a name="etc"></a>
|
||||
** Miscellaneous Questions
|
||||
|
||||
@@ -1329,8 +1238,7 @@ A: There are several but one that is free software and uses MCS is the one
|
||||
|
||||
Q: Is it possible to use Visual C++ with Mono?.
|
||||
|
||||
A: It's possible to run VC++ generated apps under Mono, but we do not
|
||||
provide a Manager C++ compiler ourselves.
|
||||
A: Well, It's possible to run VC++ generated apps under Mono though.
|
||||
|
||||
<a name="problems"></a>
|
||||
** Mono Common Problems
|
||||
|
||||
@@ -6,17 +6,10 @@
|
||||
libraries that are part of the
|
||||
<a href="http://www.gnome.org">GNOME</a> platform .
|
||||
|
||||
* Wiki
|
||||
|
||||
There is a <a
|
||||
href="http://www.nullenvoid.com/gtksharp/wiki/index.php/">Gtk#
|
||||
Wiki</a>. You are encouraged to contribute to it.
|
||||
|
||||
** API of Gtk#
|
||||
|
||||
The Gtk# API is documented using the ECMA XML document format, you can read
|
||||
more about it <a href="documentation.html">here</a>. You can
|
||||
also use the MonoDoc tool that ships with Gtk# documentation.
|
||||
The API is browsable
|
||||
<a href="http://primates.ximian.com/~tvgm/gtk-sharp-docs/">here</a>
|
||||
|
||||
** Where to learn more.
|
||||
|
||||
@@ -43,8 +36,7 @@
|
||||
|
||||
** GTK# On Windows
|
||||
|
||||
<p>Look at our Wiki for installation instructions <a href="http://www.nullenvoid.com/gtksharp/wiki/index.php/InstallingBeginnersGuide">here</a>
|
||||
|
||||
<p>There is a Windows Installer for GTK# <a href="http://www.sport-huettn.de/mono/gtk-sharp-0.6-stable-2.exe">here</a>.
|
||||
|
||||
<p>If you want to build GTK# yourself on Windows:
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ TODO=multimedia
|
||||
<a name="projects">
|
||||
** Projects
|
||||
|
||||
This list of projects ideas is outdated
|
||||
|
||||
TODO=guavac,Java compiler for .NET
|
||||
* You could take one of the existing Java compilers
|
||||
@@ -69,8 +68,19 @@ TODO=guavac,Java compiler for .NET
|
||||
it could be compiled with the Microsoft Managed C++
|
||||
compiler and produce a .NET executable with it.
|
||||
|
||||
TODO=CORBA,CORBA implementation
|
||||
* Build a CORBA interoperability engine for the CLR.
|
||||
You do not need to do all of the work, just talking
|
||||
the protocol will get us a long way (<a
|
||||
href="http://www.omg.org">The OMG site</a> has the
|
||||
CORBA specs).
|
||||
|
||||
Get in touch with David Taylor (dtaylo11 at bigpond
|
||||
dot net dot au) as he has been working on this
|
||||
project.
|
||||
|
||||
TODO=Bonobo,Bonobo for Mono
|
||||
* Once <a href="http://remoting-corba.sourceforge.net/">CORBA</a> is done, implement the Bonobo interfaces
|
||||
* Once CORBA is done, implement the Bonobo interfaces
|
||||
to allow people to use Bonobo components in Mono and
|
||||
Mono components with Bonobo. The best of both worlds!
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
<ul>
|
||||
* <a href="#Tachy">Tachy</a> (scheme-like)
|
||||
* <a href="#python">Python</a>
|
||||
</ul>
|
||||
|
||||
<a name="Java">
|
||||
@@ -104,16 +103,6 @@
|
||||
A subset of Scheme language called <a
|
||||
href="http://radio.weblogs.com/0101156/stories/2002/03/19/tachy.html">Tachy</a>
|
||||
|
||||
<a name="Python">
|
||||
** Python
|
||||
|
||||
<a href="mailto:[email protected]">Brian Lloyd</a> is
|
||||
working on linking the Python runtime with the .NET runtime.
|
||||
More information on the PS.NET project can be found <a
|
||||
href="http://www.zope.org/Members/Brian/PythonNet/index_html">here</a>.
|
||||
An FAQ document is available <a
|
||||
href="http://www.zope.org/Members/Brian/PythonNet/FAQ.html">here</a>.
|
||||
|
||||
* Missing languages
|
||||
|
||||
Here is a list of a few languages that we would like to see
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Most of the mailing lists are in english, but there is also
|
||||
Mono Hispano that has lists in Spanish. <a
|
||||
href="http://www.monohispano.org/mailman/listinfo/mono-hispano">Mono Hispano list</a>
|
||||
href="http://mono.es.gnome.org/mailman/listinfo/mono-hispano">Mono Hispano list</a>
|
||||
|
||||
There are a number of mailing lists for Mono in English:
|
||||
|
||||
|
||||
@@ -155,37 +155,27 @@ export PKG_CONFIG_PATH
|
||||
# /usr/local/include and /usr/local/lib to CPPFLAGS and LDFLAGS. We could
|
||||
# skip this if it would add /usr/include and /usr/lib, but leaving it
|
||||
# shouldnt break anything.
|
||||
#
|
||||
# Actually, it does break stuff :-( gcc 3.2 prints gratuitous warnings
|
||||
# and configure fails to find header files because of this cpp output.
|
||||
|
||||
if [ ! -f /usr/include/iconv.h ]; then
|
||||
iconvdirs="/usr/local/include"
|
||||
for i in $iconvdirs
|
||||
do
|
||||
if [ -f $i/iconv.h ]; then
|
||||
iconvh_dir=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$iconvh_dir" ]; then
|
||||
echo "Can't find iconv headers (looked in $iconvdirs)"
|
||||
exit -1
|
||||
iconvdirs="/usr/include /usr/local/include"
|
||||
for i in $iconvdirs
|
||||
do
|
||||
if [ -f $i/iconv.h ]; then
|
||||
iconvh_dir=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
iconvlib_dir=`echo $iconvh_dir | sed -e 's/include/lib/'`
|
||||
|
||||
echo "Adding $iconvh_dir to CPPFLAGS"
|
||||
echo "Adding $iconvlib_dir to LDFLAGS"
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -I$here/install/include -I$iconvh_dir"
|
||||
LDFLAGS="$LDFLAGS -L$here/install/lib -L$iconvlib_dir"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS -I$here/install/include"
|
||||
LDFLAGS="$LDFLAGS -L$here/install/lib"
|
||||
if [ -z "$iconvh_dir" ]; then
|
||||
echo "Can't find iconv headers (looked in $iconvdirs)"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
iconvlib_dir=`echo $iconvh_dir | sed -e 's/include/lib/'`
|
||||
|
||||
echo "Adding $iconvh_dir to CPPFLAGS"
|
||||
echo "Adding $iconvlib_dir to LDFLAGS"
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -I$here/install/include -I$iconvh_dir"
|
||||
LDFLAGS="$LDFLAGS -L$here/install/lib -L$iconvlib_dir"
|
||||
export CPPFLAGS
|
||||
export LDFLAGS
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<ul>
|
||||
|
||||
<li><a href="http://www.monohispano.org">Mono
|
||||
<li><a href="http://mono.es.gnome.org">Mono
|
||||
Hispano</a>: The spanish-speaking community of Mono
|
||||
developers and users. They have quite a number of
|
||||
unique documents and tutorials.
|
||||
@@ -31,4 +31,4 @@
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
@@ -28,16 +28,11 @@
|
||||
|
||||
The Mono Tutorial:
|
||||
|
||||
<a href="http://go-mono.com/tutorial/">GNOME.NET Tutorial</a>
|
||||
<a href="http://http://go-mono.com/gnometutorial/">GNOME.NET Tutorial</a>
|
||||
|
||||
and other useful tutorials (Gtk#, Glade#, Embeded, etc) (in Spanish) at
|
||||
|
||||
<a href="http://www.monohispano.org">The Mono Hispano site</a>.
|
||||
|
||||
Community site for Mono at <a href="http://www.gotmono.com">Got Mono</a>
|
||||
|
||||
Wikis: <a href="http://www.nullenvoid.com/gtksharp/wiki">Gtk# Wiki</a>
|
||||
and <a href="http://www.nullenvoid.com/mono/wiki">Mono Wiki</a>.
|
||||
<a href="http://mono.es.gnome.org">The Mono Hispano site</a>.
|
||||
|
||||
Sergey's web page on Mono resources:
|
||||
|
||||
@@ -47,10 +42,6 @@
|
||||
|
||||
<a href="http://www.gotdotnet.com">Got Dot Net</a>
|
||||
|
||||
Got Mono:
|
||||
|
||||
<a href="http://www.gotmono.com">Got Mono</a>
|
||||
|
||||
MonoMail:
|
||||
|
||||
<a href="http://sourceforge.net/projects/monomail/">http://sourceforge.net/projects/monomail/</a>
|
||||
@@ -145,10 +136,6 @@
|
||||
href="http://xmarks.sourceforge.net/doc.html">XMarks DOC.NET:</a> For
|
||||
creating online documentation you can browse for your own classes.
|
||||
|
||||
* <a
|
||||
href="http://www.cl.cam.ac.uk/~jds31/research/gccnet/">GCC .NET backend</a>.
|
||||
|
||||
Jeremy Singer has developed a .NET backend for GCC. This is research work.
|
||||
</ul>
|
||||
|
||||
<li><b>Class Libraries</b></li>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
* The Mono runtime
|
||||
|
||||
The Mono runtime engine is considered feature complete.
|
||||
|
||||
It implements a Just-in-Time compiler engine for the CIL
|
||||
virtual machine, the class loader, the garbage collector,
|
||||
threading system and metadata access libraries.
|
||||
The Mono runtime implements a JIT engine for the CIL virtual
|
||||
machine (as well as a byte code interpreter, this is to
|
||||
quickly port it to new systems), the class loader, the garbage
|
||||
collector, threading system and metadata access libraries.
|
||||
|
||||
We currently have two runtimes:
|
||||
|
||||
@@ -17,7 +16,8 @@
|
||||
easy-to-port runtime engine.
|
||||
</ul>
|
||||
|
||||
We are using the Bohem conservative garbage collector.
|
||||
Currently we are using the Bohem conservative garbage
|
||||
collector.
|
||||
|
||||
The Mono runtime can be used as a stand-alone process, or it
|
||||
can be <a href="embedded-api">embedded into applications</a> (see
|
||||
@@ -31,7 +31,7 @@
|
||||
href="http://primates.ximian.com/~lupus/slides/jit/">slides
|
||||
here</a>
|
||||
|
||||
** Current JIT Engine: technical details (<b>updated, July 8th, 2002</b>)
|
||||
** Current JIT Engine (<b>updated, July 8th, 2002</b>)
|
||||
|
||||
The JIT engine uses a code-generator generator approach for
|
||||
compilation. Given the properties of CIL byte codes, we can
|
||||
@@ -84,11 +84,18 @@
|
||||
|
||||
** Garbage Collection
|
||||
|
||||
We are using the Boehm conservative GC. We might consider
|
||||
adopting other GC engines in the future, like the Intel ORP GC
|
||||
engine. The Intel ORP GC engine as it provides a precise
|
||||
Currently we are using the Boehm conservative GC. Although our plans
|
||||
are to move to the Intel ORP GC engine, our plans on a next generation
|
||||
dual-JIT engine have to be taken into account.
|
||||
|
||||
We will be using the Intel ORP GC engine as it provides a precise
|
||||
garbage collector engine, similar to what is available on the
|
||||
.NET environment.
|
||||
.NET environment.
|
||||
|
||||
Although using a conservative garbage collector like Bohem's
|
||||
would work, all the type information is available at runtime,
|
||||
so we can actually implement a better collector than a
|
||||
conservative collector.
|
||||
|
||||
<ul>
|
||||
* Garbage collection list and FAQ:<br>
|
||||
@@ -112,7 +119,7 @@
|
||||
The ECMA runtime and the .NET runtime assume an IO model and a
|
||||
threading model that is very similar to the Win32 API.
|
||||
|
||||
Dick Porter has developed WAPI: the Mono abstraction layer
|
||||
Dick Porter has been working on the Mono abstraction layer
|
||||
that allows our runtime to execute code that depend on this
|
||||
behaviour.
|
||||
|
||||
@@ -141,8 +148,7 @@
|
||||
as well as talking to system libraries.
|
||||
|
||||
Initially we used libffi, but it was fairly slow, so we have
|
||||
reused parts of the JIT work to create efficient PInvoke
|
||||
trampolines.
|
||||
reused parts of the JIT work to create efficient PInvoke trampolines.
|
||||
|
||||
** Remoting
|
||||
|
||||
|
||||
@@ -150,39 +150,4 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
** Mono running on the iPaq
|
||||
|
||||
<table border=1>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="images/familiar-mint-hello.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
** Mono Certificate Viewer
|
||||
|
||||
<table border=1>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="images/swf-certview.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
running on Windows using SWF
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="images/gtk-certview.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
running on Linux (RH9) using GTK#
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
1,FAQ,faq.html,faq.src
|
||||
1,News archive,http://monoevo.sf.net/mwn/archives.html
|
||||
1,Screenshots,screenshots.html,screenshots.src
|
||||
1,Team,team.html,team.src
|
||||
1,Other sites,other.html,other.src
|
||||
1,Old News,oldnews.html,oldnews.src
|
||||
0,Mono,rationale.html,rationale.src
|
||||
1,Runtime,runtime.html,runtime.src
|
||||
2,Embedding,embedded-api.html,embedded-api.src
|
||||
@@ -21,6 +19,7 @@
|
||||
1,Hackers,hackers.html,hackers.src
|
||||
1,Documentation,documentation.html,documentation.src
|
||||
1,Class Docs,classlib-doc.html,classlib-doc.src
|
||||
1,Doc format,monodoc-xml.html,monodoc-xml.src
|
||||
1,Test Suite,testing.html,testing.src
|
||||
1,Tools,tools.html,tools.src
|
||||
1,Porting,porting.html,porting.src
|
||||
|
||||
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 14 KiB |
@@ -35,7 +35,6 @@ OBJECTS= \
|
||||
deploy/ideas.html \
|
||||
deploy/ibmdb2.html \
|
||||
deploy/index.html \
|
||||
deploy/oldnews.html \
|
||||
deploy/java.html \
|
||||
deploy/jit-debug.html \
|
||||
deploy/languages.html \
|
||||
@@ -56,7 +55,6 @@ OBJECTS= \
|
||||
deploy/runtime.html \
|
||||
deploy/screenshots.html \
|
||||
deploy/status.html \
|
||||
deploy/team.html \
|
||||
deploy/testing.html \
|
||||
deploy/tools.html \
|
||||
deploy/winforms.html \
|
||||
@@ -76,7 +74,7 @@ OBJECTS= \
|
||||
deploy/class-status-Cscompmgd.html \
|
||||
deploy/class-library.html \
|
||||
deploy/classlib-doc.html
|
||||
|
||||
|
||||
#2,Configuration.Install,class-status-System.Configuration.Install.html,class-status-System.Configuration.Install.src,cm/cormissing.css,cm/cormissing.js
|
||||
#2,Runtime.Remoting,class-status-System.Runtime.Remoting.html,class-status-System.Runtime.Remoting.src,cm/cormissing.css,cm/cormissing.js
|
||||
|
||||
@@ -87,10 +85,9 @@ NON_HTML_SOURCES= \
|
||||
../mono-build.sh \
|
||||
../mono-build-w32.sh
|
||||
|
||||
all: $(OBJECTS) deploy/index.rss ../team
|
||||
|
||||
all: $(OBJECTS) deploy/index.rss
|
||||
perl process.pl commands template.html.in deploy
|
||||
-mkdir deploy/team
|
||||
cp team/*png deploy/team
|
||||
|
||||
tutorial: mono-beginning.html.stamp mono-beginning.pdf
|
||||
cp -a mono-beginning mono-beginning.xml mono-beginning.pdf deploy
|
||||
@@ -111,12 +108,6 @@ deploy/index.rss: mono-rss.exe ../index
|
||||
mono-rss.exe: mono-rss.cs rss.cs
|
||||
$(CSC) mono-rss.cs rss.cs
|
||||
|
||||
../team: render-team-page.exe team.xml
|
||||
./render-team-page.exe team.xml "../team"
|
||||
|
||||
render-team-page.exe: render-team-page.cs
|
||||
$(CSC) render-team-page.cs
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) $(patsubst deploy/%.html,src/%.src, $(OBJECTS)) src/*.xml src/*.html.in ../class-status-* ../class-status
|
||||
|
||||
@@ -138,6 +129,8 @@ $(OBJECTS): $(patsubst deploy/%.html,src/%.src, $(OBJECTS))
|
||||
src/%.src: ../% commands makefile template.html.in
|
||||
perl htmlify $< > $@
|
||||
|
||||
|
||||
|
||||
.PRECIOUS: ../class-status-%
|
||||
../class-status-%: src/%.html.in ../class-status.in
|
||||
cat ../class-status.in $< > $@
|
||||
|
||||
@@ -1,352 +0,0 @@
|
||||
//
|
||||
// RenderTeamPage.cs - Renders an HTML page with team member information from an XML file
|
||||
//
|
||||
// Author: Duncan Mak ([email protected])
|
||||
//
|
||||
// (C) Copyright 2003, Ximian Inc.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
class Write {
|
||||
|
||||
static Contributor [] list;
|
||||
static public XmlNamespaceManager nsmgr;
|
||||
|
||||
static void Main (string [] args)
|
||||
{
|
||||
if (args.Length != 2) {
|
||||
Console.WriteLine ("write.exe <input.xml> <output.html>");
|
||||
Environment.Exit (0);
|
||||
}
|
||||
|
||||
string input = args [0];
|
||||
string output = args [1];
|
||||
XmlDocument document = new XmlDocument ();
|
||||
document.Load (input);
|
||||
|
||||
nsmgr = new XmlNamespaceManager (document.NameTable);
|
||||
nsmgr.AddNamespace ("t", "http://go-mono.org/team.xsd");
|
||||
XmlNodeList contributors = document.SelectNodes ("/t:contributors/t:contributor", nsmgr);
|
||||
list = new Contributor [contributors.Count];
|
||||
|
||||
Page p = new Page ();
|
||||
|
||||
int count = 0;
|
||||
foreach (XmlNode n in contributors) {
|
||||
list [count] = new Contributor (n, p.Document);
|
||||
count ++;
|
||||
}
|
||||
|
||||
Array.Sort (list, new ContributorComparer ());
|
||||
|
||||
int length = list.Length % 2 == 0 ? list.Length : list.Length + 1;
|
||||
|
||||
int i = 0;
|
||||
while (i < length) {
|
||||
try {
|
||||
p.AddRow (list [i].RenderHtml (), list [i + 1].RenderHtml ());
|
||||
} catch (IndexOutOfRangeException) {
|
||||
p.AddRow (list [i].RenderHtml (), null);
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
|
||||
p.Write (output);
|
||||
}
|
||||
}
|
||||
|
||||
public class ContributorComparer : IComparer
|
||||
{
|
||||
public int Compare (object x, object y)
|
||||
{
|
||||
return String.Compare (x.ToString (), y.ToString ());
|
||||
}
|
||||
}
|
||||
|
||||
class Contributor {
|
||||
|
||||
public Name name;
|
||||
public string email;
|
||||
public string image;
|
||||
public string location;
|
||||
public string organization;
|
||||
public string description;
|
||||
public string[] tasks;
|
||||
|
||||
public XmlDocument document;
|
||||
|
||||
public Contributor (XmlNode node, XmlDocument document)
|
||||
{
|
||||
|
||||
name = GetName (node);
|
||||
image = GetImage (node);
|
||||
email = GetField (node, "t:e-mail");
|
||||
location = GetField (node, "t:location");
|
||||
organization = GetField (node, "t:organization");
|
||||
description = GetField (node, "t:description");
|
||||
tasks = GetTasks (node);
|
||||
|
||||
this.document = document;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return name.ToString ();
|
||||
}
|
||||
|
||||
public static string GetImage (XmlNode node)
|
||||
{
|
||||
string result = GetField (node, "t:image");
|
||||
|
||||
if (result == String.Empty)
|
||||
return "none.png";
|
||||
|
||||
else
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string GetField (XmlNode node, string selector)
|
||||
{
|
||||
XmlNode result = node.SelectSingleNode (selector, Write.nsmgr);
|
||||
|
||||
if (result == null)
|
||||
return String.Empty;
|
||||
|
||||
return result.InnerText;
|
||||
}
|
||||
|
||||
public static Name GetName (XmlNode node)
|
||||
{
|
||||
string first_name = GetField (node, "t:name/t:first-name");
|
||||
string last_name = GetField (node, "t:name/t:last-name");
|
||||
|
||||
return new Name (first_name, last_name);
|
||||
}
|
||||
|
||||
public static string [] GetTasks (XmlNode node)
|
||||
{
|
||||
XmlNodeList nodes = node.SelectNodes ("t:tasks/t:task", Write.nsmgr);
|
||||
|
||||
string [] result = new string [nodes.Count];
|
||||
|
||||
int i = 0;
|
||||
foreach (XmlNode n in nodes) {
|
||||
result [i] = n.InnerText;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public XmlElement RenderHtml ()
|
||||
{
|
||||
XmlElement root = document.CreateElement ("td");
|
||||
XmlElement table = document.CreateElement ("table");
|
||||
table.SetAttribute ("cellPadding", "0");
|
||||
table.SetAttribute ("border", "0");
|
||||
XmlElement tr = document.CreateElement ("tr");
|
||||
XmlElement td = document.CreateElement ("td");
|
||||
td.SetAttribute ("bgcolor", "#c3cda7");
|
||||
td.SetAttribute ("valign", "top");
|
||||
td.SetAttribute ("width", "1%");
|
||||
tr.AppendChild (td);
|
||||
table.AppendChild (tr);
|
||||
root.AppendChild (table);
|
||||
|
||||
XmlElement img = document.CreateElement ("img");
|
||||
img.SetAttribute ("align", "top");
|
||||
img.SetAttribute ("border", "0");
|
||||
img.SetAttribute ("height", "48");
|
||||
img.SetAttribute ("width", "48");
|
||||
img.SetAttribute ("src", "team/" + image);
|
||||
td.AppendChild (img);
|
||||
|
||||
td = document.CreateElement ("TD");
|
||||
td.SetAttribute ("bgcolor", "#c3cda7");
|
||||
td.SetAttribute ("valign", "bottom");
|
||||
td.SetAttribute ("width", "100%");
|
||||
tr.AppendChild (td);
|
||||
|
||||
td.AppendChild (name.ToXml (document));
|
||||
td.AppendChild (document.CreateElement ("br"));
|
||||
td.AppendChild (RenderEmail ());
|
||||
|
||||
tr = document.CreateElement ("tr");
|
||||
table.AppendChild (tr);
|
||||
td = document.CreateElement ("td");
|
||||
td.SetAttribute ("bgcolor", "#f5f8e4");
|
||||
td.SetAttribute ("valign", "top");
|
||||
tr.AppendChild (td);
|
||||
td.AppendChild (RenderLabel ("Location: "));
|
||||
|
||||
td = document.CreateElement ("td");
|
||||
td.SetAttribute ("bgcolor", "#f5f8e4");
|
||||
td.SetAttribute ("valign", "top");
|
||||
tr.AppendChild (td);
|
||||
td.AppendChild (document.CreateTextNode (location));
|
||||
|
||||
tr = document.CreateElement ("tr");
|
||||
table.AppendChild (tr);
|
||||
td = document.CreateElement ("td");
|
||||
td.SetAttribute ("bgcolor", "#f5f8e4");
|
||||
td.SetAttribute ("valign", "top");
|
||||
tr.AppendChild (td);
|
||||
td.AppendChild (RenderLabel ("Description: "));
|
||||
|
||||
td = document.CreateElement ("td");
|
||||
td.SetAttribute ("bgcolor", "#f5f8e4");
|
||||
td.SetAttribute ("valign", "top");
|
||||
tr.AppendChild (td);
|
||||
td.AppendChild (document.CreateTextNode (description));
|
||||
|
||||
tr = document.CreateElement ("tr");
|
||||
table.AppendChild (tr);
|
||||
td = document.CreateElement ("td");
|
||||
td.SetAttribute ("bgcolor", "#f5f8e4");
|
||||
td.SetAttribute ("valign", "top");
|
||||
tr.AppendChild (td);
|
||||
td.AppendChild (RenderLabel ("Tasks: "));
|
||||
|
||||
td = document.CreateElement ("td");
|
||||
td.SetAttribute ("bgcolor", "#f5f8e4");
|
||||
td.SetAttribute ("valign", "top");
|
||||
tr.AppendChild (td);
|
||||
td.AppendChild (RenderTasks ());
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
public XmlNode RenderTasks ()
|
||||
{
|
||||
|
||||
XmlElement element = document.CreateElement ("ol");
|
||||
element.SetAttribute ("type", "I");
|
||||
|
||||
foreach (string task in tasks) {
|
||||
XmlElement li = document.CreateElement ("li");
|
||||
li.AppendChild (document.CreateTextNode (task));
|
||||
element.AppendChild (li);
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public XmlNode RenderEmail ()
|
||||
{
|
||||
XmlElement a = document.CreateElement ("a");
|
||||
a.SetAttribute ("href", "mailto:" + email);
|
||||
XmlElement font = document.CreateElement ("font");
|
||||
font.SetAttribute ("size", "3");
|
||||
XmlText t = document.CreateTextNode (email);
|
||||
a.AppendChild (font);
|
||||
font.AppendChild (t);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
public XmlNode RenderLabel (string label)
|
||||
{
|
||||
string text = String.Format ("{0}: ", label);
|
||||
XmlElement element = document.CreateElement ("b");
|
||||
XmlText t = document.CreateTextNode (label );
|
||||
element.AppendChild (t);
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
class Page {
|
||||
|
||||
XmlDocument document;
|
||||
XmlElement tbody;
|
||||
|
||||
public Page ()
|
||||
{
|
||||
document = new XmlDocument ();
|
||||
|
||||
XmlElement table = document.CreateElement ("table");
|
||||
document.AppendChild (table);
|
||||
|
||||
tbody = document.CreateElement ("tbody");
|
||||
table.AppendChild (tbody);
|
||||
}
|
||||
|
||||
public XmlDocument Document {
|
||||
get { return document; }
|
||||
}
|
||||
|
||||
public void AddRow (XmlNode left, XmlNode right)
|
||||
{
|
||||
if (left == null && right == null)
|
||||
return;
|
||||
|
||||
XmlElement tr = document.CreateElement ("tr");
|
||||
tbody.AppendChild (tr);
|
||||
tr.AppendChild (left);
|
||||
|
||||
if (right == null)
|
||||
tr.AppendChild (document.CreateElement ("td"));
|
||||
else {
|
||||
tr.SetAttribute ("valign", "top");
|
||||
tr.AppendChild (right);
|
||||
}
|
||||
}
|
||||
|
||||
public void Write (TextWriter text_writer)
|
||||
{
|
||||
XmlTextWriter writer = new XmlTextWriter (text_writer);
|
||||
writer.Formatting = Formatting.Indented;
|
||||
|
||||
document.WriteContentTo (writer);
|
||||
|
||||
writer.Flush ();
|
||||
}
|
||||
|
||||
public void Write (string filename)
|
||||
{
|
||||
XmlTextWriter writer = new XmlTextWriter (filename, Encoding.Default);
|
||||
writer.Formatting = Formatting.Indented;
|
||||
|
||||
document.WriteContentTo (writer);
|
||||
writer.Flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Name {
|
||||
|
||||
string first_name;
|
||||
string last_name;
|
||||
|
||||
public Name (string a, string b)
|
||||
{
|
||||
this.first_name = a;
|
||||
this.last_name = b;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
if (first_name == null && last_name == null)
|
||||
return String.Empty;
|
||||
|
||||
return first_name + " " + last_name;
|
||||
}
|
||||
|
||||
public XmlNode ToXml (XmlDocument document)
|
||||
{
|
||||
XmlElement element = document.CreateElement ("font");
|
||||
element.SetAttribute ("size", "3");
|
||||
XmlElement b = document.CreateElement ("B");
|
||||
XmlText t = document.CreateTextNode (ToString ());
|
||||
b.AppendChild (t);
|
||||
element.AppendChild (b);
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1" ?>
|
||||
<xs:schema id="contributors" targetNamespace="http://go-mono.org/team.xsd" xmlns="http://go-mono.org/team.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="contributor">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="name" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="first-name" type="xs:string" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="last-name" type="xs:string" minOccurs="0" maxOccurs="1" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="e-mail" type="xs:string" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="image" type="xs:string" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="location" type="xs:string" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="organization" type="xs:string" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element name="tasks" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="task" type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
||||
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
@@ -1,32 +1,5 @@
|
||||
* System.Windows.Forms
|
||||
|
||||
Currently Windows.Forms support is not finished.
|
||||
|
||||
The System.Windows.Forms effort is taking two paths:
|
||||
|
||||
<ul>
|
||||
<li>Win32/Wine-based: This effort will use the Win32
|
||||
API, and use a stub program to run the with Wine.
|
||||
This allows applications that use P/Invoke to
|
||||
function, and event delivery through the Wndproc
|
||||
method to work for the most advanced and custom
|
||||
applications. This is the path of best compatibility.
|
||||
|
||||
Also, work on a Gtk-based rendered for Wine will be
|
||||
done, to make the user interface integrate with your
|
||||
desktop look.
|
||||
|
||||
<li>Gtk# based: This effort will build a subset of
|
||||
Windows.Forms that uses Gtk#. This gives a better
|
||||
integration with the desktop, but will not be
|
||||
completely compatible with the Windows edition. In
|
||||
particular code that uses P/Invoke to call into Win32
|
||||
or overwrite the Wndproc method to achieve special
|
||||
effects will not work.
|
||||
</ul>
|
||||
|
||||
* Win32/Wine edition.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -44,6 +17,11 @@
|
||||
it use the Gtk+ themes on X11 and Cocoa on MacOS to render the
|
||||
widgets, and get the native look and feel on each of these
|
||||
platforms.
|
||||
|
||||
There are no current plans to support embedded devices, but
|
||||
Gtk/FrameBuffer is an option. If you have suggestions or
|
||||
recommendations, please let us <a
|
||||
href="mailto:[email protected]">let us know</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="images/WINESWF.JPG"><img src="images/WINESWF-mini.JPG"></a>
|
||||
@@ -51,15 +29,6 @@
|
||||
|
||||
</table>
|
||||
|
||||
* Gtk# based
|
||||
|
||||
The code is contained in CVS.
|
||||
|
||||
There are no current plans to support embedded devices, but
|
||||
Gtk/FrameBuffer is an option. If you have suggestions or
|
||||
recommendations, please let us <a
|
||||
href="mailto:[email protected]">let us know</a>
|
||||
|
||||
* Contributing
|
||||
|
||||
The Winforms effort is being coordinated in the <a
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
Mono Ahead Of Time Compiler
|
||||
===========================
|
||||
|
||||
The new mono JIT has sophisticated optimization features. It uses SSA and has a
|
||||
pluggable architecture for further optimizations. This makes it possible and
|
||||
efficient to use the JIT also for AOT compilation.
|
||||
|
||||
|
||||
* file format: We use the native object format of the platform. That way it is
|
||||
possible to reuse existing tools like objdump and the dynamic loader. All we
|
||||
need is a working assembler, i.e. we write out a text file which is then
|
||||
passed to gas (the gnu assembler) to generate the object file.
|
||||
|
||||
* file names: we simply add ".so" to the generated file. For example:
|
||||
basic.exe -> basic.exe.so
|
||||
corlib.dll -> corlib.dll.so
|
||||
|
||||
* staring the AOT compiler: mini --aot assembly_name
|
||||
|
||||
The following things are saved in the object file:
|
||||
|
||||
* version infos:
|
||||
|
||||
* native code: this is labeled with method_XXXXXXXX: where XXXXXXXX is the
|
||||
hexadecimal token number of the method.
|
||||
|
||||
* additional informations needed by the runtime: For example we need to store
|
||||
the code length and the exception tables. We also need a way to patch
|
||||
constants only available at runtime (for example vtable and class
|
||||
addresses). This is stored i a binary blob labeled method_info_XXXXXXXX:
|
||||
|
||||
PROBLEMS:
|
||||
|
||||
- all precompiled methods must be domain independent, or we add patch infos to
|
||||
patch the target doamin.
|
||||
|
||||
- the main problem is how to patch runtime related addresses, for example:
|
||||
|
||||
- current application domain
|
||||
- string objects loaded with LDSTR
|
||||
- address of MonoClass data
|
||||
- static field offsets
|
||||
- method addreses
|
||||
- virtual function and interface slots
|
||||
@@ -1,208 +0,0 @@
|
||||
|
||||
* Proposal for the local register allocator
|
||||
|
||||
The local register allocator deals with allocating registers
|
||||
for temporaries inside a single basic block, while the global
|
||||
register allocator is concerned with method-wide allocation of
|
||||
variables.
|
||||
The global register allocator uses callee-saved register for it's
|
||||
purpouse so that there is no need to save and restore these registers
|
||||
at call sites.
|
||||
|
||||
There are a number of issues the local allocator needs to deal with:
|
||||
*) some instructions expect operands in specific registers (for example
|
||||
the shl instruction on x86, or the call instruction with thiscall
|
||||
convention, or the equivalent call instructions on other architectures,
|
||||
such as the need to put output registers in %oX on sparc)
|
||||
*) some instructions deliver results only in specific registers (for example
|
||||
the div instruction on x86, or the call instructionson on almost all
|
||||
the architectures).
|
||||
*) it needs to know what registers may be clobbered by an instruction
|
||||
(such as in a method call)
|
||||
*) it should avoid excessive reloads or stores to improve performance
|
||||
|
||||
While which specific instructions have limitations is architecture-dependent,
|
||||
the problem shold be solved in an arch-independent way to reduce code duplication.
|
||||
The register allocator will be 'driven' by the arch-dependent code, but it's
|
||||
implementation should be arch-independent.
|
||||
|
||||
To improve the current local register allocator, we need to
|
||||
keep more state in it than the current setup that only keeps busy/free info.
|
||||
|
||||
Possible state information is:
|
||||
|
||||
free: the resgister is free to use and it doesn't contain useful info
|
||||
freeable: the register contains data loaded from a local (there is
|
||||
also info about _which_ local it contains) as a result from previous
|
||||
instructions (like, there was a store from the register to the local)
|
||||
moveable: it contains live data that is needed in a following instruction, but
|
||||
the contents may be moved to a different register
|
||||
busy: the register contains live data and it is placed there because
|
||||
the following instructions need it exactly in that register
|
||||
allocated: the register is used by the global allocator
|
||||
|
||||
The local register allocator will have the following interfaces:
|
||||
|
||||
int get_register ();
|
||||
Searches for a register in the free state. If it doesn't find it,
|
||||
searches for a freeable register. Sets the status to moveable.
|
||||
Looking for a 'free' register before a freeable one should allow for
|
||||
removing a few redundant loads (though I'm still unsure if such
|
||||
things should be delegated entirely to the peephole pass).
|
||||
|
||||
int get_register_force (int reg);
|
||||
Returns 'reg' if it is free or freeable. If it is moveable, it moves it
|
||||
to another free or freeable register.
|
||||
Sets the status of 'reg' to busy.
|
||||
|
||||
void set_register_freeable (int reg);
|
||||
Sets the status of 'reg' to freeable.
|
||||
|
||||
void set_register_free (int reg);
|
||||
Sets the status of 'reg' to free.
|
||||
|
||||
void will_clobber (int reg);
|
||||
Spills the register to the stack. Sets the status to freeable.
|
||||
After the clobbering has occurred, set the status to free.
|
||||
|
||||
void register_unspill (int reg);
|
||||
Un-spills register reg and sets the status to moveable.
|
||||
|
||||
FIXME: how is the 'local' information represented? Maybe a MonoInst* pointer.
|
||||
|
||||
Note: the register allocator will insert instructions in the basic block
|
||||
during it's operation.
|
||||
|
||||
* Examples
|
||||
|
||||
Given the tree (on x86 the right argument to shl needs to be in ecx):
|
||||
|
||||
store (local1, shl (local1, call (some_arg)))
|
||||
|
||||
At the start of the basic block, the registers are set to the free state.
|
||||
The sequence of instructions may be:
|
||||
instruction register status -> [%eax %ecx %edx]
|
||||
start free free free
|
||||
eax = load local1 mov free free
|
||||
/* call clobbers eax, ecx, edx */
|
||||
spill eax free free free
|
||||
call mov free free
|
||||
/* now eax contains the right operand of the shl */
|
||||
mov %eax -> %ecx free busy free
|
||||
un-spill mov busy free
|
||||
shl %cl, %eax mov free free
|
||||
|
||||
The resulting x86 code is:
|
||||
mov $fffc(%ebp), %eax
|
||||
mov %eax, $fff0(%ebp)
|
||||
push some_arg
|
||||
call func
|
||||
mov %eax, %ecx
|
||||
mov $fff0(%ebp), %eax
|
||||
shl %cl, %eax
|
||||
|
||||
Note that since shl could operate directly on memory, we could have:
|
||||
|
||||
push some_arg
|
||||
call func
|
||||
mov %eax, %ecx
|
||||
shl %cl, $fffc(%ebp)
|
||||
|
||||
The above example with loading the operand in a register is just to complicate
|
||||
the example and show that the algorithm should be able to handle it.
|
||||
|
||||
Let's take another example with the this-call call convention (the first argument
|
||||
is passed in %ecx).
|
||||
In this case, will_clobber() will be called only on %eax and %edx, while %ecx
|
||||
will be allocated with get_register_force ().
|
||||
Note: when a register is allocated with get_register_force(), it should be set
|
||||
to a different state as soon as possible.
|
||||
|
||||
store (local1, shl (local1, this-call (local1)))
|
||||
|
||||
instruction register status -> [%eax %ecx %edx]
|
||||
start free free free
|
||||
eax = load local1 mov free free
|
||||
/* force load in %ecx */
|
||||
ecx = load local1 mov busy free
|
||||
spill eax free busy free
|
||||
call mov free free
|
||||
/* now eax contains the right operand of the shl */
|
||||
mov %eax -> %ecx free busy free
|
||||
un-spill mov busy free
|
||||
shl %cl, %eax mov free free
|
||||
|
||||
What happens when a register that we need to allocate with get_register_force ()
|
||||
contains an operand for the next instruction?
|
||||
|
||||
instruction register status -> [%eax %ecx %edx]
|
||||
eax = load local0 mov free free
|
||||
ecx = load local1 mov mov free
|
||||
get_register_force (ecx) here.
|
||||
We have two options:
|
||||
mov %ecx, %edx
|
||||
or:
|
||||
spill %ecx
|
||||
The first option is way better (and allows the peephole pass to
|
||||
just load the value in %edx directly, instead of loading first to %ecx).
|
||||
This doesn't work, though, if the instruction clobbers the %edx register
|
||||
(like in a this-call). So, we first need to clobber the registers
|
||||
(so the state of %ecx changes to freebale and there is no issue
|
||||
with get_register_force ()).
|
||||
What if an instruction both clobbers a register and requires it as
|
||||
an operand? Lets' take the x86 idiv instruction as an example: it
|
||||
requires the dividend in edx:eax and returns the result in eax,
|
||||
with the modulus in edx.
|
||||
|
||||
store (local1, div (local1, local2))
|
||||
|
||||
instruction register status -> [%eax %ecx %edx]
|
||||
eax = load local0 mov free free
|
||||
will_clobber eax, edx free mov free
|
||||
force mov %ecx, %eax busy free free
|
||||
set %edx busy free busy
|
||||
idiv mov free free
|
||||
|
||||
Note: edx is set to free after idiv, because the modulus is not needed
|
||||
(if it was a rem, eax would have been freed).
|
||||
If we load the divisor before will_clobber(), we'll have to spill
|
||||
eax and reload it later. If we load it just after the idiv, there is no issue.
|
||||
In any case, the algorithm should give the correct results and allow the operation.
|
||||
|
||||
Working recursively on the isntructions there shouldn't be huge issues
|
||||
with this algorithm (though, of course, it's not optimal and it may
|
||||
introduce excessive spills or register moves). The advantage over the current
|
||||
local reg allocator is that:
|
||||
1) the number of spills/moves would be smaller anyway
|
||||
2) a separate peephole pass could be able to eliminate reg moves
|
||||
3) we'll be able to remove the 'forced' spills we currently do with
|
||||
the return value of method calls
|
||||
|
||||
* Issues
|
||||
|
||||
How to best integrate such a reg allocator with the burg stuff.
|
||||
|
||||
Think about a call os sparc with two arguments: they got into %o0 and %o1
|
||||
and each of them sets the register as busy. But what if the values to put there
|
||||
are themselves the result of a call? %o0 is no problem, but for all the
|
||||
next argument n the above algorithm would spill all the 0...n-1 registers...
|
||||
|
||||
* Papers
|
||||
|
||||
More complex solutions to the local register allocator problem:
|
||||
http://dimacs.rutgers.edu/TechnicalReports/abstracts/1997/97-33.html
|
||||
|
||||
Combining register allocation and instruction scheduling:
|
||||
http://citeseer.nj.nec.com/motwani95combining.html
|
||||
|
||||
More on LRA euristics:
|
||||
http://citeseer.nj.nec.com/liberatore97hardness.html
|
||||
|
||||
Linear-time optimal code scheduling for delayedload architectures
|
||||
http://www.cs.wisc.edu/~fischer/cs701.f01/inst.sched.ps.gz
|
||||
|
||||
Precise Register Allocation for Irregular Architectures
|
||||
http://citeseer.nj.nec.com/kong98precise.html
|
||||
|
||||
Allocate registers first to subtrees that need more of them.
|
||||
http://www.upb.de/cs/ag-kastens/compii/folien/comment401-409.2.pdf
|
||||
@@ -1,653 +0,0 @@
|
||||
|
||||
A new JIT compiler for the Mono Project
|
||||
|
||||
Miguel de Icaza (miguel@{ximian.com,gnome.org}),
|
||||
|
||||
|
||||
* Abstract
|
||||
|
||||
Mini is a new compilation engine for the Mono runtime. The
|
||||
new engine is designed to bring new code generation
|
||||
optimizations, portability and pre-compilation.
|
||||
|
||||
In this document we describe the design decisions and the
|
||||
architecture of the new compilation engine.
|
||||
|
||||
* Introduction
|
||||
|
||||
Mono is a Open Source implementation of the .NET Framework: it
|
||||
is made up of a runtime engine that implements the ECMA Common
|
||||
Language Infrastructure (CLI), a set of compilers that target
|
||||
the CLI and a large collection of class libraries.
|
||||
|
||||
This article discusses the new code generation facilities that
|
||||
have been added to the Mono runtime.
|
||||
|
||||
First we discuss the overall architecture of the Mono runtime,
|
||||
and how code generation fits into it; Then we discuss the
|
||||
development and basic architecture of our first JIT compiler
|
||||
for the ECMA CIL framework. The next section covers the
|
||||
objectives for the work on the new JIT compiler, then we
|
||||
discuss the new features available in the new JIT compiler,
|
||||
and finally a technical description of the new code generation
|
||||
engine.
|
||||
|
||||
* Architecture of the Mono Runtime
|
||||
|
||||
The Mono runtime is an implementation of the ECMA Common
|
||||
Language Infrastructure (CLI), whose aim is to be a common
|
||||
platform for executing code in multiple languages.
|
||||
|
||||
Languages that target the CLI generate images that contain
|
||||
code in high-level intermediate representation called the
|
||||
"Common Intermediate Language". This intermediate language is
|
||||
rich enough to allow for programs and pre-compiled libraries
|
||||
to be reflected. The execution environment allows for an
|
||||
object oriented execution environment with single inheritance
|
||||
and multiple interface implementations.
|
||||
|
||||
This runtime provides a number of services for programs that
|
||||
are targeted to it: Just-in-Time compilation of CIL code into
|
||||
native code, garbage collection, thread management, I/O
|
||||
routines, single, double and decimal floating point,
|
||||
asynchronous method invocation, application domains, and a
|
||||
framework for building arbitrary RPC systems (remoting) and
|
||||
integration with system libraries through the Platform Invoke
|
||||
functionality.
|
||||
|
||||
The focus of this document is on the services provided by the
|
||||
Mono runtime to transform CIL bytecodes into code that is
|
||||
native to the underlying architecture.
|
||||
|
||||
The code generation interface is a set of macros that allow a
|
||||
C programmer to generate code on the fly, this is done
|
||||
through a set of macros found in the mono/jit/arch/ directory.
|
||||
These macros are used by the JIT compiler to generate native
|
||||
code.
|
||||
|
||||
The platform invocation code is interesting, as it generates
|
||||
CIL code on the fly to marshal parameters, and then this
|
||||
code is in turned processed by the JIT engine.
|
||||
|
||||
* Previous Experiences
|
||||
|
||||
Mono has built a JIT engine, which has been used to bootstrap
|
||||
Mono since January, 2002. This JIT engine has reasonable
|
||||
performance, and uses an tree pattern matching instruction
|
||||
selector based on the BURS technology. This JIT compiler was
|
||||
designed by Dietmar Maurer, Paolo Molaro and Miguel de Icaza.
|
||||
|
||||
The existing JIT compiler has three phases:
|
||||
|
||||
* Re-creation of the semantic tree from CIL
|
||||
byte-codes.
|
||||
|
||||
* Instruction selection, with a cost-driven
|
||||
engine.
|
||||
|
||||
* Code generation and register allocation.
|
||||
|
||||
It is also hooked into the rest of the runtime to provide
|
||||
services like marshaling, just-in-time compilation and
|
||||
invocation of "internal calls".
|
||||
|
||||
This engine constructed a collection of trees, which we
|
||||
referred to as the "forest of trees", this forest is created by
|
||||
"hydrating" the CIL instruction stream.
|
||||
|
||||
The first step was to identify the basic blocks on the method,
|
||||
and computing the control flow graph (cfg) for it. Once this
|
||||
information was computed, a stack analysis on each basic block
|
||||
was performed to create a forest of trees for each one of
|
||||
them.
|
||||
|
||||
So for example, the following statement:
|
||||
|
||||
int a, b;
|
||||
...
|
||||
b = a + 1;
|
||||
|
||||
Which would be represented in CIL as:
|
||||
|
||||
ldloc.0
|
||||
ldc.i4.1
|
||||
add
|
||||
stloc.1
|
||||
|
||||
After the stack analysis would create the following tree:
|
||||
|
||||
(STIND_I4 ADDR_L[EBX|2] (
|
||||
ADD (LDIND_I4 ADDR_L[ESI|1])
|
||||
CONST_I4[1]))
|
||||
|
||||
This tree contains information from the stack analysis: for
|
||||
instance, notice that the operations explicitly encode the
|
||||
data types they are operating on, there is no longer an
|
||||
ambiguity on the types, because this information has been
|
||||
inferred.
|
||||
|
||||
At this point the JIT would pass the constructed forest of
|
||||
trees to the architecture-dependent JIT compiler.
|
||||
|
||||
The architecture dependent code then performed register
|
||||
allocation (optionally using linear scan allocation for
|
||||
variables, based on life analysis).
|
||||
|
||||
Once variables had been assigned, a tree pattern matching with
|
||||
dynamic programming is used (the tree pattern matcher is
|
||||
custom build for each architecture, using a code
|
||||
generator: monoburg). The instruction selector used cost
|
||||
functions to select the best instruction patterns.
|
||||
|
||||
The instruction selector is able to produce instructions that
|
||||
take advantage of the x86 instruction indexing instructions
|
||||
for example.
|
||||
|
||||
One problem though is that the code emitter and the register
|
||||
allocator did not have any visibility outside the current
|
||||
tree, which meant that some redundant instructions were
|
||||
generated. A peephole optimizer with this architecture was
|
||||
hard to write, given the tree-based representation that is
|
||||
used.
|
||||
|
||||
This JIT was functional, but it did not provide a good
|
||||
architecture to base future optimizations on. Also the
|
||||
line between architecture neutral and architecture
|
||||
specific code and optimizations was hard to draw.
|
||||
|
||||
The JIT engine supported two code generation modes to support
|
||||
the two optimization modes for applications that host multiple
|
||||
application domains: generate code that will be shared across
|
||||
application domains, or generate code that will not be shared
|
||||
across application domains.
|
||||
|
||||
* Objectives of the new JIT engine.
|
||||
|
||||
We wanted to support a number of features that were missing:
|
||||
|
||||
* Ahead-of-time compilation.
|
||||
|
||||
The idea is to allow developers to pre-compile their code
|
||||
to native code to reduce startup time, and the working
|
||||
set that is used at runtime in the just-in-time compiler.
|
||||
|
||||
Although in Mono this has not been a visible problem, we
|
||||
wanted to pro-actively address this problem.
|
||||
|
||||
When an assembly (a Mono/.NET executable) is installed in
|
||||
the system, it would then be possible to pre-compile the
|
||||
code, and have the JIT compiler tune the generated code
|
||||
to the particular CPU on which the software is
|
||||
installed.
|
||||
|
||||
This is done in the Microsoft.NET world with a tool
|
||||
called ngen.exe
|
||||
|
||||
* Have a good platform for doing code optimizations.
|
||||
|
||||
The design called for a good architecture that would
|
||||
enable various levels of optimizations: some
|
||||
optimizations are better performed on high-level
|
||||
intermediate representations, some on medium-level and
|
||||
some at low-level representations.
|
||||
|
||||
Also it should be possible to conditionally turn these on
|
||||
or off. Some optimizations are too expensive to be used
|
||||
in just-in-time compilation scenarios, but these
|
||||
expensive optimizations can be turned on for
|
||||
ahead-of-time compilations or when using profile-guided
|
||||
optimizations on a subset of the executed methods.
|
||||
|
||||
* Reduce the effort required to port the Mono code
|
||||
generator to new architectures.
|
||||
|
||||
For Mono to gain wide adoption in the Unix world, it is
|
||||
necessary that the JIT engine works in most of today's
|
||||
commercial hardware platforms.
|
||||
|
||||
* Features of the new JIT engine.
|
||||
|
||||
The new JIT engine was architected by Dietmar Maurer and Paolo
|
||||
Molaro, based on the new objectives.
|
||||
|
||||
Mono provides a number of services to applications running
|
||||
with the new JIT compiler:
|
||||
|
||||
* Just-in-Time compilation of CLI code into native code.
|
||||
|
||||
* Ahead-of-Time compilation of CLI code, to reduce
|
||||
startup time of applications.
|
||||
|
||||
A number of software development features are also available:
|
||||
|
||||
* Execution time profiling (--profile)
|
||||
|
||||
Generates a report of the times consumed by routines,
|
||||
as well as the invocation times, as well as the
|
||||
callers.
|
||||
|
||||
* Memory usage profiling (--profile)
|
||||
|
||||
Generates a report of the memory usage by a program
|
||||
that is ran under the Mono JIT.
|
||||
|
||||
* Code coverage (--coverage)
|
||||
|
||||
* Execution tracing.
|
||||
|
||||
People who are interested in developing and improving the Mini
|
||||
JIT compiler will also find a few useful routines:
|
||||
|
||||
* Compilation times
|
||||
|
||||
This is used to time the execution time for the JIT
|
||||
when compiling a routine.
|
||||
|
||||
* Control Flow Graph and Dominator Tree drawing.
|
||||
|
||||
These are visual aids for the JIT developer: they
|
||||
render representations of the Control Flow graph, and
|
||||
for the more advanced optimizations, they draw the
|
||||
dominator tree graph.
|
||||
|
||||
This requires Dot (from the graphwiz package) and Ghostview.
|
||||
|
||||
* Code generator regression tests.
|
||||
|
||||
The engine contains support for running regression
|
||||
tests on the virtual machine, which is very helpful to
|
||||
developers interested in improving the engine.
|
||||
|
||||
* Optimization benchmark framework.
|
||||
|
||||
The JIT engine will generate graphs that compare
|
||||
various benchmarks embedded in an assembly, and run the
|
||||
various tests with different optimization flags.
|
||||
|
||||
This requires Perl, GD::Graph.
|
||||
|
||||
* Flexibility
|
||||
|
||||
This is probably the most important component of the new code
|
||||
generation engine. The internals are relatively easy to
|
||||
replace and update, even large passes can be replaced and
|
||||
implemented differently.
|
||||
|
||||
* New code generator
|
||||
|
||||
Compiling a method begins with the `mini_method_to_ir' routine
|
||||
that converts the CIL representation into a medium
|
||||
intermediate representation.
|
||||
|
||||
The mini_method_to_ir routine performs a number of operations:
|
||||
|
||||
* Flow analysis and control flow graph computation.
|
||||
|
||||
Unlike the previous version, stack analysis and control
|
||||
flow graphs are computed in a single pass in the
|
||||
mini_method_to_ir function, this is done for performance
|
||||
reasons: although the complexity increases, the benefit
|
||||
for a JIT compiler is that there is more time available
|
||||
for performing other optimizations.
|
||||
|
||||
* Basic block computation.
|
||||
|
||||
mini_method_to_ir populates the MonoCompile structure
|
||||
with an array of basic blocks each of which contains
|
||||
forest of trees made up of MonoInst structures.
|
||||
|
||||
* Inlining
|
||||
|
||||
Inlining is no longer restricted to methods containing
|
||||
one single basic block, instead it is possible to inline
|
||||
arbitrary complex methods.
|
||||
|
||||
The heuristics to choose what to inline are likely going
|
||||
to be tuned in the future.
|
||||
|
||||
* Method to opcode conversion.
|
||||
|
||||
Some method call invocations like `call Math.Sin' are
|
||||
transformed into an opcode: this transforms the call
|
||||
into a semantically rich node, which is later inline
|
||||
into an FPU instruction.
|
||||
|
||||
Various Array methods invocations are turned into
|
||||
opcodes as well (The Get, Set and Address methods)
|
||||
|
||||
* Tail recursion elimination
|
||||
|
||||
Basic blocks ****
|
||||
|
||||
The MonoInst structure holds the actual decoded instruction,
|
||||
with the semantic information from the stack analysis.
|
||||
MonoInst is interesting because initially it is part of a tree
|
||||
structure, here is a sample of the same tree with the new JIT
|
||||
engine:
|
||||
|
||||
(stind.i4 regoffset[0xffffffd4(%ebp)]
|
||||
(add (ldind.i4 regoffset[0xffffffd8(%ebp)])
|
||||
iconst[1]))
|
||||
|
||||
This is a medium-level intermediate representation (MIR).
|
||||
|
||||
Some complex opcodes are decomposed at this stage into a
|
||||
collection of simpler opcodes. Not every complex opcode is
|
||||
decomposed at this stage, as we need to preserve the semantic
|
||||
information during various optimization phases.
|
||||
|
||||
For example a NEWARR opcode carries the length and the type of
|
||||
the array that could be used later to avoid type checking or
|
||||
array bounds check.
|
||||
|
||||
There are a number of operations supported on this
|
||||
representation:
|
||||
|
||||
* Branch optimizations.
|
||||
|
||||
* Variable liveness.
|
||||
|
||||
* Loop optimizations: the dominator trees are
|
||||
computed, loops are detected, and their nesting
|
||||
level computed.
|
||||
|
||||
* Conversion of the method into static single assignment
|
||||
form (SSA form).
|
||||
|
||||
* Dead code elimination.
|
||||
|
||||
* Constant propagation.
|
||||
|
||||
* Copy propagation.
|
||||
|
||||
* Constant folding.
|
||||
|
||||
Once the above optimizations are optionally performed, a
|
||||
decomposition phase is used to turn some complex opcodes into
|
||||
internal method calls. In the initial version of the JIT
|
||||
engine, various operations on longs are emulated instead of
|
||||
being inlined. Also the newarr invocation is turned into a
|
||||
call to the runtime.
|
||||
|
||||
At this point, after computing variable liveness, it is
|
||||
possible to use the linear scan algorithm for allocating
|
||||
variables to registers. The linear scan pass uses the
|
||||
information that was previously gathered by the loop nesting
|
||||
and loop structure computation to favor variables in inner
|
||||
loops.
|
||||
|
||||
Stack space is then reserved for the local variables and any
|
||||
temporary variables generated during the various
|
||||
optimizations.
|
||||
|
||||
** Instruction selection
|
||||
|
||||
At this point, the BURS instruction selector is invoked to
|
||||
transform the tree-based representation into a list of
|
||||
instructions. This is done using a tree pattern matcher that
|
||||
is generated for the architecture using the `monoburg' tool.
|
||||
|
||||
Monoburg takes as input a file that describes tree patterns,
|
||||
which are matched against the trees that were produced by the
|
||||
engine in the previous stages.
|
||||
|
||||
The pattern matching might have more than one match for a
|
||||
particular tree. In this case, the match selected is the one
|
||||
whose cost is the smallest. A cost can be attached to each
|
||||
rule, and if no cost is provided, the implicit cost is one.
|
||||
Smaller costs are selected over higher costs.
|
||||
|
||||
The cost function can be used to select particular blocks of
|
||||
code for a given architecture, or by using a prohibitive high
|
||||
number to avoid having the rule match.
|
||||
|
||||
The various rules that our JIT engine uses transform a tree of
|
||||
MonoInsts into a list of monoinsts:
|
||||
|
||||
+-----------------------------------------------------------+
|
||||
| Tree List |
|
||||
| of ===> Instruction selection ===> of |
|
||||
| MonoInst MonoInst. |
|
||||
+-----------------------------------------------------------+
|
||||
|
||||
During this process various "types" of MonoInst kinds
|
||||
disappear and turned into lower-level representations. The
|
||||
JIT compiler just happens to reuse the same structure (this is
|
||||
done to reduce memory usage and improve memory locality).
|
||||
|
||||
The instruction selection rules are split in a number of
|
||||
files, each one with a particular purpose:
|
||||
|
||||
inssel.brg
|
||||
Contains the generic instruction selection
|
||||
patterns.
|
||||
|
||||
inssel-x86.brg
|
||||
Contains x86 specific rules.
|
||||
|
||||
inssel-ppc.brg
|
||||
Contains PowerPC specific rules.
|
||||
|
||||
inssel-long32.brg
|
||||
burg file for 64bit instructions on 32bit architectures.
|
||||
|
||||
inssel-long.brg
|
||||
burg file for 64bit architectures.
|
||||
|
||||
inssel-float.brg
|
||||
burg file for floating point instructions
|
||||
|
||||
For a given build, a set of those files would be included.
|
||||
For example, for the build of Mono on the x86, the following
|
||||
set is used:
|
||||
|
||||
inssel.brg inssel-x86.brg inssel-long32.brg inssel-float.brg
|
||||
|
||||
** Native method generation
|
||||
|
||||
The native method generation has a number of steps:
|
||||
|
||||
* Architecture specific register allocation.
|
||||
|
||||
The information about loop nesting that was
|
||||
previously gathered is used here to hint the
|
||||
register allocator.
|
||||
|
||||
* Generating the method prolog/epilog.
|
||||
|
||||
* Optionally generate code to introduce tracing facilities.
|
||||
|
||||
* Hooking into the debugger.
|
||||
|
||||
* Performing any pending fixups.
|
||||
|
||||
* Code generation.
|
||||
|
||||
*** Code Generation
|
||||
|
||||
The actual code generation is contained in the architecture
|
||||
specific portion of the compiler. The input to the code
|
||||
generator is each one of the basic blocks with its list of
|
||||
instructions that were produced in the instruction selection
|
||||
phase.
|
||||
|
||||
During the instruction selection phase, virtual registers are
|
||||
assigned. Just before the peephole optimization is performed,
|
||||
physical registers are assigned.
|
||||
|
||||
A simple peephole and algebraic optimizer is ran at this
|
||||
stage.
|
||||
|
||||
The peephole optimizer removes some redundant operations at
|
||||
this point. This is possible because the code generation at
|
||||
this point has visibility into the basic block that spans the
|
||||
original trees.
|
||||
|
||||
The algebraic optimizer performs some simple algebraic
|
||||
optimizations that replace expensive operations with cheaper
|
||||
operations if possible.
|
||||
|
||||
The rest of the code generation is fairly simple: a switch
|
||||
statement is used to generate code for each of the MonoInsts
|
||||
|
||||
We always try to allocate code in sequence, instead of just using
|
||||
malloc. This way we increase spatial locality which gives a massive
|
||||
speedup on most architectures.
|
||||
|
||||
*** Ahead of Time compilation
|
||||
|
||||
Ahead-of-Time compilation is a new feature of our new
|
||||
compilation engine. The compilation engine is shared by the
|
||||
Just-in-Time (JIT) compiler and the Ahead-of-Time compiler
|
||||
(AOT).
|
||||
|
||||
The difference is on the set of optimizations that are turned
|
||||
on for each mode: Just-in-Time compilation should be as fast
|
||||
as possible, while Ahead-of-Time compilation can take as long
|
||||
as required, because this is not done at a time critical
|
||||
time.
|
||||
|
||||
With AOT compilation, we can afford to turn all of the
|
||||
computationally expensive optimizations on.
|
||||
|
||||
After the code generation phase is done, the code and any
|
||||
required fixup information is saved into a file that is
|
||||
readable by "as" (the native assembler available on all
|
||||
systems). This assembly file is then passed to the native
|
||||
assembler, which generates a loadable module.
|
||||
|
||||
At execution time, when an assembly is loaded from the disk,
|
||||
the runtime engine will probe for the existence of a
|
||||
pre-compiled image. If the pre-compiled image exists, then it
|
||||
is loaded, and the method invocations are resolved to the code
|
||||
contained in the loaded module.
|
||||
|
||||
The code generated under the AOT scenario is slightly
|
||||
different than the JIT scenario. It generates code that is
|
||||
application-domain relative and that can be shared among
|
||||
multiple thread.
|
||||
|
||||
This is the same code generation that is used when the runtime
|
||||
is instructed to maximize code sharing on a multi-application
|
||||
domain scenario.
|
||||
|
||||
* SSA-based optimizations
|
||||
|
||||
SSA form simplifies many optimization because each variable
|
||||
has exactly one definition site. This means that each
|
||||
variable is only initialized once.
|
||||
|
||||
For example, code like this:
|
||||
|
||||
a = 1
|
||||
..
|
||||
a = 2
|
||||
call (a)
|
||||
|
||||
Is internally turned into:
|
||||
|
||||
a1 = 1
|
||||
..
|
||||
a2 = 2
|
||||
call (a2)
|
||||
|
||||
In the presence of branches, like:
|
||||
|
||||
if (x)
|
||||
a = 1
|
||||
else
|
||||
a = 2
|
||||
|
||||
call (a)
|
||||
|
||||
The code is turned into:
|
||||
|
||||
if (x)
|
||||
a1 = 1;
|
||||
else
|
||||
a2 = 2;
|
||||
a3 = phi (a1, a2)
|
||||
call (a3)
|
||||
|
||||
All uses of a variable are "dominated" by its definition
|
||||
|
||||
This representation is useful as it simplifies the
|
||||
implementation of a number of optimizations like conditional
|
||||
constant propagation, array bounds check removal and dead code
|
||||
elimination.
|
||||
|
||||
* Register allocation.
|
||||
|
||||
Global register allocation is performed on the medium
|
||||
intermediate representation just before instruction selection
|
||||
is performed on the method. Local register allocation is
|
||||
later performed at the basic-block level on the
|
||||
|
||||
Global register allocation uses the following input:
|
||||
|
||||
1) set of register-sized variables that can be allocated to a
|
||||
register (this is an architecture specific setting, for x86
|
||||
these registers are the callee saved register ESI, EDI and
|
||||
EBX).
|
||||
|
||||
2) liveness information for the variables
|
||||
|
||||
3) (optionally) loop info to favor variables that are used in
|
||||
inner loops.
|
||||
|
||||
During instruction selection phase, symbolic registers are
|
||||
assigned to temporary values in expressions.
|
||||
|
||||
Local register allocation assigns hard registers to the
|
||||
symbolic registers, and it is performed just before the code
|
||||
is actually emitted and is performed at the basic block level.
|
||||
A CPU description file describes the input registers, output
|
||||
registers, fixed registers and clobbered registers by each
|
||||
operation.
|
||||
|
||||
* BURG Code Generator Generator
|
||||
|
||||
monoburg was written by Dietmar Maurer. It is based on the
|
||||
papers from Christopher W. Fraser, Robert R. Henry and Todd
|
||||
A. Proebsting: "BURG - Fast Optimal Instruction Selection and
|
||||
Tree Parsing" and "Engineering a Simple, Efficient Code
|
||||
Generator Generator".
|
||||
|
||||
The original BURG implementation is unable to work on DAGs, instead only
|
||||
trees are allowed. Our monoburg implementations is able to generate tree
|
||||
matcher which works on DAGs, and we use this feature in the new
|
||||
JIT. This simplifies the code because we can directly pass DAGs and
|
||||
don't need to convert them to trees.
|
||||
|
||||
* Future
|
||||
|
||||
Profile-based optimization is something that we are very
|
||||
interested in supporting. There are two possible usage
|
||||
scenarios:
|
||||
|
||||
* Based on the profile information gathered during
|
||||
the execution of a program, hot methods can be compiled
|
||||
with the highest level of optimizations, while bootstrap
|
||||
code and cold methods can be compiled with the least set
|
||||
of optimizations and placed in a discardable list.
|
||||
|
||||
* Code reordering: this profile-based optimization would
|
||||
only make sense for pre-compiled code. The profile
|
||||
information is used to re-order the assembly code on disk
|
||||
so that the code is placed on the disk in a way that
|
||||
increments locality.
|
||||
|
||||
This is the same principle under which SGI's cord program
|
||||
works.
|
||||
|
||||
The nature of the CIL allows the above optimizations to be
|
||||
easy to implement and deploy. Since we live and define our
|
||||
universe for these things, there are no interactions with
|
||||
system tools required, nor upgrades on the underlying
|
||||
infrastructure required.
|
||||
|
||||
Instruction scheduling is important for certain kinds of
|
||||
processors, and some of the framework exists today in our
|
||||
register allocator and the instruction selector to cope with
|
||||
this, but has not been finished. The instruction selection
|
||||
would happen at the same time as local register allocation.
|
||||
@@ -1,113 +0,0 @@
|
||||
|
||||
* How to handle complex IL opcodes in an arch-independent way
|
||||
|
||||
Many IL opcodes are very simple: add, ldind etc.
|
||||
Such opcodes can be implemented with a single cpu instruction
|
||||
in most architectures (on some, a group of IL instructions
|
||||
can be converted to a single cpu op).
|
||||
There are many IL opcodes, though, that are more complex, but
|
||||
can be expressed as a series of trees or a single tree of
|
||||
simple operations. Such simple operations are architecture-independent.
|
||||
It makes sense to decompose such complex IL instructions in their
|
||||
simpler equivalent so that we gain in several ways:
|
||||
*) porting effort is easier, because only the simple instructions
|
||||
need to be implemented in arch-specific code
|
||||
*) we could apply BURG rules to the trees and do pattern matching
|
||||
on them to optimize the expressions according to the host cpu
|
||||
|
||||
The issue is: where do we do such conversion from coarse opcodes to
|
||||
simple expressions?
|
||||
|
||||
* Doing the conversion in method_to_ir ()
|
||||
|
||||
Some of these conversions can certainly be done in method_to_ir (),
|
||||
but it's not always easy to decide which are better done there and
|
||||
which in a different pass.
|
||||
For example, let's take ldlen: in the mono implementation, ldlen
|
||||
can be simply implemented with a load from a fixed position in the
|
||||
array object:
|
||||
|
||||
len = [reg + maxlen_offset]
|
||||
|
||||
However, ldlen carries also semantics information: the result is the
|
||||
length of the array, and since in the CLR arrays are of fixed size,
|
||||
this information can be useful to later do bounds check removal.
|
||||
If we convert this opcode in method_to_ir () we lost some useful
|
||||
information for further optimizations.
|
||||
|
||||
In some other ways, decomposing an opcode in method_to_ir() may
|
||||
allow for better optimizations later on (need to come up with an
|
||||
example here ...).
|
||||
|
||||
* Doing the conversion in inssel.brg
|
||||
|
||||
Some conversion may be done inside the burg rules: this has the
|
||||
disadvantage that the instruction selector is not run again on
|
||||
the resulting expression tree and we could miss some optimization
|
||||
(this is what effectively happens with the coarse opcodes in the old
|
||||
jit). This may also interfere with an efficient local register allocator.
|
||||
It may be possible to add an extension in monoburg that allows a rule
|
||||
such as:
|
||||
|
||||
recheck: LDLEN (reg) {
|
||||
create an expression tree representing LDLEN
|
||||
and return it
|
||||
}
|
||||
|
||||
When the monoburg label process gets back a recheck, it will run
|
||||
the labeling again on the resulting expression tree.
|
||||
If this is possible at all (and in an efficient way) is a
|
||||
question for dietmar:-)
|
||||
It should be noted, though, that this may not always work, since
|
||||
some complex IL opcodes may require a series of expression trees
|
||||
and handling such cases in monoburg could become quite hairy.
|
||||
For example, think of opcode that need to do multiple actions on the
|
||||
same object: this basically means a DUP...
|
||||
On the other end, if a complex opcode needs a DUP, monoburg doesn't
|
||||
actually need to create trees if it emits the instructions in
|
||||
the correct sequence and maintains the right values in the registers
|
||||
(usually the values that need a DUP are not changed...). How
|
||||
this integrates with the current register allocator is not clear, since
|
||||
that assigns registers based on the rule, but the instructions emitted
|
||||
by the rules may be different (this already happens with the current JIT
|
||||
where a MULT is replaced with lea etc...).
|
||||
|
||||
* Doing it in a separate pass.
|
||||
|
||||
Doing the conversion in a separate pass over the instructions
|
||||
is another alternative. This can be done right after method_to_ir ()
|
||||
or after the SSA pass (since the IR after the SSA pass should look
|
||||
almost like the IR we get back from method_to_ir ()).
|
||||
|
||||
This has the following advantages:
|
||||
*) monoburg will handle only the simple opcodes (makes porting easier)
|
||||
*) the instruction selection will be run on all the additional trees
|
||||
*) it's easier to support coarse opcodes that produce multiple expression
|
||||
trees (and apply the monoburg selector on all of them)
|
||||
*) the SSA optimizer will see the original opcodes and will be able to use
|
||||
the semantic info associated with them
|
||||
|
||||
The disadvantage is that this is a separate pass on the code and
|
||||
it takes time (how much has not been measured yet, though).
|
||||
|
||||
With this approach, we may also be able to have C implementations
|
||||
of some of the opcodes: this pass would insert a function call to
|
||||
the C implementation (for example in the cases when first porting
|
||||
to a new arch and implemenating some stuff may be too hard in asm).
|
||||
|
||||
* Extended basic blocks
|
||||
|
||||
IL code needs a lot of checks, bounds checks, overflow checks,
|
||||
type checks and so on. This potentially increases by a lot
|
||||
the number of basic blocks in a control flow graph. However,
|
||||
all such blocks end up with a throw opcode that gives control to the
|
||||
exception handling mechanism.
|
||||
After method_to_ir () a MonoBasicBlock can be considered a sort
|
||||
of extended basic block where the additional exits don't point
|
||||
to basic blocks in the same procedure (at least when the method
|
||||
doesn't have exception tables).
|
||||
We need to make sure the passes following method_to_ir () can cope
|
||||
with such kinds of extended basic blocks (especially the passes
|
||||
that we need to apply to all the methods: as a start, we could
|
||||
skip SSA optimizations for methods with exception clauses...)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
man_MANS = mcs.1 mono.1 monostyle.1 mono-config.5 sqlsharp.1 oldmono.1 ilasm.1 \
|
||||
cert2spc.1 cilc.1
|
||||
man_MANS = mcs.1 mono.1 monostyle.1 mono-config.5 sqlsharp.1
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
.TH "cilc" 1
|
||||
.SH NAME
|
||||
cilc \- Mono CIL-to-C binding generator
|
||||
.SH SYNOPSIS
|
||||
.B cilc
|
||||
[options]
|
||||
.I assembly
|
||||
.I target
|
||||
.SH DESCRIPTION
|
||||
cilc is the Mono CIL-to-C binding generator. It takes a CIL assembly as input
|
||||
and generates a directory of C sources which, when compiled, provide a C
|
||||
interface to the classes contained within that assembly by means of a shared
|
||||
object library.
|
||||
.PP
|
||||
Generated sources make use of the Mono embedding API. Thus a complete Mono
|
||||
development environment must be available on the development system and a
|
||||
complete Mono runtime environment must be available on target systems.
|
||||
.SH AUTHOR
|
||||
Written by Alp Toker <[email protected]>
|
||||
.SH SEE ALSO
|
||||
mono(1)
|
||||
@@ -1,44 +0,0 @@
|
||||
.TH "ilasm" 1
|
||||
.SH NAME
|
||||
ilasm \- Mono IL assembler
|
||||
.SH SYNOPSIS
|
||||
.B ilasm
|
||||
[option] [source-files]
|
||||
.SH DESCRIPTION
|
||||
ilasm is the Mono ILAsm assembler. You can pass one or more options to
|
||||
drive the compiler, and a set of source files.
|
||||
|
||||
The Mono ILAsm assembler accepts options starting with / or - for mosted
|
||||
options.
|
||||
|
||||
The Mono ILAsm assembler generates images (.exe and .dll files) that contain
|
||||
CIL byte code that can be executed by any system that implemented a Common
|
||||
Language Infrastructure virtual machine.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \//out:<file_name>
|
||||
Specify the output file name.
|
||||
.TP
|
||||
.B \//exe
|
||||
Generate an exe
|
||||
.TP
|
||||
.B \//dll
|
||||
Generate a library
|
||||
.TP
|
||||
.B \//scan_only
|
||||
Just scan the IL code and display tokens.
|
||||
.TP
|
||||
.B \//show_tokens
|
||||
Show tokens as they are parsed.
|
||||
.TP
|
||||
.B \//show_method_def
|
||||
Display method information when a method is defined.
|
||||
.TP
|
||||
.B \//show_method_ref
|
||||
Display method information when a method is referenced
|
||||
.TP
|
||||
.B \--about
|
||||
Display information about ilasm
|
||||
.TP
|
||||
.B \--version
|
||||
Display ilasm version
|
||||
@@ -59,10 +59,11 @@ or can be used by methods that have been tagged with the Conditional
|
||||
attribute.
|
||||
.TP
|
||||
.I \-debug, \-debug+, \-g
|
||||
Generate debugging information. To obtain stack traces with debugging
|
||||
information, you need to invoke the mono runtime with the `--debug'
|
||||
flag. This debugging information is stored inside the assembly as a
|
||||
resource.
|
||||
Generate debugging information. The debugging information is stored
|
||||
in a file with the extension .dbg (if you install system wide
|
||||
assemblies, you need to install this file as well). To get stack
|
||||
traces with debugging information, you need to invoke the mono runtime
|
||||
with the `--debug' flag.
|
||||
.TP
|
||||
.I \-debug-
|
||||
Do not generate debugging information.
|
||||
@@ -152,12 +153,6 @@ comma.
|
||||
.I \-v
|
||||
Debugging. Turns on verbose yacc parsing.
|
||||
.TP
|
||||
.I \-v2
|
||||
Turns on C# 2.0 language features.
|
||||
.TP
|
||||
.I \-\-version
|
||||
Shows the compiler version.
|
||||
.TP
|
||||
.I \-\-
|
||||
Use this to stop option parsing, and allow option-looking parameters
|
||||
to be passed on the command line.
|
||||
|
||||
@@ -1,188 +1,141 @@
|
||||
.\"
|
||||
.\" mono manual page.
|
||||
.\" (C) 2003 Ximian, Inc.
|
||||
.\" (C) Ximian, Inc.
|
||||
.\" Author:
|
||||
.\" Miguel de Icaza ([email protected])
|
||||
.\"
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.TH Mono "Mono 1.0"
|
||||
.SH NAME
|
||||
mono \- Mono's code ECMA-CLI code generator (Just-in-Time and Ahead-of-Time)
|
||||
mono \- Mono ECMA-CLI Just in Time compiler.
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
.B mono [options] file [arguments...]
|
||||
.B mono
|
||||
[\-\-help] [\-d] [\-\-debug-asm] [\-\-debug-forest] [\-\-trace-calls]
|
||||
[\-\-compile name] [\-\-ncompile num] [\-\-noinline] [\-\-profile]
|
||||
[\-\-debug=[format]] [\-\-debug-args args] [\-\-break name] [\-\-precompile name]
|
||||
[\-\-config filename]
|
||||
program.exe [arguments...]
|
||||
.SH DESCRIPTION
|
||||
\fImono\fP is a runtime implementation of the ECMA Common Language
|
||||
Infrastructure. This can be used to run ECMA and .NET applications.
|
||||
.PP
|
||||
The runtime contains a native code generator that transforms the
|
||||
Common Intermediate Language into native code.
|
||||
.PP
|
||||
The code generator can operate in two modes: just in time compilation
|
||||
(JIT) or ahead of time compilation (AOT). Since code can be
|
||||
dynamically loaded, the runtime environment and the JIT are always
|
||||
present, even if code is compiled ahead of time.
|
||||
.PP
|
||||
The runtime loads ths specified
|
||||
.I file
|
||||
The \fImono\fP program is a Just in Time compiler for ECMA CLI byte
|
||||
codes. It translates dynamically a CIL stream into native code.
|
||||
.I program.exe
|
||||
and optionally passes
|
||||
the
|
||||
.I arguments
|
||||
to it. The
|
||||
.I file
|
||||
is an ECMA assembly. They typically have a .exe or .dll extension.
|
||||
.PP
|
||||
The runtime provides a number of configuration options for running
|
||||
applications, for developping and debugging, and for testing and
|
||||
debugging the runtime itself.
|
||||
.SH RUNTIME OPTIONS
|
||||
The following options are available:
|
||||
to it.
|
||||
.SH OPTIONS
|
||||
The following options are supported:
|
||||
.TP
|
||||
.I "--aot"
|
||||
This option is used to precompile the CIL code in the specified
|
||||
assembly to native code. The generated code is stored in a file with
|
||||
the extension .so. This file will be automatically picked up by the
|
||||
runtime when the assembly is executed.
|
||||
.Sp
|
||||
This pre-compiles the methods, but the original assembly is still
|
||||
required to execute as this one contains the metadata and exception
|
||||
information which is not availble on the generated file. When
|
||||
precompiling code, you might want to compile with all optimizations
|
||||
(-O=all). Pre-compiled code is position independent code.
|
||||
.Sp
|
||||
Pre compilation is just a mechanism to reduce startup time, and avoid
|
||||
just-in-time compilation costs. The original assembly must still be
|
||||
present, as the metadata is contained there.
|
||||
.I "--help", "-h"
|
||||
Displays usage instructions.
|
||||
.I "--share-code"
|
||||
This mode makes the LoaderOptimization for Application Domains default
|
||||
to sharing code. This results in slower code, but enables code
|
||||
sharing across application domains. The default is to maximize for
|
||||
speed, but disallow JITed code sharing across domains. See
|
||||
System.LoaderOptimization for more information
|
||||
.TP
|
||||
.I "--config filename"
|
||||
Load the specified configuration file instead of the default one(s).
|
||||
The default files are /etc/mono/config and ~/.mono/config or the file
|
||||
specified in the MONO_CONFIG environment variable, if set. See the
|
||||
mono-config(5) man page for details on the format of this file.
|
||||
specified in the MONO_CONFIG environment variable, if set.
|
||||
.TP
|
||||
.I "--help", "-h"
|
||||
Displays usage instructions.
|
||||
.I "--noinline"
|
||||
Disables the code inliner.
|
||||
.TP
|
||||
.I "--optimize=MODE", "-O=mode"
|
||||
MODE is a comma separated list of optimizations. They also allow
|
||||
optimizations to be turned off by prefixing the optimization name with
|
||||
a minus sign.
|
||||
.Sp
|
||||
The following optimizations are implemented:
|
||||
.nf
|
||||
all Turn on all optimizations
|
||||
peephole Peephole postpass
|
||||
branch Branch optimizations
|
||||
inline Inline method calls
|
||||
cfold Constant folding
|
||||
consprop Constant propagation
|
||||
copyprop Copy propagation
|
||||
deadce Dead code elimination
|
||||
linears Linear scan global reg allocation
|
||||
cmov Conditional moves
|
||||
shared Emit per-domain code
|
||||
sched Instruction scheduling
|
||||
instrins Intrinsic method implementations
|
||||
tailc Tail recursion and tail calls
|
||||
loop Loop related optimizations
|
||||
.fi
|
||||
.Sp
|
||||
For example, to enable all the optimization but dead code
|
||||
elimination and inlining, you can use:
|
||||
.nf
|
||||
-O=all,-deadce,-inline
|
||||
.fi
|
||||
.SH DEVELOPMENT OPTIONS
|
||||
.SH DEBUGGING OPTIONS
|
||||
The following options are used to debug, or perfomance test the JIT
|
||||
compiler:
|
||||
.TP
|
||||
.I "--break method"
|
||||
Inserts a breakpoint before the method whose name is `method'
|
||||
(namespace.class:methodname). Use `Main' as method name to insert a
|
||||
breakpoint on the application's main method.
|
||||
.TP
|
||||
.I "--breakonex"
|
||||
Inserts a breakpoint on exceptions. This allows you to debug your
|
||||
application with a native debugger when an exception is thrown.
|
||||
.TP
|
||||
.I "--coverage"
|
||||
Performs coverage analysis on the underlying IL code.
|
||||
.TP
|
||||
.I "--trace"
|
||||
.I "--trace-calls"
|
||||
Shows method names as they are invoked.
|
||||
|
||||
|
||||
|
||||
.TP
|
||||
.I "--dump-asm"
|
||||
Displays the generated code as methods are invoked.
|
||||
.TP
|
||||
.I "--dump-forest"
|
||||
Displays the basic blocks and the forest of trees that is
|
||||
created from a stream of CIL opcodes.
|
||||
.TP
|
||||
.I "--compile name"
|
||||
Compiles the method on the given class (namespace.name:methodname) or
|
||||
all classes in the given image (@imagename).
|
||||
.TP
|
||||
.I "--ncompile"
|
||||
Compiles the method a number of times. If no argument is specified,
|
||||
the method will be compiled a thousand times.
|
||||
.SH DEVELOPMENT OPTIONS
|
||||
The following options are used to debug a JITed application. They're
|
||||
only useful when running the JIT in a debugger:
|
||||
.TP
|
||||
.I "--debug"
|
||||
Turns on the debugging mode in the runtime. If an assembly was
|
||||
compiled with debugging information, it will produce line number
|
||||
information for stack traces.
|
||||
Writes out debug information in the given format or in the default format.
|
||||
See DEBUGGING FORMATS for details.
|
||||
.TP
|
||||
.I "--debug-args args"
|
||||
Comma-separated list of additional arguments for the symbol writer.
|
||||
See DEBUGGING FORMATS for details.
|
||||
.TP
|
||||
.I "--break method"
|
||||
Inserts a breakpoint before the method whose name is `method'
|
||||
(namespace.class:methodname). Use `Main' as method name to insert a breakpoint on the
|
||||
application's main method.
|
||||
.TP
|
||||
.I "--precompile name"
|
||||
Compiles the given class (namespace.name), method (namespace.name:methodname)
|
||||
or all classes in the given image (@imagename) before executing the main
|
||||
application.
|
||||
.TP
|
||||
.I "--profile"
|
||||
Instructs the runtime to collect profiling information about execution
|
||||
times and memory allocation, and dump it at the end of the execution.
|
||||
|
||||
|
||||
|
||||
.SH MAINTAINER OPTIONS
|
||||
The maintainer options are only used by those developing the runtime
|
||||
itself, and not typically of interest to runtime users or developers.
|
||||
Collect profiling information and dump it at the end of the process.
|
||||
.SH DEBUGGING FORMATS
|
||||
The following debugging formats are currently supported:
|
||||
.TP
|
||||
.I "--compile name"
|
||||
This compiles a method (namespace.name:methodname), this is used for
|
||||
testing the compiler performance or to examine the output of the code
|
||||
generator.
|
||||
.I "stabs"
|
||||
Writes out stabs debug information.
|
||||
.TP
|
||||
.I "--compileall"
|
||||
Compiles all the methods in an assembly. This is used to test the
|
||||
compiler performance or to examine the output of the code generator
|
||||
.TP
|
||||
.I "--graph=TYPE METHOD"
|
||||
This generates a postscript file with a graph with the details about
|
||||
the specified method (namespace.name:methodname). This requires `dot'
|
||||
and ghostview to be installed (it expects Ghostview to be called
|
||||
"gv").
|
||||
.I "dwarf"
|
||||
Writes out dwarf debug information.
|
||||
.TP
|
||||
The following graphs are available:
|
||||
.nf
|
||||
cfg Control Flow Graph (CFG)
|
||||
dtree Dominator Tree
|
||||
code CFG showing code
|
||||
ssa CFG showing code after SSA translation
|
||||
optcode CFG showing code after IR optimizations
|
||||
.fi
|
||||
.Sp
|
||||
Some graphs will only be available if certain optimizations are turned
|
||||
on.
|
||||
.I "mono"
|
||||
Use a symbol file which has been created by MCS. It can be used to get
|
||||
source lines in stack traces.
|
||||
.PP
|
||||
The "stabs" and "dwarf" formats support the following options:
|
||||
.TP
|
||||
.I "--ncompile"
|
||||
Instruct the runtime on the number of times that the method specified
|
||||
by --compile (or all the methods if --compileall is used) to be
|
||||
compiled. This is used for testing the code generator performance.
|
||||
.I "filename=FILENAME"
|
||||
Write debugging information into FILENAME. This file must be run through
|
||||
the assembler to create an object file.
|
||||
.TP
|
||||
.I "-v", "--verbose"
|
||||
Increases the verbosity level, each time it is listed, increases the
|
||||
verbosity level to include more information.
|
||||
.I "objfile=FILENAME"
|
||||
When automatically assembling the symbol file, write the resulting object
|
||||
file into FILENAME.
|
||||
.TP
|
||||
.I "-V", "--version"
|
||||
Prints JIT version information.
|
||||
|
||||
|
||||
.I "dont_assemble"
|
||||
Normally, the symbol file is automatically assembled to an object file
|
||||
when you call "mono_debug_make_symbols". Use this option to disable this
|
||||
behaviour.
|
||||
.TP
|
||||
.I "install_il_files"
|
||||
Put the generated *.il files in the same directory than the assembly they
|
||||
came from. The default is to put them into the current working directory.
|
||||
.TP
|
||||
.I "dont_update_il_files"
|
||||
Normally, the *.il files are recreated if their assemblies have changed
|
||||
when you call "mono_debug_make_symbols". Use this option to disable this
|
||||
behaviour.
|
||||
.TP
|
||||
.I "dont_create_il_files"
|
||||
Update the *.il files if their assemblies have changed, but only if the
|
||||
file already exists.
|
||||
.PP
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
.TP
|
||||
.I "GC_DONT_GC"
|
||||
Turns off the garbage collection in Mono. This should be only used
|
||||
for debugging purposes
|
||||
.TP
|
||||
.I "MONO_PATH"
|
||||
Provides a search path to the runtime where to look for library files.
|
||||
Provides a search path to mono and mint where to look for library files.
|
||||
Directories are separated by the platform path separator (colons on unix). Example:
|
||||
.B /home/username/lib:/usr/local/mono/lib
|
||||
.PP
|
||||
.TP
|
||||
.I "MONO_DISABLE_SHM"
|
||||
If this variable is set, it disables the Windows I/O Emulation layer,
|
||||
@@ -192,11 +145,6 @@ processes. This option is only available on Unix.
|
||||
.I "MONO_CFG_DIR"
|
||||
If set, this variable overrides the default system configuration directory
|
||||
($PREFIX/etc). It's used to locate machine.config file.
|
||||
.TP
|
||||
.I "MONO_CONFIG"
|
||||
If set, this variable overrides the default runtime configuration file
|
||||
($PREFIX/etc/mono/config). The --config command line options overrides the
|
||||
environment variable.
|
||||
.SH FILES
|
||||
On Unix assemblies are loaded from the installation lib directory. If you set
|
||||
`prefix' to /usr, the assemblies will be located in /usr/lib. On
|
||||
@@ -204,7 +152,7 @@ Windows, the assemblies are loaded from the directory where mono and
|
||||
mint live.
|
||||
.PP
|
||||
/etc/mono/config, ~/.mono/config
|
||||
.PP
|
||||
.IP
|
||||
Mono runtime configuration file. See the mono-config(5) manual page
|
||||
for more information.
|
||||
.SH MAILING LISTS
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
.\"
|
||||
.\" mono manual page.
|
||||
.\" (C) Ximian, Inc.
|
||||
.\" Author:
|
||||
.\" Miguel de Icaza ([email protected])
|
||||
.\"
|
||||
.TH Mono "Mono 1.0"
|
||||
.SH NAME
|
||||
mono \- Mono ECMA-CLI Just in Time compiler.
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
.B mono
|
||||
[\-\-help] [\-d] [\-\-debug-asm] [\-\-debug-forest] [\-\-trace-calls]
|
||||
[\-\-compile name] [\-\-ncompile num] [\-\-noinline] [\-\-profile]
|
||||
[\-\-debug=[format]] [\-\-debug-args args] [\-\-break name] [\-\-precompile name]
|
||||
[\-\-config filename]
|
||||
program.exe [arguments...]
|
||||
.SH DESCRIPTION
|
||||
The \fImono\fP program is a Just in Time compiler for ECMA CLI byte
|
||||
codes. It translates dynamically a CIL stream into native code.
|
||||
.I program.exe
|
||||
and optionally passes
|
||||
the
|
||||
.I arguments
|
||||
to it.
|
||||
.SH OPTIONS
|
||||
The following options are supported:
|
||||
.TP
|
||||
.I "--help", "-h"
|
||||
Displays usage instructions.
|
||||
.TP
|
||||
.I "--share-code"
|
||||
This mode makes the LoaderOptimization for Application Domains default
|
||||
to sharing code. This results in slower code, but enables code
|
||||
sharing across application domains. The default is to maximize for
|
||||
speed, but disallow JITed code sharing across domains. See
|
||||
System.LoaderOptimization for more information
|
||||
.TP
|
||||
.I "--config filename"
|
||||
Load the specified configuration file instead of the default one(s).
|
||||
The default files are /etc/mono/config and ~/.mono/config or the file
|
||||
specified in the MONO_CONFIG environment variable, if set.
|
||||
.TP
|
||||
.I "--noinline"
|
||||
Disables the code inliner.
|
||||
.TP
|
||||
.SH DEBUGGING OPTIONS
|
||||
The following options are used to debug, or perfomance test the JIT
|
||||
compiler:
|
||||
.TP
|
||||
.I "--trace-calls"
|
||||
Shows method names as they are invoked.
|
||||
.TP
|
||||
.I "--dump-asm"
|
||||
Displays the generated code as methods are invoked.
|
||||
.TP
|
||||
.I "--dump-forest"
|
||||
Displays the basic blocks and the forest of trees that is
|
||||
created from a stream of CIL opcodes.
|
||||
.TP
|
||||
.I "--compile name"
|
||||
Compiles the method on the given class (namespace.name:methodname) or
|
||||
all classes in the given image (@imagename).
|
||||
.TP
|
||||
.I "--ncompile"
|
||||
Compiles the method a number of times. If no argument is specified,
|
||||
the method will be compiled a thousand times.
|
||||
.SH DEVELOPMENT OPTIONS
|
||||
The following options are used to debug a JITed application. They're
|
||||
only useful when running the JIT in a debugger:
|
||||
.TP
|
||||
.I "--debug"
|
||||
Writes out debug information in the given format or in the default format.
|
||||
See DEBUGGING FORMATS for details.
|
||||
.TP
|
||||
.I "--debug-args args"
|
||||
Comma-separated list of additional arguments for the symbol writer.
|
||||
See DEBUGGING FORMATS for details.
|
||||
.TP
|
||||
.I "--break method"
|
||||
Inserts a breakpoint before the method whose name is `method'
|
||||
(namespace.class:methodname). Use `Main' as method name to insert a breakpoint on the
|
||||
application's main method.
|
||||
.TP
|
||||
.I "--precompile name"
|
||||
Compiles the given class (namespace.name), method (namespace.name:methodname)
|
||||
or all classes in the given image (@imagename) before executing the main
|
||||
application.
|
||||
.TP
|
||||
.I "--profile"
|
||||
Collect profiling information and dump it at the end of the process.
|
||||
.SH DEBUGGING FORMATS
|
||||
The following debugging formats are currently supported:
|
||||
.TP
|
||||
.I "stabs"
|
||||
Writes out stabs debug information.
|
||||
.TP
|
||||
.I "dwarf"
|
||||
Writes out dwarf debug information.
|
||||
.TP
|
||||
.I "mono"
|
||||
Use a symbol file which has been created by MCS. It can be used to get
|
||||
source lines in stack traces.
|
||||
.PP
|
||||
The "stabs" and "dwarf" formats support the following options:
|
||||
.TP
|
||||
.I "filename=FILENAME"
|
||||
Write debugging information into FILENAME. This file must be run through
|
||||
the assembler to create an object file.
|
||||
.TP
|
||||
.I "objfile=FILENAME"
|
||||
When automatically assembling the symbol file, write the resulting object
|
||||
file into FILENAME.
|
||||
.TP
|
||||
.I "dont_assemble"
|
||||
Normally, the symbol file is automatically assembled to an object file
|
||||
when you call "mono_debug_make_symbols". Use this option to disable this
|
||||
behaviour.
|
||||
.TP
|
||||
.I "install_il_files"
|
||||
Put the generated *.il files in the same directory than the assembly they
|
||||
came from. The default is to put them into the current working directory.
|
||||
.TP
|
||||
.I "dont_update_il_files"
|
||||
Normally, the *.il files are recreated if their assemblies have changed
|
||||
when you call "mono_debug_make_symbols". Use this option to disable this
|
||||
behaviour.
|
||||
.TP
|
||||
.I "dont_create_il_files"
|
||||
Update the *.il files if their assemblies have changed, but only if the
|
||||
file already exists.
|
||||
.PP
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
.TP
|
||||
.I "MONO_PATH"
|
||||
Provides a search path to mono and mint where to look for library files.
|
||||
Directories are separated by the platform path separator (colons on unix). Example:
|
||||
.B /home/username/lib:/usr/local/mono/lib
|
||||
.PP
|
||||
.TP
|
||||
.I "MONO_DISABLE_SHM"
|
||||
If this variable is set, it disables the Windows I/O Emulation layer,
|
||||
and handles (files, events, mutexes, pipes) will not be shared across
|
||||
processes. This option is only available on Unix.
|
||||
.TP
|
||||
.I "MONO_CFG_DIR"
|
||||
If set, this variable overrides the default system configuration directory
|
||||
($PREFIX/etc). It's used to locate machine.config file.
|
||||
.TP
|
||||
.I "GC_DONT_GC"
|
||||
Turns off the garbage collection in Mono. This should be only used
|
||||
for debugging purposes
|
||||
.TP
|
||||
.I "MONO_CONFIG"
|
||||
If set, this variable overrides the default runtime configuration file
|
||||
($PREFIX/etc/mono/config). The --config command line options overrides the
|
||||
environment variable.
|
||||
.SH FILES
|
||||
On Unix assemblies are loaded from the installation lib directory. If you set
|
||||
`prefix' to /usr, the assemblies will be located in /usr/lib. On
|
||||
Windows, the assemblies are loaded from the directory where mono and
|
||||
mint live.
|
||||
.PP
|
||||
/etc/mono/config, ~/.mono/config
|
||||
.IP
|
||||
Mono runtime configuration file. See the mono-config(5) manual page
|
||||
for more information.
|
||||
.SH MAILING LISTS
|
||||
Visit http://mail.ximian.com/mailman/mono-list for details.
|
||||
.SH WEB SITE
|
||||
Visit: http://www.go-mono.com for details
|
||||
.SH SEE ALSO
|
||||
.BR mcs(1), mint(1), monodis(1), mono-config(5)
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ or Mono.Data.TdsClient provider:
|
||||
|
||||
PostgreSQL via Mono.Data.PostgreSqlClient provider:
|
||||
|
||||
host=localhost;dbname=test;user=postgres;password=fun2db
|
||||
host=localhost;dbname=test;user=postgres;pass=fun2db
|
||||
|
||||
or
|
||||
|
||||
|
||||
@@ -17,4 +17,3 @@ Class Libraries:
|
||||
Daniel Morgan <[email protected]>
|
||||
Sebastien Pouliot <[email protected]>
|
||||
Per Arneng <[email protected]>
|
||||
Ben Maurer <[email protected]>
|
||||
@@ -1,81 +1,3 @@
|
||||
2003-05-05 Ben Maurer <[email protected]>
|
||||
* AUTHORS: Added self.
|
||||
|
||||
2003-04-15 Nick Drochak <[email protected]>
|
||||
|
||||
* makefile: Remove nunit version 1 from build
|
||||
|
||||
2002-03-14 Daniel Morgan <[email protected]>
|
||||
|
||||
* class/makefile.gnu
|
||||
* class/ByteFX.Data/makefile.gnu: add ByteFX.Data.dll
|
||||
to the Linux build
|
||||
|
||||
2002-03-14 Daniel Morgan <[email protected]>
|
||||
|
||||
* makefile: added ByteFX.Data.dll to windows install
|
||||
|
||||
* class/library.build: added ByteFX.Data.dll
|
||||
to windows build. added additional clean targets
|
||||
|
||||
* class/Microsoft.VisualC/Microsoft.VisualC.build: fix
|
||||
windows clean
|
||||
|
||||
* class/ByteFX.Data: added directory for ByteFX.Data.dll
|
||||
which includes a MySQL ADO.NET Provider.
|
||||
Contributed by Reggie Burnett <[email protected]>
|
||||
from ByteFX, Inc.
|
||||
ByteFX.Data 0.6.5 is Copyright 2002-2003, ByteFX, Inc.
|
||||
|
||||
Added the following files and directories:
|
||||
|
||||
class/ByteFX.Data/AssemblyInfo.cs
|
||||
class/ByteFX.Data/list
|
||||
class/ByteFX.Data/ByteFX.Data.build
|
||||
class/ByteFX.Data/makefile.gnu
|
||||
class/ByteFX.Data/ChangeLog.txt
|
||||
class/ByteFX.Data/readme.txt
|
||||
class/ByteFX.Data/lgpl.txt: new files
|
||||
|
||||
BitStream.cs
|
||||
Connection.cs
|
||||
Field.cs
|
||||
Inflater.cs
|
||||
ConnectionString.cs
|
||||
HuffmanTree.cs
|
||||
NamedPipeStream.cs
|
||||
class/ByteFX.Data/Common: added files to new directory
|
||||
|
||||
Driver.cs
|
||||
command.resx
|
||||
todo.txt
|
||||
CommandBuilder.cs
|
||||
Exception.cs
|
||||
dataadapter.cs
|
||||
transcaction.cs
|
||||
Connection.cs
|
||||
Field.cs
|
||||
datareader.cs
|
||||
Connection.resx
|
||||
MysqlDefs.cs
|
||||
parameter.cs
|
||||
class/ByteFX.Data/mysqlclient: added files to new directory
|
||||
|
||||
command.cs
|
||||
parameter_collection.cs
|
||||
class/ByteFX.Data/mysqlclient/Designers: added files to new directory
|
||||
|
||||
2003-03-14 Daniel Morgan <[email protected]>
|
||||
|
||||
* makefile: add ilasm.exe to windows build and add missing assemblies
|
||||
to windows install
|
||||
|
||||
* class/library.build: include PEAPI.dll, Npgsql.dll, and
|
||||
ICSharpCode.SharpZipLib part of the windows build
|
||||
|
||||
2003-03-10 Martin Willemoes Hansen <[email protected]>
|
||||
* Fixed some spelling errors in class/doc/TemplateTest.cs
|
||||
|
||||
2003-03-04 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* makefile: added Mono.Posix and System.Management.
|
||||
@@ -86,7 +8,7 @@
|
||||
|
||||
2003-02-15 Nick Drochak <[email protected]>
|
||||
|
||||
* makefile.gnu: Add testcorlib target to run just the corlib unit tests.
|
||||
* makefile.gnu: Add testcorlib target to run just the corlib unit tests.
|
||||
|
||||
2003-02-10 Nick Drochak <[email protected]>
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("ByteFX.Data.dll")]
|
||||
[assembly: AssemblyDescription("ADO.Net drivers for MySQL & PostgreSQL")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("ByteFX, Inc.")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Copyright 2002, ByteFX, Inc.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("0.6.5.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<!-- NAnt build file for ByteFX.Data.dll -->
|
||||
|
||||
<project name="ByteFX.Data" default="build">
|
||||
<property name="debug" value="false"/>
|
||||
|
||||
<target name="build">
|
||||
<csc target="library" output="../lib/ByteFX.Data.dll" debug="${debug}">
|
||||
<arg value="/nowarn:1595"/>
|
||||
<arg value="/nowarn:0067"/>
|
||||
<arg value="/nowarn:0109"/>
|
||||
<arg value="/nowarn:0169"/>
|
||||
<arg value="/nowarn:0649"/>
|
||||
<arg value="/unsafe"/>
|
||||
<arg value="/noconfig"/>
|
||||
<arg value="/r:../lib/System.dll"/>
|
||||
<arg value="/r:../lib/System.Xml.dll"/>
|
||||
<arg value="/r:../lib/System.Data.dll"/>
|
||||
<arg value="/r:../lib/ICSharpCode.SharpZipLib.dll"/>
|
||||
|
||||
<sources>
|
||||
<includes name="**/*.cs"/>
|
||||
<excludes name="Test/**"/>
|
||||
|
||||
</sources>
|
||||
<references>
|
||||
<includes name="../lib/corlib.dll"/>
|
||||
<includes name="../lib/System.dll"/>
|
||||
<includes name="../lib/System.Xml.dll"/>
|
||||
<includes name="../lib/System.Data.dll"/>
|
||||
<includes name="../lib/ICSharpCode.SharpZipLib.dll"/>
|
||||
|
||||
</references>
|
||||
</csc>
|
||||
</target>
|
||||
<target name="test" depends="build">
|
||||
<nant basedir="Test" target="test"/>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete file="../lib/ByteFX.Data.dll" failonerror="false"/>
|
||||
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,11 +0,0 @@
|
||||
2003-03-15 Daniel Morgan <[email protected]>
|
||||
|
||||
* mysqlclient/datareader.cs: in GetSchemaTable(),
|
||||
"BaseColumnName" should be set to the ColumnName,
|
||||
not null
|
||||
|
||||
2003-03-14 Daniel Morgan <[email protected]>
|
||||
|
||||
Imported the ByteFX.Data MySQL 0.6.5 data provider. See
|
||||
ChangeLog at the root of mcs for this date.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
0.65
|
||||
====================
|
||||
* MySQLCommandBuilder now implemented
|
||||
* Transaction support now implemented (not all table types support this)
|
||||
* GetSchemaTable fixed to not use xsd (for Mono)
|
||||
* Driver is now Mono-compatible!!
|
||||
* TIME data type now supported
|
||||
* More work to improve Timestamp data type handling
|
||||
* Changed signatures of all classes to match corresponding SqlClient classes
|
||||
|
||||
0.60
|
||||
======================
|
||||
* Protocol compression using SharpZipLib (www.icsharpcode.net)
|
||||
* Named pipes on Windows now working properly
|
||||
* Work done to improve Timestamp data type handling
|
||||
* Implemented IEnumerable on DataReader so DataGrid would work
|
||||
|
||||
0.50
|
||||
======================
|
||||
* Speed increased dramatically by removing bugging network sync code
|
||||
* Driver no longer buffers rows of data (more ADO.Net compliant)
|
||||
* Conversion bugs related to TIMESTAMP and DATETIME fields fixed
|
||||
@@ -1,54 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ByteFX.Data.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for BitStream.
|
||||
/// </summary>
|
||||
public class BitStream : MemoryStream
|
||||
{
|
||||
private byte[] _input;
|
||||
private int _start;
|
||||
private int _end;
|
||||
private int _bitindex;
|
||||
private uint _bitbuffer;
|
||||
private int _bits_in_buffer;
|
||||
|
||||
public BitStream(byte[] input, int index, int len)
|
||||
{
|
||||
_bitindex = 0;
|
||||
_bitbuffer = 0;
|
||||
_bits_in_buffer = 0;
|
||||
_input = input;
|
||||
_start = index;
|
||||
_end = _start + len;
|
||||
}
|
||||
|
||||
public int GetBits(int numbits)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int PeekBits(int numbits)
|
||||
{
|
||||
int val=0;
|
||||
int numbytes=0;
|
||||
|
||||
int index=_start;
|
||||
while (numbits > 0)
|
||||
{
|
||||
val = (val << 8) | _input[index++];
|
||||
numbits -= 8;
|
||||
}
|
||||
|
||||
while (_bits_in_buffer < numbits)
|
||||
{
|
||||
if (_start == _end)
|
||||
throw new Exception("Out of bits");
|
||||
byte b = _input[_start++];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
|
||||
namespace ByteFX.Data.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Connection.
|
||||
/// </summary>
|
||||
[ToolboxItem(false)]
|
||||
public class Connection : Component
|
||||
{
|
||||
protected StringDictionary m_ConnSettings = new StringDictionary();
|
||||
protected string m_ConnString;
|
||||
internal ConnectionState m_State;
|
||||
|
||||
|
||||
public Connection(System.ComponentModel.IContainer container)
|
||||
{
|
||||
/// <summary>
|
||||
/// Required for Windows.Forms Class Composition Designer support
|
||||
/// </summary>
|
||||
container.Add(this);
|
||||
Init();
|
||||
}
|
||||
|
||||
public Connection()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
protected void Init()
|
||||
{
|
||||
m_State = ConnectionState.Closed;
|
||||
}
|
||||
|
||||
|
||||
[Browsable(true)]
|
||||
public string DataSource
|
||||
{
|
||||
get
|
||||
{
|
||||
String s = m_ConnSettings["data source"];
|
||||
if (s == null)
|
||||
s = m_ConnSettings["server"];
|
||||
if (s == null || s.Length == 0)
|
||||
return "localhost";
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public string User
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = m_ConnSettings["user id"];
|
||||
if (s == null)
|
||||
s = "";
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
string pwd = m_ConnSettings["password"];
|
||||
if (pwd == null)
|
||||
pwd = "";
|
||||
return pwd;
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
public int ConnectionTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
// Returns the connection time-out value set in the connection
|
||||
// string. Zero indicates an indefinite time-out period.
|
||||
if (m_ConnSettings == null)
|
||||
return 30;
|
||||
return Convert.ToInt32(m_ConnSettings["connection timeout"]);
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
public string Database
|
||||
{
|
||||
get
|
||||
{
|
||||
// Returns an initial database as set in the connection string.
|
||||
// An empty string indicates not set - do not return a null reference.
|
||||
return m_ConnSettings["database"];
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public ConnectionState State
|
||||
{
|
||||
get { return m_State; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace ByteFX.Data.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Utility.
|
||||
/// </summary>
|
||||
public class ConnectionString
|
||||
{
|
||||
public ConnectionString()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
public static StringDictionary ParseConnectString( String s )
|
||||
{
|
||||
String[] keyvalues = s.Split( ';' );
|
||||
String[] newkeyvalues = new String[keyvalues.Length];
|
||||
int x = 0;
|
||||
|
||||
// first run through the array and check for any keys that
|
||||
// have ; in their value
|
||||
foreach (String keyvalue in keyvalues)
|
||||
{
|
||||
// check for trailing ; at the end of the connection string
|
||||
if (keyvalue.Length == 0) continue;
|
||||
|
||||
// this value has an '=' sign so we are ok
|
||||
if (keyvalue.IndexOf('=') >= 0)
|
||||
{
|
||||
newkeyvalues[x++] = keyvalue;
|
||||
}
|
||||
else
|
||||
{
|
||||
newkeyvalues[x-1] += ";";
|
||||
newkeyvalues[x-1] += keyvalue;
|
||||
}
|
||||
}
|
||||
|
||||
StringDictionary dict = new StringDictionary();
|
||||
|
||||
// now we run through our normalized key-values, splitting on equals
|
||||
for (int y=0; y < x; y++)
|
||||
{
|
||||
String[] parts = newkeyvalues[y].Split( '=' );
|
||||
parts[0] = parts[0].ToLower();
|
||||
|
||||
// normalize the keys going in
|
||||
if (parts[0].Equals("pwd")) parts[0] = "password";
|
||||
if (parts[0].Equals("uid")) parts[0] = "user id";
|
||||
if (parts[0].Equals("initial catalog")) parts[0] = "database";
|
||||
|
||||
// we also want to clear off any quotes
|
||||
// first trim off any space
|
||||
parts[1] = parts[1].Trim();
|
||||
String newvalue = parts[1].Trim( '\'' );
|
||||
if (newvalue.Length == parts[1].Length)
|
||||
{
|
||||
newvalue = parts[1].Trim('"');
|
||||
}
|
||||
parts[1] = newvalue;
|
||||
|
||||
// make sure we don't get dupliate keys
|
||||
if (dict.ContainsKey(parts[0]))
|
||||
{
|
||||
throw new ArgumentException("Duplicate key in connection string", parts[0]);
|
||||
}
|
||||
|
||||
dict.Add( parts[0], parts[1] );
|
||||
}
|
||||
|
||||
// now make sure we have some reasonable defaults for keys not present
|
||||
if (! dict.ContainsKey("connection timeout"))
|
||||
{
|
||||
dict.Add("connection timeout", "15");
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlTypes;
|
||||
|
||||
namespace ByteFX.Data.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Field.
|
||||
/// </summary>
|
||||
internal class Field
|
||||
{
|
||||
protected SqlDateTime m_DateTime;
|
||||
protected SqlString m_StringValue;
|
||||
protected SqlInt64 m_IntValue;
|
||||
protected SqlDouble m_DoubleValue;
|
||||
protected SqlSingle m_SingleValue;
|
||||
protected SqlMoney m_MoneyValue;
|
||||
protected SqlDecimal m_DecimalValue;
|
||||
protected SqlBinary m_BinaryValue;
|
||||
|
||||
protected string m_TableName;
|
||||
protected string m_ColName;
|
||||
protected int m_ColLen;
|
||||
protected DbType m_DbType;
|
||||
protected bool m_HasValue;
|
||||
|
||||
public Field()
|
||||
{
|
||||
m_HasValue = false;
|
||||
}
|
||||
|
||||
public string ColumnName
|
||||
{
|
||||
get { return m_ColName; }
|
||||
}
|
||||
|
||||
public int ColumnLength
|
||||
{
|
||||
get { return m_ColLen; }
|
||||
}
|
||||
|
||||
public string TableName
|
||||
{
|
||||
get { return m_TableName; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace ByteFX.Data.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for HuffmanTree.
|
||||
/// </summary>
|
||||
public class HuffmanTree
|
||||
{
|
||||
const int MAX_BITS = 15;
|
||||
int[] codes;
|
||||
|
||||
public HuffmanTree(bool lit)
|
||||
{
|
||||
if (lit)
|
||||
BuildLitTree();
|
||||
else
|
||||
BuildLenTree();
|
||||
}
|
||||
|
||||
private void BuildLitTree()
|
||||
{
|
||||
codes = new int[288];
|
||||
|
||||
// fill the code slots with code lengths first
|
||||
for (int x=0; x < 144; x++)
|
||||
codes[x] = 8;
|
||||
for (int x=144; x < 256; x++)
|
||||
codes[x] = 9;
|
||||
for (int x=256; x < 280; x++)
|
||||
codes[x] = 7;
|
||||
for (int x=280; x < 288; x++)
|
||||
codes[x] = 8;
|
||||
|
||||
BuildTreeCommon();
|
||||
}
|
||||
|
||||
|
||||
private void BuildLenTree()
|
||||
{
|
||||
BuildTreeCommon();
|
||||
}
|
||||
|
||||
private void BuildTreeCommon()
|
||||
{
|
||||
int[] codecounts = new int[MAX_BITS];
|
||||
int[] codebase = new int[MAX_BITS];
|
||||
|
||||
for (int i = 0; i < codes.Length; i++)
|
||||
{
|
||||
int bit_len = codes[i];
|
||||
if (bit_len > 0)
|
||||
codecounts[bit_len]++;
|
||||
}
|
||||
|
||||
// now we compute the intial value for each code length
|
||||
int code = 0;
|
||||
codecounts[0] = 0;
|
||||
for (int bits = 1; bits <= MAX_BITS; bits++)
|
||||
{
|
||||
code = (code + codecounts[bits-1]) << 1;
|
||||
codebase[bits] = code;
|
||||
}
|
||||
|
||||
// next we assign numerical values to each code
|
||||
for (int x=0; x <= codes.Length; x++)
|
||||
{
|
||||
if (codes[x] == 0) continue;
|
||||
int blen = codes[x];
|
||||
codes[x] = codebase[ blen ];
|
||||
codebase[ blen ] ++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ByteFX.Data.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Inflater.
|
||||
/// </summary>
|
||||
public class Inflater
|
||||
{
|
||||
private BitStream _input;
|
||||
|
||||
public Inflater()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetInput(byte[] input, int offset, int len)
|
||||
{
|
||||
_input = new BitStream(input, offset, len);
|
||||
}
|
||||
|
||||
public void Inflate(byte[] output, int offset, int size)
|
||||
{
|
||||
byte cmf = (byte)_input.GetBits(8);
|
||||
byte flag = (byte)_input.GetBits(8);
|
||||
|
||||
if ((cmf & 0x0f) != 8)
|
||||
throw new Exception("Only deflate format data is supported");
|
||||
|
||||
if (((cmf*256+flag) % 31) != 0)
|
||||
throw new Exception("Data is not in proper deflate format");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,208 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
||||
namespace ByteFX.Data.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for API.
|
||||
/// </summary>
|
||||
public class NamedPipeStream : Stream
|
||||
{
|
||||
[DllImport("kernel32.dll", EntryPoint="CreateFile", SetLastError=true)]
|
||||
private static extern IntPtr CreateFile(String lpFileName,
|
||||
UInt32 dwDesiredAccess, UInt32 dwShareMode,
|
||||
IntPtr lpSecurityAttributes, UInt32 dwCreationDisposition,
|
||||
UInt32 dwFlagsAndAttributes,
|
||||
IntPtr hTemplateFile);
|
||||
[DllImport("kernel32.dll", EntryPoint="PeekNamedPipe", SetLastError=true)]
|
||||
private static extern bool PeekNamedPipe( IntPtr handle,
|
||||
byte[] buffer, uint nBufferSize, ref uint bytesRead,
|
||||
ref uint bytesAvail, ref uint BytesLeftThisMessage);
|
||||
[DllImport("kernel32.dll", SetLastError=true)]
|
||||
private static extern bool ReadFile( IntPtr handle,
|
||||
byte[] buffer, uint toRead, ref uint read, IntPtr lpOverLapped);
|
||||
[DllImport("kernel32.dll", SetLastError=true)]
|
||||
private static extern bool WriteFile( IntPtr handle,
|
||||
byte[] buffer, uint count, ref uint written, IntPtr lpOverlapped );
|
||||
[DllImport("kernel32.dll", SetLastError=true)]
|
||||
private static extern bool CloseHandle( IntPtr handle );
|
||||
[DllImport("kernel32.dll", SetLastError=true)]
|
||||
private static extern bool FlushFileBuffers( IntPtr handle );
|
||||
|
||||
//Constants for dwDesiredAccess:
|
||||
private const UInt32 GENERIC_READ = 0x80000000;
|
||||
private const UInt32 GENERIC_WRITE = 0x40000000;
|
||||
|
||||
//Constants for return value:
|
||||
private const Int32 INVALID_HANDLE_VALUE = -1;
|
||||
|
||||
//Constants for dwFlagsAndAttributes:
|
||||
private const UInt32 FILE_FLAG_OVERLAPPED = 0x40000000;
|
||||
private const UInt32 FILE_FLAG_NO_BUFFERING = 0x20000000;
|
||||
|
||||
//Constants for dwCreationDisposition:
|
||||
private const UInt32 OPEN_EXISTING = 3;
|
||||
|
||||
IntPtr _handle;
|
||||
FileAccess _mode;
|
||||
|
||||
public NamedPipeStream(string host, FileAccess mode)
|
||||
{
|
||||
_handle = IntPtr.Zero;
|
||||
Open(host, mode);
|
||||
}
|
||||
|
||||
public void Open( string host, FileAccess mode )
|
||||
{
|
||||
_mode = mode;
|
||||
uint pipemode = 0;
|
||||
|
||||
if ((mode & FileAccess.Read) > 0)
|
||||
pipemode |= GENERIC_READ;
|
||||
if ((mode & FileAccess.Write) > 0)
|
||||
pipemode |= GENERIC_WRITE;
|
||||
_handle = CreateFile( host, pipemode,
|
||||
0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero );
|
||||
}
|
||||
|
||||
public bool DataAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
uint bytesRead=0, avail=0, thismsg=0;
|
||||
|
||||
bool result = PeekNamedPipe( _handle,
|
||||
null, 0, ref bytesRead, ref avail, ref thismsg );
|
||||
return (result == true && avail > 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return (_mode & FileAccess.Read) > 0; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return (_mode & FileAccess.Write) > 0; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { throw new NotSupportedException("NamedPipeStream does not support seeking"); }
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { throw new NotSupportedException("NamedPipeStream does not support seeking"); }
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { throw new NotSupportedException("NamedPipeStream does not support seeking"); }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
if (_handle == IntPtr.Zero)
|
||||
throw new ObjectDisposedException("NamedPipeStream", "The stream has already been closed");
|
||||
FlushFileBuffers(_handle);
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException("buffer", "The buffer to read into cannot be null");
|
||||
if (buffer.Length < (offset + count))
|
||||
throw new ArgumentException("Buffer is not large enough to hold requested data", "buffer");
|
||||
if (offset < 0)
|
||||
throw new ArgumentOutOfRangeException("offset", offset, "Offset cannot be negative");
|
||||
if (count < 0)
|
||||
throw new ArgumentOutOfRangeException("count", count, "Count cannot be negative");
|
||||
if (! CanRead)
|
||||
throw new NotSupportedException("The stream does not support reading");
|
||||
if (_handle == IntPtr.Zero)
|
||||
throw new ObjectDisposedException("NamedPipeStream", "The stream has already been closed");
|
||||
|
||||
// first read the data into an internal buffer since ReadFile cannot read into a buf at
|
||||
// a specified offset
|
||||
uint read=0;
|
||||
byte[] buf = new Byte[count];
|
||||
ReadFile( _handle, buf, (uint)count, ref read, IntPtr.Zero );
|
||||
|
||||
for (int x=0; x < read; x++)
|
||||
{
|
||||
buffer[offset+x] = buf[x];
|
||||
}
|
||||
return (int)read;
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
CloseHandle(_handle);
|
||||
_handle = IntPtr.Zero;
|
||||
}
|
||||
|
||||
public override void SetLength(long length)
|
||||
{
|
||||
throw new NotSupportedException("NamedPipeStream doesn't support SetLength");
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException("buffer", "The buffer to write into cannot be null");
|
||||
if (buffer.Length < (offset + count))
|
||||
throw new ArgumentException("Buffer does not contain amount of requested data", "buffer");
|
||||
if (offset < 0)
|
||||
throw new ArgumentOutOfRangeException("offset", offset, "Offset cannot be negative");
|
||||
if (count < 0)
|
||||
throw new ArgumentOutOfRangeException("count", count, "Count cannot be negative");
|
||||
if (! CanWrite)
|
||||
throw new NotSupportedException("The stream does not support writing");
|
||||
if (_handle == IntPtr.Zero)
|
||||
throw new ObjectDisposedException("NamedPipeStream", "The stream has already been closed");
|
||||
|
||||
// copy data to internal buffer to allow writing from a specified offset
|
||||
byte[] buf = new Byte[count];
|
||||
for (int x=0; x < count; x++)
|
||||
{
|
||||
buf[x] = buffer[offset+x];
|
||||
}
|
||||
uint written=0;
|
||||
bool result = WriteFile( _handle, buf, (uint)count, ref written, IntPtr.Zero );
|
||||
|
||||
if (! result)
|
||||
throw new IOException("Writing to the stream failed");
|
||||
if (written < count)
|
||||
throw new IOException("Unable to write entire buffer to stream");
|
||||
}
|
||||
|
||||
public override long Seek( long offset, SeekOrigin origin )
|
||||
{
|
||||
throw new NotSupportedException("NamedPipeStream doesn't support seeking");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,504 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
./AssemblyInfo.cs
|
||||
./Common/BitStream.cs
|
||||
./Common/Connection.cs
|
||||
./Common/ConnectionString.cs
|
||||
./Common/Field.cs
|
||||
./Common/HuffmanTree.cs
|
||||
./Common/Inflater.cs
|
||||
./Common/NamedPipeStream.cs
|
||||
./mysqlclient/CommandBuilder.cs
|
||||
./mysqlclient/Connection.cs
|
||||
./mysqlclient/Driver.cs
|
||||
./mysqlclient/Exception.cs
|
||||
./mysqlclient/Field.cs
|
||||
./mysqlclient/MysqlDefs.cs
|
||||
./mysqlclient/command.cs
|
||||
./mysqlclient/dataadapter.cs
|
||||
./mysqlclient/datareader.cs
|
||||
./mysqlclient/parameter.cs
|
||||
./mysqlclient/parameter_collection.cs
|
||||
./mysqlclient/transcaction.cs
|
||||
@@ -1,14 +0,0 @@
|
||||
topdir = ../..
|
||||
|
||||
LIBRARY = $(topdir)/class/lib/ByteFX.Data.dll
|
||||
|
||||
LIB_LIST = list
|
||||
LIB_FLAGS = -r corlib -r System -r System.Xml -r System.Data -r ICSharpCode.SharpZipLib
|
||||
|
||||
SOURCES_INCLUDE=./*.cs ./Common/*.cs ./mysqlclient/*.cs
|
||||
SOURCES_EXCLUDE=\
|
||||
./Test*
|
||||
|
||||
export MONO_PATH_PREFIX = $(topdir)/class/lib:
|
||||
|
||||
include $(topdir)/class/library.make
|
||||
@@ -1,374 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for CommandBuilder.
|
||||
/// </summary>
|
||||
[ToolboxItem(false)]
|
||||
public sealed class MySQLCommandBuilder : Component
|
||||
{
|
||||
private MySQLDataAdapter _adapter;
|
||||
private string _QuotePrefix;
|
||||
private string _QuoteSuffix;
|
||||
private DataTable _schema;
|
||||
private string _tableName;
|
||||
|
||||
private MySQLCommand _updateCmd;
|
||||
private MySQLCommand _insertCmd;
|
||||
private MySQLCommand _deleteCmd;
|
||||
|
||||
#region Constructors
|
||||
public MySQLCommandBuilder()
|
||||
{
|
||||
}
|
||||
|
||||
public MySQLCommandBuilder( MySQLDataAdapter adapter )
|
||||
{
|
||||
_adapter = adapter;
|
||||
_adapter.RowUpdating += new MySQLRowUpdatingEventHandler( OnRowUpdating );
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public MySQLDataAdapter DataAdapter
|
||||
{
|
||||
get { return _adapter; }
|
||||
set
|
||||
{
|
||||
if (_adapter != null)
|
||||
{
|
||||
_adapter.RowUpdating -= new MySQLRowUpdatingEventHandler( OnRowUpdating );
|
||||
}
|
||||
_adapter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string QuotePrefix
|
||||
{
|
||||
get { return _QuotePrefix; }
|
||||
set { _QuotePrefix = value; }
|
||||
}
|
||||
|
||||
public string QuoteSuffix
|
||||
{
|
||||
get { return _QuoteSuffix; }
|
||||
set { _QuoteSuffix = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public static void DeriveParameters(MySQLCommand command)
|
||||
{
|
||||
throw new MySQLException("DeriveParameters is not supported (due to MySQL not supporting SP)");
|
||||
}
|
||||
|
||||
public MySQLCommand GetDeleteCommand()
|
||||
{
|
||||
if (_schema == null)
|
||||
GenerateSchema();
|
||||
return CreateDeleteCommand();
|
||||
}
|
||||
|
||||
public MySQLCommand GetInsertCommand()
|
||||
{
|
||||
if (_schema == null)
|
||||
GenerateSchema();
|
||||
return CreateInsertCommand();
|
||||
}
|
||||
|
||||
public MySQLCommand GetUpdateCommand()
|
||||
{
|
||||
if (_schema == null)
|
||||
GenerateSchema();
|
||||
return CreateUpdateCommand();
|
||||
}
|
||||
|
||||
public void RefreshSchema()
|
||||
{
|
||||
_schema = null;
|
||||
_insertCmd = null;
|
||||
_deleteCmd = null;
|
||||
_updateCmd = null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void GenerateSchema()
|
||||
{
|
||||
if (_adapter == null)
|
||||
throw new MySQLException("Improper MySQLCommandBuilder state: adapter is null");
|
||||
if (_adapter.SelectCommand == null)
|
||||
throw new MySQLException("Improper MySQLCommandBuilder state: adapter's SelectCommand is null");
|
||||
|
||||
MySQLDataReader dr = _adapter.SelectCommand.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo);
|
||||
_schema = dr.GetSchemaTable();
|
||||
dr.Close();
|
||||
|
||||
// make sure we got at least one unique or key field and count base table names
|
||||
bool hasKeyOrUnique=false;
|
||||
|
||||
foreach (DataRow row in _schema.Rows)
|
||||
{
|
||||
if (true == (bool)row["IsKey"] || true == (bool)row["IsUnique"])
|
||||
hasKeyOrUnique=true;
|
||||
if (_tableName == null)
|
||||
_tableName = (string)row["BaseTableName"];
|
||||
else if (_tableName != (string)row["BaseTableName"])
|
||||
throw new InvalidOperationException("MySQLCommandBuilder does not support multi-table statements");
|
||||
}
|
||||
if (! hasKeyOrUnique)
|
||||
throw new InvalidOperationException("MySQLCommandBuilder cannot operate on tables with no unique or key columns");
|
||||
}
|
||||
|
||||
private string Quote(string table_or_column)
|
||||
{
|
||||
if (_QuotePrefix == null || _QuoteSuffix == null)
|
||||
return table_or_column;
|
||||
return _QuotePrefix + table_or_column + _QuoteSuffix;
|
||||
}
|
||||
|
||||
private MySQLParameter CreateParameter(DataRow row, bool Original)
|
||||
{
|
||||
MySQLParameter p;
|
||||
if (Original)
|
||||
p = new MySQLParameter( "@Original_" + (string)row["ColumnName"], (MySQLDbType)row["ProviderType"],
|
||||
ParameterDirection.Input, (string)row["ColumnName"], DataRowVersion.Original, null );
|
||||
else
|
||||
p = new MySQLParameter( "@" + (string)row["ColumnName"], (MySQLDbType)row["ProviderType"],
|
||||
(string)row["ColumnName"]);
|
||||
return p;
|
||||
}
|
||||
|
||||
private MySQLCommand CreateBaseCommand()
|
||||
{
|
||||
MySQLCommand cmd = new MySQLCommand();
|
||||
cmd.Connection = _adapter.SelectCommand.Connection;
|
||||
cmd.CommandTimeout = _adapter.SelectCommand.CommandTimeout;
|
||||
cmd.Transaction = _adapter.SelectCommand.Transaction;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private MySQLCommand CreateDeleteCommand()
|
||||
{
|
||||
if (_deleteCmd != null) return _deleteCmd;
|
||||
|
||||
MySQLCommand cmd = CreateBaseCommand();
|
||||
|
||||
cmd.CommandText = "DELETE FROM " + Quote(_tableName) +
|
||||
" WHERE " + CreateOriginalWhere(cmd);
|
||||
|
||||
_deleteCmd = cmd;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private string CreateFinalSelect(bool forinsert)
|
||||
{
|
||||
StringBuilder sel = new StringBuilder();
|
||||
StringBuilder where = new StringBuilder();
|
||||
|
||||
foreach (DataRow row in _schema.Rows)
|
||||
{
|
||||
string colname = (string)row["ColumnName"];
|
||||
if (sel.Length > 0)
|
||||
sel.Append(", ");
|
||||
sel.Append( colname );
|
||||
if ((bool)row["IsKey"] == false) continue;
|
||||
if (where.Length > 0)
|
||||
where.Append(" AND ");
|
||||
where.Append( "(" + colname + "=" );
|
||||
if ((bool)row["IsAutoIncrement"] && forinsert)
|
||||
where.Append("last_insert_id()");
|
||||
else
|
||||
where.Append("@Original_" + colname);
|
||||
where.Append(")");
|
||||
}
|
||||
return "SELECT " + sel.ToString() + " FROM " + Quote(_tableName) +
|
||||
" WHERE " + where.ToString();
|
||||
}
|
||||
|
||||
private string CreateOriginalWhere(MySQLCommand cmd)
|
||||
{
|
||||
StringBuilder wherestr = new StringBuilder();
|
||||
|
||||
foreach (DataRow row in _schema.Rows)
|
||||
{
|
||||
if (! IncludedInWhereClause(row)) continue;
|
||||
|
||||
// first update the where clause since it will contain all parameters
|
||||
if (wherestr.Length > 0)
|
||||
wherestr.Append(" AND ");
|
||||
string colname = Quote((string)row["ColumnName"]);
|
||||
|
||||
MySQLParameter op = CreateParameter(row, true);
|
||||
cmd.Parameters.Add(op);
|
||||
|
||||
wherestr.Append( "(" + colname + "=" + op.ParameterName);
|
||||
if ((bool)row["AllowDBNull"] == true)
|
||||
wherestr.Append( " or " + colname + " is null and " + op.ParameterName + " is null");
|
||||
wherestr.Append(")");
|
||||
}
|
||||
return wherestr.ToString();
|
||||
}
|
||||
|
||||
private MySQLCommand CreateUpdateCommand()
|
||||
{
|
||||
if (_updateCmd != null) return _updateCmd;
|
||||
|
||||
MySQLCommand cmd = CreateBaseCommand();
|
||||
|
||||
StringBuilder setstr = new StringBuilder();
|
||||
|
||||
foreach (DataRow schemaRow in _schema.Rows)
|
||||
{
|
||||
string colname = Quote((string)schemaRow["ColumnName"]);
|
||||
|
||||
if (! IncludedInUpdate(schemaRow)) continue;
|
||||
|
||||
if (setstr.Length > 0)
|
||||
setstr.Append(", ");
|
||||
|
||||
MySQLParameter p = CreateParameter(schemaRow, false);
|
||||
cmd.Parameters.Add(p);
|
||||
|
||||
setstr.Append( colname + "=" + p.ParameterName );
|
||||
}
|
||||
|
||||
cmd.CommandText = "UPDATE " + Quote(_tableName) + " SET " + setstr.ToString() +
|
||||
" WHERE " + CreateOriginalWhere(cmd);
|
||||
cmd.CommandText += "; " + CreateFinalSelect(false);
|
||||
|
||||
_updateCmd = cmd;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private MySQLCommand CreateInsertCommand()
|
||||
{
|
||||
if (_insertCmd != null) return _insertCmd;
|
||||
|
||||
MySQLCommand cmd = CreateBaseCommand();
|
||||
|
||||
StringBuilder setstr = new StringBuilder();
|
||||
StringBuilder valstr = new StringBuilder();
|
||||
foreach (DataRow schemaRow in _schema.Rows)
|
||||
{
|
||||
string colname = Quote((string)schemaRow["ColumnName"]);
|
||||
|
||||
if (!IncludedInInsert(schemaRow)) continue;
|
||||
|
||||
if (setstr.Length > 0)
|
||||
{
|
||||
setstr.Append(", ");
|
||||
valstr.Append(", ");
|
||||
}
|
||||
|
||||
MySQLParameter p = CreateParameter(schemaRow, false);
|
||||
cmd.Parameters.Add(p);
|
||||
|
||||
setstr.Append( colname );
|
||||
valstr.Append( p.ParameterName );
|
||||
}
|
||||
|
||||
cmd.CommandText = "INSERT INTO " + Quote(_tableName) + " (" + setstr.ToString() + ") " +
|
||||
" VALUES (" + valstr.ToString() + ")";
|
||||
cmd.CommandText += "; " + CreateFinalSelect(true);
|
||||
|
||||
_insertCmd = cmd;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private bool IncludedInInsert (DataRow schemaRow)
|
||||
{
|
||||
// If the parameter has one of these properties, then we don't include it in the insert:
|
||||
// AutoIncrement, Hidden, Expression, RowVersion, ReadOnly
|
||||
|
||||
if ((bool) schemaRow ["IsAutoIncrement"])
|
||||
return false;
|
||||
/* if ((bool) schemaRow ["IsHidden"])
|
||||
return false;
|
||||
if ((bool) schemaRow ["IsExpression"])
|
||||
return false;*/
|
||||
if ((bool) schemaRow ["IsRowVersion"])
|
||||
return false;
|
||||
if ((bool) schemaRow ["IsReadOnly"])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IncludedInUpdate (DataRow schemaRow)
|
||||
{
|
||||
// If the parameter has one of these properties, then we don't include it in the insert:
|
||||
// AutoIncrement, Hidden, RowVersion
|
||||
|
||||
if ((bool) schemaRow ["IsAutoIncrement"])
|
||||
return false;
|
||||
// if ((bool) schemaRow ["IsHidden"])
|
||||
// return false;
|
||||
if ((bool) schemaRow ["IsRowVersion"])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IncludedInWhereClause (DataRow schemaRow)
|
||||
{
|
||||
if ((bool) schemaRow ["IsLong"])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetParameterValues(MySQLCommand cmd, DataRow dataRow)
|
||||
{
|
||||
foreach (MySQLParameter p in cmd.Parameters)
|
||||
{
|
||||
if (p.ParameterName.Length >= 9 && p.ParameterName.Substring(0, 9).Equals("@Original"))
|
||||
p.Value = dataRow[ p.SourceColumn, DataRowVersion.Original ];
|
||||
else
|
||||
p.Value = dataRow[ p.SourceColumn, DataRowVersion.Current ];
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRowUpdating(object sender, MySQLRowUpdatingEventArgs args)
|
||||
{
|
||||
// make sure we are still to proceed
|
||||
if (args.Status != UpdateStatus.Continue) return;
|
||||
|
||||
if (_schema == null)
|
||||
GenerateSchema();
|
||||
|
||||
if (StatementType.Delete == args.StatementType)
|
||||
args.Command = CreateDeleteCommand();
|
||||
else if (StatementType.Update == args.StatementType)
|
||||
args.Command = CreateUpdateCommand();
|
||||
else if (StatementType.Insert == args.StatementType)
|
||||
args.Command = CreateInsertCommand();
|
||||
else if (StatementType.Select == args.StatementType)
|
||||
return;
|
||||
|
||||
SetParameterValues(args.Command, args.Row);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,257 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for MySQLConnection.
|
||||
/// </summary>
|
||||
#if WINDOWS
|
||||
[System.Drawing.ToolboxBitmap( typeof(MySQLConnection), "Designers.connection.bmp")]
|
||||
#endif
|
||||
[ToolboxItem(true)]
|
||||
public sealed class MySQLConnection : Common.Connection, IDbConnection, ICloneable
|
||||
{
|
||||
Driver m_Driver;
|
||||
|
||||
// Always have a default constructor.
|
||||
public MySQLConnection()
|
||||
{
|
||||
ConnectionString = "data source=localhost;user id=root;pwd=;database=mysql";
|
||||
}
|
||||
|
||||
public MySQLConnection(System.ComponentModel.IContainer container)
|
||||
{
|
||||
ConnectionString = "data source=localhost;user id=root;pwd=;database=mysql";
|
||||
}
|
||||
|
||||
|
||||
// Have a constructor that takes a connection string.
|
||||
public MySQLConnection(string sConnString)
|
||||
{
|
||||
ConnectionString = sConnString;
|
||||
Init();
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
if (m_State == ConnectionState.Open)
|
||||
Close();
|
||||
}
|
||||
|
||||
internal Driver Driver
|
||||
{
|
||||
get { return m_Driver; }
|
||||
}
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Gets a string containing the version of the of the server to which the client is connected.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public string ServerVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Driver.ServerVersion;
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public bool UseCompression
|
||||
{
|
||||
get
|
||||
{
|
||||
String s = m_ConnSettings["use compression"];
|
||||
if (s == null) return false;
|
||||
return s.ToLower() == "true" || s.ToLower() == "yes";
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public int Port
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_ConnSettings["port"] == null)
|
||||
return 3306;
|
||||
else
|
||||
return Convert.ToInt32(m_ConnSettings["port"]);
|
||||
}
|
||||
}
|
||||
|
||||
#if WINDOWS
|
||||
[Editor(typeof(Designers.ConnectionStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
||||
#endif
|
||||
[Browsable(true)]
|
||||
[Category("Data")]
|
||||
public string ConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
// Always return exactly what the user set.
|
||||
// Security-sensitive information may be removed.
|
||||
return m_ConnString;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_ConnString = value;
|
||||
m_ConnSettings = Common.ConnectionString.ParseConnectString( m_ConnString );
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Transactions
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public MySQLTransaction BeginTransaction()
|
||||
{
|
||||
MySQLTransaction t = new MySQLTransaction();
|
||||
t.Connection = this;
|
||||
m_Driver.SendCommand( DBCmd.QUERY, "BEGIN");
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
IDbTransaction IDbConnection.BeginTransaction()
|
||||
{
|
||||
return BeginTransaction();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="level"></param>
|
||||
/// <returns></returns>
|
||||
public MySQLTransaction BeginTransaction(IsolationLevel level)
|
||||
{
|
||||
MySQLTransaction t = new MySQLTransaction();
|
||||
t.Connection = this;
|
||||
t.IsolationLevel = level;
|
||||
string cmd = "SET SESSION TRANSACTION ISOLATION LEVEL ";
|
||||
switch (level)
|
||||
{
|
||||
case IsolationLevel.ReadCommitted:
|
||||
cmd += "READ COMMITTED"; break;
|
||||
case IsolationLevel.ReadUncommitted:
|
||||
cmd += "READ UNCOMMITTED"; break;
|
||||
case IsolationLevel.RepeatableRead:
|
||||
cmd += "REPEATABLE READ"; break;
|
||||
case IsolationLevel.Serializable:
|
||||
cmd += "SERIALIZABLE"; break;
|
||||
case IsolationLevel.Chaos:
|
||||
throw new NotSupportedException("Chaos isolation level is not supported");
|
||||
}
|
||||
m_Driver.SendCommand( DBCmd.QUERY, cmd );
|
||||
m_Driver.SendCommand( DBCmd.QUERY, "BEGIN");
|
||||
return t;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="level"></param>
|
||||
/// <returns></returns>
|
||||
IDbTransaction IDbConnection.BeginTransaction(IsolationLevel level)
|
||||
{
|
||||
return BeginTransaction(level);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dbName"></param>
|
||||
public void ChangeDatabase(string dbName)
|
||||
{
|
||||
/*
|
||||
* Change the database setting on the back-end. Note that it is a method
|
||||
* and not a property because the operation requires an expensive
|
||||
* round trip.
|
||||
*/
|
||||
m_ConnSettings["database"] = dbName;
|
||||
|
||||
m_Driver.SendCommand( DBCmd.INIT_DB, m_ConnSettings["database"] );
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
/*
|
||||
* Open the database connection and set the ConnectionState
|
||||
* property. If the underlying connection to the server is
|
||||
* expensive to obtain, the implementation should provide
|
||||
* implicit pooling of that connection.
|
||||
*
|
||||
* If the provider also supports automatic enlistment in
|
||||
* distributed transactions, it should enlist during Open().
|
||||
*/
|
||||
m_State = ConnectionState.Connecting;
|
||||
if (m_Driver == null)
|
||||
m_Driver = new Driver(ConnectionTimeout);
|
||||
m_Driver.Open( DataSource, Port, User, Password, UseCompression );
|
||||
|
||||
//m_Driver.SendCommand( DBCmd.QUERY, "use " + m_Settings["database"] );
|
||||
m_Driver.SendCommand( DBCmd.INIT_DB, m_ConnSettings["database"] );
|
||||
m_State = ConnectionState.Open;
|
||||
}
|
||||
|
||||
|
||||
public void Close()
|
||||
{
|
||||
// this shouldn't happen, but it is!
|
||||
if (m_State == ConnectionState.Closed) return;
|
||||
|
||||
m_Driver.SendCommand( DBCmd.QUIT, null );
|
||||
m_Driver.Close();
|
||||
/*
|
||||
* Close the database connection and set the ConnectionState
|
||||
* property. If the underlying connection to the server is
|
||||
* being pooled, Close() will release it back to the pool.
|
||||
*/
|
||||
m_State = ConnectionState.Closed;
|
||||
}
|
||||
|
||||
public IDbCommand CreateCommand()
|
||||
{
|
||||
// Return a new instance of a command object.
|
||||
MySQLCommand c = new MySQLCommand();
|
||||
c.Connection = this;
|
||||
return c;
|
||||
}
|
||||
|
||||
#region ICloneable
|
||||
public object Clone()
|
||||
{
|
||||
MySQLConnection clone = new MySQLConnection();
|
||||
clone.ConnectionString = this.ConnectionString;
|
||||
//TODO: how deep should this go?
|
||||
return clone;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="ResMimeType">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="Version">
|
||||
<value>1.0.0.0</value>
|
||||
</resheader>
|
||||
<resheader name="Reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="Writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,697 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.IO;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Driver.
|
||||
/// </summary>
|
||||
internal class Driver : IDisposable
|
||||
{
|
||||
protected const int COMPRESS_HEADER_LEN = 3;
|
||||
protected const int HEADER_LEN = 4;
|
||||
protected const int MIN_COMPRESS_LEN = 50;
|
||||
|
||||
public MemoryStream _packet;
|
||||
protected Stream _stream;
|
||||
protected Socket _socket;
|
||||
protected int m_Seq;
|
||||
protected int m_BufIndex;
|
||||
protected byte m_LastResult;
|
||||
protected byte[] m_Buffer;
|
||||
protected int m_Timeout;
|
||||
protected int _port;
|
||||
|
||||
int m_Protocol;
|
||||
String m_ServerVersion;
|
||||
int m_ThreadID;
|
||||
String m_EncryptionSeed;
|
||||
int m_ServerCaps;
|
||||
bool m_UseCompression = false;
|
||||
|
||||
|
||||
public Driver(int ConnectionTimeout)
|
||||
{
|
||||
m_Seq = -1;
|
||||
m_LastResult = 0xff;
|
||||
m_Timeout = ConnectionTimeout;
|
||||
m_BufIndex = 0;
|
||||
|
||||
ResetPacket();
|
||||
}
|
||||
|
||||
~Driver()
|
||||
{
|
||||
}
|
||||
|
||||
public byte LastResult
|
||||
{
|
||||
get { return m_LastResult; }
|
||||
}
|
||||
|
||||
public string ServerVersion
|
||||
{
|
||||
get { return m_ServerVersion; }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#if WINDOWS
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="host"></param>
|
||||
void CreatePipeStream( string host )
|
||||
{
|
||||
string _pipename;
|
||||
if (host.ToLower().Equals("localhost"))
|
||||
_pipename = @"\\.\pipe\MySQL";
|
||||
else
|
||||
_pipename = String.Format(@"\\{0}\pipe\MySQL", host);
|
||||
|
||||
_stream = new ByteFX.Data.Common.NamedPipeStream(_pipename, FileAccess.ReadWrite);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="host"></param>
|
||||
/// <param name="port"></param>
|
||||
void CreateSocketStream( string host, int port )
|
||||
{
|
||||
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
IPHostEntry he = Dns.GetHostByName(host);
|
||||
IPEndPoint _serverAddr = new IPEndPoint(he.AddressList[0], port);
|
||||
|
||||
_socket.Connect(_serverAddr);
|
||||
_stream = new NetworkStream(_socket);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="host"></param>
|
||||
/// <param name="port"></param>
|
||||
/// <param name="userid"></param>
|
||||
/// <param name="password"></param>
|
||||
public void Open( String host, int port, String userid, String password, bool UseCompression )
|
||||
{
|
||||
_port = port;
|
||||
#if WINDOWS
|
||||
if (-1 == port)
|
||||
{
|
||||
CreatePipeStream(host);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (-1 != port)
|
||||
{
|
||||
CreateSocketStream(host, port);
|
||||
}
|
||||
|
||||
ReadPacket();
|
||||
|
||||
// read off the protocol version
|
||||
m_Protocol = _packet.ReadByte();
|
||||
m_ServerVersion = ReadString();
|
||||
m_ThreadID = ReadInteger(4);
|
||||
m_EncryptionSeed = ReadString();
|
||||
|
||||
// read in Server capabilities if they are provided
|
||||
m_ServerCaps = 0;
|
||||
if (_packet.CanRead)
|
||||
m_ServerCaps = ReadInteger(2);
|
||||
|
||||
Authenticate( userid, password, UseCompression );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="userid"></param>
|
||||
/// <param name="password"></param>
|
||||
private void Authenticate( String userid, String password, bool UseCompression )
|
||||
{
|
||||
ClientParam clientParam = ClientParam.CLIENT_FOUND_ROWS | ClientParam.CLIENT_LONG_FLAG;
|
||||
|
||||
if ((m_ServerCaps & (int)ClientParam.CLIENT_COMPRESS) != 0 && UseCompression)
|
||||
{
|
||||
clientParam |= ClientParam.CLIENT_COMPRESS;
|
||||
}
|
||||
|
||||
clientParam |= ClientParam.CLIENT_LONG_PASSWORD;
|
||||
|
||||
password = EncryptPassword(password, m_EncryptionSeed, m_Protocol > 9);
|
||||
// header_length = 4
|
||||
//int headerLength = (userid.Length + 16) + 6 + 4; // Passwords can be 16 chars long
|
||||
|
||||
ResetPacket();
|
||||
WriteInteger( (int)clientParam, 2 );
|
||||
WriteInteger( 0, 3 );
|
||||
WriteString( userid );
|
||||
WriteString( password );
|
||||
WritePacket();
|
||||
|
||||
CheckResult();
|
||||
|
||||
if ((clientParam & ClientParam.CLIENT_COMPRESS) != 0)
|
||||
m_UseCompression = true;
|
||||
}
|
||||
|
||||
public void ResetPacket()
|
||||
{
|
||||
_packet = new MemoryStream();
|
||||
_packet.SetLength(0);
|
||||
|
||||
// hack for Mono 0.17 not handling length < position on MemoryStream
|
||||
_packet.Position = 0;
|
||||
WriteInteger(0, HEADER_LEN);
|
||||
|
||||
if (m_UseCompression)
|
||||
_packet.Position += (COMPRESS_HEADER_LEN+HEADER_LEN);
|
||||
}
|
||||
|
||||
protected bool CanReadStream()
|
||||
{
|
||||
#if WINDOWS
|
||||
if (_port == -1)
|
||||
{
|
||||
return (_stream as ByteFX.Data.Common.NamedPipeStream).DataAvailable;
|
||||
}
|
||||
#endif
|
||||
return (_stream as NetworkStream).DataAvailable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public byte ReadStreamByte()
|
||||
{
|
||||
long start = DateTime.Now.Ticks;
|
||||
long timeout = m_Timeout * TimeSpan.TicksPerSecond;
|
||||
|
||||
while ((DateTime.Now.Ticks - start) < timeout)
|
||||
{
|
||||
if (CanReadStream()) return (byte)_stream.ReadByte();
|
||||
}
|
||||
throw new MySQLException("Timeout waiting for response from server");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="buf"></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <param name="count"></param>
|
||||
protected void ReadStreamBytes(byte[] buf, int offset, int count)
|
||||
{
|
||||
long start = DateTime.Now.Ticks;
|
||||
long timeout = m_Timeout * TimeSpan.TicksPerSecond;
|
||||
long curoffset = offset;
|
||||
|
||||
while (count > 0 && ((DateTime.Now.Ticks - start) < timeout))
|
||||
{
|
||||
if (CanReadStream())
|
||||
{
|
||||
int cnt = _stream.Read(buf, (int)curoffset, count);
|
||||
count -= cnt;
|
||||
curoffset += cnt;
|
||||
}
|
||||
}
|
||||
if (count > 0)
|
||||
throw new MySQLException("Timeout waiting for response from server");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private void ReadServerDataBlock()
|
||||
{
|
||||
int b0 = (int)ReadStreamByte();
|
||||
int b1 = (int)ReadStreamByte();
|
||||
int b2 = (int)ReadStreamByte();
|
||||
|
||||
if (b0 == -1 && b1 == -1 && b2 == -1)
|
||||
{
|
||||
//TODO: close?
|
||||
throw new IOException("Unexpected end of input stream");
|
||||
}
|
||||
|
||||
int packetLength = (int)(b0+ (256*b1) + (256*256*b2));
|
||||
int comp_len = 0;
|
||||
byte Seq = (byte)ReadStreamByte();
|
||||
|
||||
// handle the stupid field swapping does if compression is used
|
||||
// If the block is compressed, then the first length field is the compressed
|
||||
// length and the second is the uncompressed.
|
||||
// If the block is uncompressed, even if compression is selected, the first
|
||||
// length field is the uncompressed size and the second field is zero
|
||||
if (m_UseCompression)
|
||||
{
|
||||
int c0 = (int)ReadStreamByte();
|
||||
int c1 = (int)ReadStreamByte();
|
||||
int c2 = (int)ReadStreamByte();
|
||||
comp_len = (int)(c0 + (256*c1) + (256*256*c2));
|
||||
if (comp_len > 0)
|
||||
{
|
||||
int temp = packetLength;
|
||||
packetLength = comp_len;
|
||||
comp_len = temp;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_UseCompression && comp_len > 0)
|
||||
{
|
||||
m_Buffer = new Byte[packetLength];
|
||||
byte[] comp = new Byte[comp_len];
|
||||
// read in the compressed data
|
||||
ReadStreamBytes(comp, 0, comp_len);
|
||||
|
||||
Inflater i = new Inflater();
|
||||
i.SetInput( comp );
|
||||
|
||||
i.Inflate(m_Buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_UseCompression)
|
||||
{
|
||||
m_Buffer = new Byte[packetLength+4];
|
||||
ReadStreamBytes(m_Buffer, 4, packetLength);
|
||||
m_Buffer[0] = (byte)b0; m_Buffer[1] = (byte)b1; m_Buffer[2] = (byte)b2;
|
||||
m_Buffer[3] = (byte)Seq;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Buffer = new Byte[packetLength];
|
||||
ReadStreamBytes(m_Buffer, 0, packetLength);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int ReadPacket()
|
||||
{
|
||||
if (_packet == null || m_Buffer == null || m_BufIndex == m_Buffer.Length)
|
||||
{
|
||||
ReadServerDataBlock();
|
||||
m_BufIndex = 0;
|
||||
}
|
||||
|
||||
_packet = new MemoryStream(m_Buffer, m_BufIndex, m_Buffer.Length - m_BufIndex);
|
||||
int len = ReadInteger(3);
|
||||
int seq = (int)ReadByte();
|
||||
_packet.SetLength(len+HEADER_LEN);
|
||||
m_BufIndex += (int)_packet.Length;
|
||||
|
||||
// if the sequence doesn't match up, then there must be some orphaned
|
||||
// packets so we just read them off
|
||||
if (seq != (m_Seq+1)) return ReadPacket();
|
||||
|
||||
m_Seq = seq;
|
||||
return len;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected int CompressPacket()
|
||||
{
|
||||
// compress the entire packet except the length
|
||||
|
||||
// make sure we are using a packet prep'ed for compression
|
||||
// and that our packet is large enough to warrant compression
|
||||
// re: my_compress.c from mysql src
|
||||
int offset = HEADER_LEN + COMPRESS_HEADER_LEN;
|
||||
int original_len = (int)(_packet.Length - offset);
|
||||
if (original_len < MIN_COMPRESS_LEN) return 0;
|
||||
|
||||
byte[] packetData = _packet.ToArray();
|
||||
|
||||
byte[] output = new Byte[ original_len * 2 ];
|
||||
Deflater d = new Deflater();
|
||||
d.SetInput( packetData, offset, original_len );
|
||||
d.Finish();
|
||||
int comp_len = d.Deflate( output, offset, output.Length - offset );
|
||||
|
||||
if (comp_len > original_len) return 0;
|
||||
_packet = new MemoryStream( output, 0, comp_len + offset );
|
||||
return (int)comp_len;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="useCompressionIfAvail"></param>
|
||||
protected void WritePacket()
|
||||
{
|
||||
if (m_UseCompression)
|
||||
{
|
||||
// store the length of the buffer we are going to compress
|
||||
long num_bytes = _packet.Length - (HEADER_LEN*2) - COMPRESS_HEADER_LEN;
|
||||
_packet.Position = HEADER_LEN + COMPRESS_HEADER_LEN;
|
||||
WriteInteger( (int) num_bytes, 3 );
|
||||
_packet.WriteByte(0); // internal packet has 0 as seq if compressing
|
||||
|
||||
// now compress it
|
||||
int compressed_size = CompressPacket();
|
||||
|
||||
_packet.Position = 0;
|
||||
if (compressed_size == 0)
|
||||
{
|
||||
WriteInteger( (int)num_bytes + HEADER_LEN, 3);
|
||||
_packet.WriteByte((byte)++m_Seq);
|
||||
WriteInteger( compressed_size, 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteInteger( compressed_size, 3 );
|
||||
_packet.WriteByte((byte)++m_Seq);
|
||||
WriteInteger( (int)num_bytes + HEADER_LEN, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_packet.Position = 0;
|
||||
WriteInteger( (int)(_packet.Length - HEADER_LEN), 3 );
|
||||
_packet.WriteByte((byte)++m_Seq);
|
||||
}
|
||||
|
||||
_stream.Write( _packet.ToArray(), 0, (int)_packet.Length );
|
||||
_stream.Flush();
|
||||
|
||||
// reset the writeStream to empty
|
||||
ResetPacket();
|
||||
}
|
||||
|
||||
|
||||
protected void WriteString(string v)
|
||||
{
|
||||
WriteStringNoNull(v);
|
||||
_packet.WriteByte(0);
|
||||
}
|
||||
|
||||
protected void WriteStringNoNull(string v)
|
||||
{
|
||||
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(v);
|
||||
_packet.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_Seq = -1;
|
||||
_stream.Close();
|
||||
if (_socket != null)
|
||||
_socket.Close();
|
||||
}
|
||||
|
||||
public string ReadString()
|
||||
{
|
||||
String str = new String('c',0);
|
||||
|
||||
while (_packet.Position < _packet.Length)
|
||||
{
|
||||
byte b = (byte)_packet.ReadByte();
|
||||
if (b == 0) break;
|
||||
str += Convert.ToChar(b);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
protected void WriteInteger( int v, int numbytes )
|
||||
{
|
||||
int val = v;
|
||||
|
||||
if (numbytes < 1 || numbytes > 4)
|
||||
throw new Exception("Wrong byte count for WriteInteger");
|
||||
|
||||
for (int x=0; x < numbytes; x++)
|
||||
{
|
||||
_packet.WriteByte( (byte)(val&0xff) );
|
||||
val >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="numbytes"></param>
|
||||
/// <returns></returns>
|
||||
public int ReadInteger(int numbytes)
|
||||
{
|
||||
int val = 0;
|
||||
int raise = 1;
|
||||
for (int x=0; x < numbytes; x++)
|
||||
{
|
||||
int b = (int)_packet.ReadByte();
|
||||
val += (b*raise);
|
||||
raise *= 256;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int ReadLength()
|
||||
{
|
||||
byte c = (byte)_packet.ReadByte();
|
||||
switch(c)
|
||||
{
|
||||
case 251 : return (int) 0;
|
||||
case 252 : return ReadInteger(2);
|
||||
case 253 : return ReadInteger(3);
|
||||
case 254 : return ReadInteger(4);
|
||||
default : return (int) c;
|
||||
}
|
||||
}
|
||||
|
||||
public byte ReadByte()
|
||||
{
|
||||
return (byte)_packet.ReadByte();
|
||||
}
|
||||
|
||||
public int ReadNBytes()
|
||||
{
|
||||
byte c = (byte)_packet.ReadByte();
|
||||
if (c < 1 || c > 4) throw new MySQLException("Unexpected byte count received");
|
||||
return ReadInteger((int)c);
|
||||
}
|
||||
|
||||
public string ReadLenString()
|
||||
{
|
||||
int len = ReadLength();
|
||||
|
||||
byte[] buf = new Byte[len];
|
||||
_packet.Read(buf, 0, len);
|
||||
|
||||
String s = new String('c', 0);
|
||||
for (int x=0; x < buf.Length; x++)
|
||||
s += Convert.ToChar(buf[x]);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
void CheckResult()
|
||||
{
|
||||
ReadPacket();
|
||||
|
||||
m_LastResult = (byte)_packet.ReadByte();
|
||||
|
||||
if (0xff == m_LastResult)
|
||||
{
|
||||
int errno = ReadInteger(2);
|
||||
string msg = ReadString();
|
||||
throw new MySQLException(msg, errno);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsLastPacketSignal()
|
||||
{
|
||||
byte b = (byte)_packet.ReadByte();
|
||||
_packet.Position--;
|
||||
|
||||
if ((_packet.Length - HEADER_LEN) == 1 && b == 0xfe)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the byte data from the server for the next column
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public byte[] ReadColumnData()
|
||||
{
|
||||
int len;
|
||||
|
||||
byte c = (byte)_packet.ReadByte();
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 251: return null; //new byte[1] { c };
|
||||
case 252: len = ReadInteger(2); break;
|
||||
case 253: len = ReadInteger(3); break;
|
||||
case 254: len = ReadInteger(4); break;
|
||||
default: len = c; break;
|
||||
}
|
||||
|
||||
byte[] buf = new Byte[len];
|
||||
_packet.Read(buf, 0, len);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sends the specified command to the database
|
||||
/// </summary>
|
||||
/// <param name="command">Command to execute</param>
|
||||
/// <param name="text">Text attribute of command</param>
|
||||
/// <returns>Result packet returned from database server</returns>
|
||||
public void SendCommand( DBCmd command, String text )
|
||||
{
|
||||
m_Seq = -1;
|
||||
ResetPacket();
|
||||
|
||||
_packet.WriteByte( (byte)command );
|
||||
|
||||
if (text != null && text.Length > 0)
|
||||
WriteStringNoNull(text);
|
||||
|
||||
try
|
||||
{
|
||||
WritePacket();
|
||||
|
||||
if (command != DBCmd.QUIT)
|
||||
CheckResult();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void SendQuery( byte[] sql )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_Seq = -1;
|
||||
ResetPacket();
|
||||
|
||||
_packet.WriteByte( (byte)DBCmd.QUERY );
|
||||
_packet.Write( sql, 0, sql.Length );
|
||||
|
||||
WritePacket();
|
||||
CheckResult();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
#region PasswordStuff
|
||||
private static double rand(ref long seed1, ref long seed2)
|
||||
{
|
||||
seed1 = (seed1 * 3) + seed2;
|
||||
seed1 %= 0x3fffffff;
|
||||
seed2 = (seed1 + seed2 + 33) % 0x3fffffff;
|
||||
return (seed1 / (double)0x3fffffff);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="seed"></param>
|
||||
/// <returns></returns>
|
||||
public static String EncryptPassword(String password, String message, bool new_ver)
|
||||
{
|
||||
if (password == null || password.Length == 0)
|
||||
return password;
|
||||
|
||||
long[] hash_message = Hash(message);
|
||||
long[] hash_pass = Hash(password);
|
||||
|
||||
long seed1 = (hash_message[0]^hash_pass[0]) % 0x3fffffff;
|
||||
long seed2 = (hash_message[1]^hash_pass[1]) % 0x3fffffff;
|
||||
|
||||
char[] scrambled = new char[message.Length];
|
||||
for (int x=0; x < message.Length; x++)
|
||||
{
|
||||
double r = rand(ref seed1, ref seed2);
|
||||
scrambled[x] = (char)(Math.Floor(r*31) + 64);
|
||||
}
|
||||
|
||||
if (new_ver)
|
||||
{ /* Make it harder to break */
|
||||
char extra = (char)Math.Floor( rand(ref seed1, ref seed2) * 31 );
|
||||
for (int x=0; x < scrambled.Length; x++)
|
||||
scrambled[x] ^= extra;
|
||||
}
|
||||
|
||||
return new string(scrambled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="P"></param>
|
||||
/// <returns></returns>
|
||||
static long[] Hash(String P)
|
||||
{
|
||||
long val1 = 1345345333;
|
||||
long val2 = 0x12345671;
|
||||
long inc = 7;
|
||||
|
||||
for (int i=0; i < P.Length; i++)
|
||||
{
|
||||
if (P[i] == ' ' || P[i] == '\t') continue;
|
||||
long temp = (long)(0xff & P[i]);
|
||||
val1 ^= (((val1 & 63)+inc)*temp) + (val1 << 8);
|
||||
val2 += (val2 << 8) ^ val1;
|
||||
inc += temp;
|
||||
}
|
||||
|
||||
long[] hash = new long[2];
|
||||
hash[0] = val1 & 0x7fffffff;
|
||||
hash[1] = val2 & 0x7fffffff;
|
||||
return hash;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for MySQLException.
|
||||
/// </summary>
|
||||
public sealed class MySQLException : SystemException
|
||||
{
|
||||
public MySQLException(string msg)
|
||||
{
|
||||
}
|
||||
|
||||
public MySQLException()
|
||||
{
|
||||
}
|
||||
|
||||
public MySQLException(string msg, int errno) : base(msg)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,400 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlTypes;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
|
||||
|
||||
internal enum MySQLFieldType : byte
|
||||
{
|
||||
DECIMAL = 0,
|
||||
TINY = 1,
|
||||
BYTE = 1,
|
||||
SHORT = 2,
|
||||
LONG = 3,
|
||||
FLOAT = 4,
|
||||
DOUBLE = 5,
|
||||
NULL = 6,
|
||||
TIMESTAMP = 7,
|
||||
LONGLONG = 8,
|
||||
INT24 = 9,
|
||||
DATE = 10,
|
||||
TIME = 11,
|
||||
DATETIME = 12,
|
||||
YEAR = 13,
|
||||
NEWDATE = 14,
|
||||
ENUM = 247,
|
||||
SET = 248,
|
||||
TINY_BLOB = 249,
|
||||
MEDIUM_BLOB = 250,
|
||||
LONG_BLOB = 251,
|
||||
BLOB = 252,
|
||||
VAR_STRING = 253,
|
||||
STRING = 254
|
||||
};
|
||||
|
||||
internal enum ColFlags : int
|
||||
{
|
||||
NOT_NULL = 1,
|
||||
PRIMARY_KEY = 2,
|
||||
UNIQUE_KEY = 4,
|
||||
MULTIPLE_KEY = 8,
|
||||
BLOB = 16,
|
||||
UNSIGNED = 32,
|
||||
ZERO_FILL = 64,
|
||||
BINARY = 128,
|
||||
ENUM = 256,
|
||||
AUTO_INCREMENT = 512,
|
||||
TIMESTAMP = 1024,
|
||||
SET = 2048,
|
||||
NUMBER = 32768
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for Field.
|
||||
/// </summary>
|
||||
internal class MySQLField : Common.Field
|
||||
{
|
||||
MySQLFieldType m_FieldType;
|
||||
public ColFlags ColumnFlags;
|
||||
public int ColumnDecimals;
|
||||
object m_Value;
|
||||
|
||||
public MySQLField()
|
||||
{
|
||||
}
|
||||
|
||||
public void ReadSchemaInfo( Driver d )
|
||||
{
|
||||
d.ReadPacket();
|
||||
|
||||
m_TableName = d.ReadLenString();
|
||||
m_ColName = d.ReadLenString();
|
||||
m_ColLen = d.ReadNBytes();
|
||||
m_FieldType = (MySQLFieldType)d.ReadNBytes();
|
||||
d.ReadByte(); // this is apparently 2 -- not sure what it is for
|
||||
ColumnFlags = (ColFlags)d.ReadInteger(2); //(short)(d.ReadByte() & 0xff);
|
||||
ColumnDecimals = d.ReadByte();
|
||||
}
|
||||
|
||||
public object GetValue()
|
||||
{
|
||||
return m_Value;
|
||||
}
|
||||
|
||||
public int NumericPrecision()
|
||||
{
|
||||
if (m_FieldType == MySQLFieldType.DECIMAL)
|
||||
return ColumnLength;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int NumericScale()
|
||||
{
|
||||
if (m_FieldType == MySQLFieldType.DECIMAL)
|
||||
return ColumnDecimals;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public bool IsAutoIncrement()
|
||||
{
|
||||
return (ColumnFlags & ColFlags.AUTO_INCREMENT) > 0;
|
||||
}
|
||||
|
||||
public bool IsNumeric()
|
||||
{
|
||||
return (ColumnFlags & ColFlags.NUMBER) > 0;
|
||||
}
|
||||
|
||||
public bool AllowsNull()
|
||||
{
|
||||
return (ColumnFlags & ColFlags.NOT_NULL) == 0;
|
||||
}
|
||||
|
||||
public bool IsUnique()
|
||||
{
|
||||
return (ColumnFlags & ColFlags.UNIQUE_KEY) > 0;
|
||||
}
|
||||
|
||||
public bool IsPrimaryKey()
|
||||
{
|
||||
return (ColumnFlags & ColFlags.PRIMARY_KEY) > 0;
|
||||
}
|
||||
|
||||
public bool IsBlob()
|
||||
{
|
||||
return (ColumnFlags & ColFlags.BLOB) > 0;
|
||||
}
|
||||
|
||||
public bool IsBinary()
|
||||
{
|
||||
return (ColumnFlags & ColFlags.BINARY) > 0;
|
||||
}
|
||||
|
||||
public bool IsUnsigned()
|
||||
{
|
||||
return (ColumnFlags & ColFlags.UNSIGNED) > 0;
|
||||
}
|
||||
|
||||
public void SetValueData( byte[] data )
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
m_Value = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// if it is a blob and binary, then GetBytes is the way to go
|
||||
if ( IsBlob() && IsBinary() )
|
||||
{
|
||||
m_DbType = DbType.Binary;
|
||||
return;
|
||||
}
|
||||
|
||||
char[] _Chars = System.Text.Encoding.ASCII.GetChars( data );
|
||||
string sValue = new string(_Chars);
|
||||
|
||||
switch(m_FieldType)
|
||||
{
|
||||
case MySQLFieldType.BYTE:
|
||||
if (IsUnsigned())
|
||||
m_Value = Byte.Parse( sValue );
|
||||
else
|
||||
m_Value = SByte.Parse( sValue );
|
||||
break;
|
||||
|
||||
case MySQLFieldType.SHORT:
|
||||
if (IsUnsigned())
|
||||
m_Value = UInt16.Parse( sValue );
|
||||
else
|
||||
m_Value = Int16.Parse( sValue );
|
||||
break;
|
||||
|
||||
case MySQLFieldType.INT24:
|
||||
case MySQLFieldType.LONG :
|
||||
if (IsUnsigned())
|
||||
m_Value = UInt32.Parse( sValue );
|
||||
else
|
||||
m_Value = Int32.Parse( sValue );
|
||||
break;
|
||||
|
||||
case MySQLFieldType.LONGLONG:
|
||||
if (IsUnsigned())
|
||||
m_Value = UInt64.Parse( sValue );
|
||||
else
|
||||
m_Value = Int64.Parse( sValue );
|
||||
break;
|
||||
|
||||
case MySQLFieldType.FLOAT:
|
||||
m_Value = Single.Parse( sValue );
|
||||
break;
|
||||
|
||||
case MySQLFieldType.DOUBLE:
|
||||
m_Value = Double.Parse( sValue );
|
||||
break;
|
||||
|
||||
case MySQLFieldType.DECIMAL:
|
||||
m_Value = Decimal.Parse( sValue );
|
||||
break;
|
||||
|
||||
case MySQLFieldType.DATE:
|
||||
if (sValue == "0000-00-00")
|
||||
m_Value = null;
|
||||
else
|
||||
m_Value = DateTime.ParseExact( sValue, "yyyy-MM-dd", new System.Globalization.DateTimeFormatInfo());
|
||||
|
||||
break;
|
||||
|
||||
case MySQLFieldType.DATETIME:
|
||||
if (sValue == "0000-00-00 00:00:00")
|
||||
m_Value = null;
|
||||
else
|
||||
m_Value = DateTime.ParseExact( sValue, "yyyy-MM-dd HH:mm:ss", new System.Globalization.DateTimeFormatInfo());
|
||||
|
||||
break;
|
||||
|
||||
case MySQLFieldType.TIME:
|
||||
m_Value = TimeSpan.Parse(sValue);
|
||||
break;
|
||||
|
||||
case MySQLFieldType.TIMESTAMP:
|
||||
string pattern;
|
||||
switch (ColumnLength)
|
||||
{
|
||||
case 2: pattern = "yy"; break;
|
||||
case 4: pattern = "yyMM"; break;
|
||||
case 6: pattern = "yyMMdd"; break;
|
||||
case 8: pattern = "yyyyMMdd"; break;
|
||||
case 10: pattern = "yyMMddHHmm"; break;
|
||||
case 12: pattern = "yyMMddHHmmss"; break;
|
||||
case 14:
|
||||
default: pattern = "yyyyMMddHHmmss"; break;
|
||||
}
|
||||
m_Value = DateTime.ParseExact( sValue, pattern, new System.Globalization.DateTimeFormatInfo());
|
||||
break;
|
||||
|
||||
case MySQLFieldType.STRING:
|
||||
case MySQLFieldType.VAR_STRING:
|
||||
case MySQLFieldType.BLOB:
|
||||
case MySQLFieldType.TINY_BLOB:
|
||||
case MySQLFieldType.LONG_BLOB:
|
||||
case MySQLFieldType.MEDIUM_BLOB:
|
||||
m_Value = sValue;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
public string GetFieldTypeName()
|
||||
{
|
||||
switch (m_FieldType)
|
||||
{
|
||||
case MySQLFieldType.DECIMAL: return "DECIMAL";
|
||||
case MySQLFieldType.TINY: return "TINY";
|
||||
case MySQLFieldType.SHORT: return "SHORT";
|
||||
case MySQLFieldType.LONG: return "LONG";
|
||||
case MySQLFieldType.FLOAT: return "FLOAT";
|
||||
case MySQLFieldType.DOUBLE: return "DOUBLE";
|
||||
case MySQLFieldType.NULL: return "NULL";
|
||||
case MySQLFieldType.TIMESTAMP: return "TIMESTAMP";
|
||||
case MySQLFieldType.LONGLONG: return "LONGLONG";
|
||||
case MySQLFieldType.INT24: return "INT24";
|
||||
case MySQLFieldType.DATE: return "DATE";
|
||||
case MySQLFieldType.TIME: return "TIME";
|
||||
case MySQLFieldType.DATETIME: return "DATETIME";
|
||||
case MySQLFieldType.YEAR: return "YEAR";
|
||||
case MySQLFieldType.NEWDATE: return "NEWDATE";
|
||||
case MySQLFieldType.ENUM: return "ENUM";
|
||||
case MySQLFieldType.SET: return "SET";
|
||||
case MySQLFieldType.TINY_BLOB: return "TINY_BLOB";
|
||||
case MySQLFieldType.MEDIUM_BLOB: return "MEDIUM_BLOB";
|
||||
case MySQLFieldType.LONG_BLOB: return "LONG_BLOB";
|
||||
case MySQLFieldType.BLOB: return "BLOB";
|
||||
case MySQLFieldType.VAR_STRING: return "VAR_STRING";
|
||||
case MySQLFieldType.STRING: return "STRING";
|
||||
}
|
||||
return "Unknown typeid";
|
||||
}
|
||||
|
||||
|
||||
public Type GetFieldType()
|
||||
{
|
||||
switch (m_FieldType)
|
||||
{
|
||||
case MySQLFieldType.BYTE: return Type.GetType("System.Byte");
|
||||
|
||||
case MySQLFieldType.SHORT: return Type.GetType("System.Int16");
|
||||
|
||||
case MySQLFieldType.LONG:
|
||||
case MySQLFieldType.INT24: return Type.GetType("System.Int32", false, true);
|
||||
|
||||
case MySQLFieldType.FLOAT: return Type.GetType("System.Single");
|
||||
case MySQLFieldType.DOUBLE: return Type.GetType("System.Double");
|
||||
|
||||
case MySQLFieldType.TIME: return Type.GetType("System.TimeSpan");
|
||||
|
||||
case MySQLFieldType.DATE:
|
||||
case MySQLFieldType.DATETIME:
|
||||
case MySQLFieldType.TIMESTAMP: return Type.GetType("System.DateTime");
|
||||
|
||||
case MySQLFieldType.LONGLONG: return Type.GetType("System.Int64");
|
||||
|
||||
case MySQLFieldType.DECIMAL: return Type.GetType("System.Decimal");
|
||||
|
||||
case MySQLFieldType.VAR_STRING:
|
||||
case MySQLFieldType.STRING: return Type.GetType("System.String");
|
||||
|
||||
case MySQLFieldType.TINY_BLOB:
|
||||
case MySQLFieldType.MEDIUM_BLOB:
|
||||
case MySQLFieldType.LONG_BLOB:
|
||||
case MySQLFieldType.BLOB: return Type.GetType("System.Array");
|
||||
|
||||
default:
|
||||
case MySQLFieldType.NULL: return Type.GetType("System.null", false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public DbType GetDbType()
|
||||
{
|
||||
switch (m_FieldType)
|
||||
{
|
||||
case MySQLFieldType.DECIMAL: return DbType.Decimal;
|
||||
case MySQLFieldType.TINY: return DbType.Byte;
|
||||
case MySQLFieldType.SHORT:
|
||||
if (IsUnsigned())
|
||||
return DbType.UInt16;
|
||||
else
|
||||
return DbType.Int16;
|
||||
|
||||
case MySQLFieldType.LONG:
|
||||
if (IsUnsigned())
|
||||
return DbType.UInt32;
|
||||
else
|
||||
return DbType.Int32;
|
||||
|
||||
case MySQLFieldType.FLOAT: return DbType.Double;
|
||||
case MySQLFieldType.DOUBLE: return DbType.Double;
|
||||
case MySQLFieldType.NULL: return DbType.Object;
|
||||
|
||||
case MySQLFieldType.LONGLONG:
|
||||
if (IsUnsigned())
|
||||
return DbType.UInt64;
|
||||
else
|
||||
return DbType.Int64;
|
||||
|
||||
case MySQLFieldType.INT24:
|
||||
if (IsUnsigned())
|
||||
return DbType.UInt32;
|
||||
else
|
||||
return DbType.Int32;
|
||||
case MySQLFieldType.DATE:
|
||||
case MySQLFieldType.YEAR:
|
||||
case MySQLFieldType.NEWDATE:
|
||||
return DbType.Date;
|
||||
|
||||
case MySQLFieldType.TIME:
|
||||
return DbType.Time;
|
||||
case MySQLFieldType.DATETIME:
|
||||
case MySQLFieldType.TIMESTAMP:
|
||||
return DbType.DateTime;
|
||||
|
||||
case MySQLFieldType.ENUM: return DbType.UInt32;
|
||||
case MySQLFieldType.SET: return DbType.Object;
|
||||
|
||||
case MySQLFieldType.TINY_BLOB:
|
||||
case MySQLFieldType.MEDIUM_BLOB:
|
||||
case MySQLFieldType.LONG_BLOB:
|
||||
case MySQLFieldType.BLOB:
|
||||
if (IsBinary()) return DbType.Binary;
|
||||
return DbType.String;
|
||||
case MySQLFieldType.VAR_STRING:
|
||||
return DbType.String;
|
||||
case MySQLFieldType.STRING:
|
||||
return DbType.StringFixedLength;
|
||||
}
|
||||
throw new Exception("unknown MySQLFieldType");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ClientParam.
|
||||
/// </summary>
|
||||
internal enum ClientParam : short
|
||||
{
|
||||
CLIENT_LONG_PASSWORD = 1, // new more secure passwords
|
||||
CLIENT_FOUND_ROWS = 2, // found instead of affected rows
|
||||
CLIENT_LONG_FLAG = 4, // Get all column flags
|
||||
CLIENT_CONNECT_WITH_DB = 8, // One can specify db on connect
|
||||
CLIENT_NO_SCHEMA = 16, // Don't allow db.table.column
|
||||
CLIENT_COMPRESS = 32, // Client can use compression protocol
|
||||
CLIENT_ODBC = 64, // ODBC client
|
||||
CLIENT_LOCAL_FILES = 128, // Can use LOAD DATA LOCAL
|
||||
CLIENT_IGNORE_SPACE = 256, // Ignore spaces before '('
|
||||
CLIENT_CHANGE_USER = 512, // Support the mysql_change_user()
|
||||
CLIENT_INTERACTIVE = 1024, // This is an interactive client
|
||||
CLIENT_SSL = 2048, // Switch to SSL after handshake
|
||||
CLIENT_IGNORE_SIGPIPE = 4096, // IGNORE sigpipes
|
||||
CLIENT_TRANSACTIONS = 8192, // Client knows about transactions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DB Operations Code
|
||||
/// </summary>
|
||||
internal enum DBCmd : byte
|
||||
{
|
||||
SLEEP = 0,
|
||||
QUIT = 1,
|
||||
INIT_DB = 2,
|
||||
QUERY = 3,
|
||||
FIELD_LIST = 4,
|
||||
CREATE_DB = 5,
|
||||
DROP_DB = 6,
|
||||
RELOAD = 7,
|
||||
SHUTDOWN = 8,
|
||||
STATISTICS = 9,
|
||||
PROCESS_INFO = 10,
|
||||
CONNECT = 11,
|
||||
PROCESS_KILL = 12,
|
||||
DEBUG = 13,
|
||||
PING = 14,
|
||||
TIME = 15,
|
||||
DELAYED_INSERT = 16,
|
||||
CHANGE_USER = 17,
|
||||
}
|
||||
|
||||
public enum MySQLDbType
|
||||
{
|
||||
Decimal = 0,
|
||||
Tiny = 1,
|
||||
Byte = 1,
|
||||
Short = 2,
|
||||
Long = 3,
|
||||
Float = 4,
|
||||
Double = 5,
|
||||
Null = 6,
|
||||
Timestamp = 7,
|
||||
LongLong = 8,
|
||||
Int24 = 9,
|
||||
Date = 10,
|
||||
Time = 11,
|
||||
Datetime = 12,
|
||||
Year = 13,
|
||||
Newdate = 14,
|
||||
Enum = 247,
|
||||
Set = 248,
|
||||
TinyBlob = 249,
|
||||
MediumBlob = 250,
|
||||
LongBlob = 251,
|
||||
Blob = 252,
|
||||
VarChar = 253,
|
||||
String = 254
|
||||
};
|
||||
|
||||
|
||||
enum Field_Type : byte
|
||||
{
|
||||
DECIMAL =0,
|
||||
BYTE =1,
|
||||
SHORT =2,
|
||||
LONG =3,
|
||||
FLOAT =4,
|
||||
DOUBLE =5,
|
||||
NULL =6,
|
||||
TIMESTAMP =7,
|
||||
LONGLONG =8,
|
||||
INT24 =9,
|
||||
DATE =10,
|
||||
TIME =11,
|
||||
DATETIME =12,
|
||||
YEAR =13,
|
||||
NEWDATE =14,
|
||||
ENUM =247,
|
||||
SET =248,
|
||||
TINY_BLOB =249,
|
||||
MEDIUM_BLOB =250,
|
||||
LONG_BLOB =251,
|
||||
BLOB =252,
|
||||
VAR_STRING =253,
|
||||
STRING =254,
|
||||
}
|
||||
}
|
||||
@@ -1,478 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.ComponentModel;
|
||||
using System.Collections;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
#if WINDOWS
|
||||
[System.Drawing.ToolboxBitmap( typeof(MySQLCommand), "Designers.command.bmp")]
|
||||
#endif
|
||||
public sealed class MySQLCommand : Component, IDbCommand, ICloneable
|
||||
{
|
||||
MySQLConnection m_connection;
|
||||
MySQLTransaction m_txn;
|
||||
string m_sCmdText;
|
||||
int m_UpdateCount;
|
||||
UpdateRowSource m_updatedRowSource = UpdateRowSource.Both;
|
||||
MySQLParameterCollection m_parameters = new MySQLParameterCollection();
|
||||
|
||||
// Implement the default constructor here.
|
||||
public MySQLCommand()
|
||||
{
|
||||
}
|
||||
|
||||
// Implement other constructors here.
|
||||
public MySQLCommand(string cmdText)
|
||||
{
|
||||
m_sCmdText = cmdText;
|
||||
}
|
||||
|
||||
public MySQLCommand(System.ComponentModel.IContainer container)
|
||||
{
|
||||
/// <summary>
|
||||
/// Required for Windows.Forms Class Composition Designer support
|
||||
/// </summary>
|
||||
container.Add(this);
|
||||
}
|
||||
|
||||
public MySQLCommand(string cmdText, MySQLConnection connection)
|
||||
{
|
||||
m_sCmdText = cmdText;
|
||||
m_connection = connection;
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public MySQLCommand(string cmdText, MySQLConnection connection, MySQLTransaction txn)
|
||||
{
|
||||
m_sCmdText = cmdText;
|
||||
m_connection = connection;
|
||||
m_txn = txn;
|
||||
}
|
||||
|
||||
/****
|
||||
* IMPLEMENT THE REQUIRED PROPERTIES.
|
||||
****/
|
||||
public string CommandText
|
||||
{
|
||||
get { return m_sCmdText; }
|
||||
set { m_sCmdText = value; }
|
||||
}
|
||||
|
||||
public int CommandTimeout
|
||||
{
|
||||
/*
|
||||
* The sample does not support a command time-out. As a result,
|
||||
* for the get, zero is returned because zero indicates an indefinite
|
||||
* time-out period. For the set, throw an exception.
|
||||
*/
|
||||
get { return 0; }
|
||||
set { if (value != 0) throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public CommandType CommandType
|
||||
{
|
||||
/*
|
||||
* The sample only supports CommandType.Text.
|
||||
*/
|
||||
get { return CommandType.Text; }
|
||||
set { if (value != CommandType.Text) throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public IDbConnection Connection
|
||||
{
|
||||
/*
|
||||
* The user should be able to set or change the connection at
|
||||
* any time.
|
||||
*/
|
||||
get
|
||||
{
|
||||
return m_connection;
|
||||
}
|
||||
set
|
||||
{
|
||||
/*
|
||||
* The connection is associated with the transaction
|
||||
* so set the transaction object to return a null reference if the connection
|
||||
* is reset.
|
||||
*/
|
||||
if (m_connection != value)
|
||||
this.Transaction = null;
|
||||
|
||||
m_connection = (MySQLConnection)value;
|
||||
}
|
||||
}
|
||||
|
||||
public MySQLParameterCollection Parameters
|
||||
{
|
||||
get { return m_parameters; }
|
||||
}
|
||||
|
||||
IDataParameterCollection IDbCommand.Parameters
|
||||
{
|
||||
get { return m_parameters; }
|
||||
}
|
||||
|
||||
public IDbTransaction Transaction
|
||||
{
|
||||
/*
|
||||
* Set the transaction. Consider additional steps to ensure that the transaction
|
||||
* is compatible with the connection, because the two are usually linked.
|
||||
*/
|
||||
get
|
||||
{
|
||||
return m_txn;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_txn = (MySQLTransaction)value;
|
||||
}
|
||||
}
|
||||
|
||||
public UpdateRowSource UpdatedRowSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_updatedRowSource;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_updatedRowSource = value;
|
||||
}
|
||||
}
|
||||
|
||||
/****
|
||||
* IMPLEMENT THE REQUIRED METHODS.
|
||||
****/
|
||||
public void Cancel()
|
||||
{
|
||||
// The sample does not support canceling a command
|
||||
// once it has been initiated.
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IDbDataParameter CreateParameter()
|
||||
{
|
||||
return new MySQLParameter();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the SQL command into a series of ASCII bytes streaming
|
||||
/// each of the parameters into the proper place
|
||||
/// </summary>
|
||||
/// <param name="sql">Source SQL command with parameter markers</param>
|
||||
/// <returns>Byte array with all parameters included</returns>
|
||||
private ArrayList ConvertSQLToBytes(string sql)
|
||||
{
|
||||
ArrayList byteArrays = new ArrayList();
|
||||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||||
|
||||
if (sql[ sql.Length-1 ] != ';')
|
||||
sql += ';';
|
||||
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(sql);
|
||||
|
||||
byte left_byte = 0;
|
||||
int parm_start=-1, parm_end = -1;
|
||||
for (int x=0; x < bytes.Length; x++)
|
||||
{
|
||||
byte b = bytes[x];
|
||||
// if we see a quote marker, then check to see if we are opening
|
||||
// or closing a quote
|
||||
if (b == '\'' || b == '\"')
|
||||
{
|
||||
if (b == left_byte)
|
||||
{
|
||||
left_byte = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (left_byte == 0)
|
||||
left_byte = b;
|
||||
}
|
||||
ms.WriteByte(b);
|
||||
}
|
||||
|
||||
// if we find a ; not part of a quoted string, then take the parsed portion
|
||||
// as a sql command and add it to the array
|
||||
else if (b == ';' && left_byte == 0)
|
||||
{
|
||||
byte[] sqlBytes = ms.ToArray();
|
||||
byteArrays.Add( sqlBytes );
|
||||
ms = new System.IO.MemoryStream();
|
||||
}
|
||||
|
||||
// if we see the marker for a parameter, then save its position and
|
||||
// look for the end
|
||||
else if (b == '@' && left_byte == 0)
|
||||
{
|
||||
parm_start = x;
|
||||
left_byte = b;
|
||||
}
|
||||
|
||||
// if we see a space and we are tracking a parameter, then end the parameter and have
|
||||
// that parameter serialize itself to the memory streams
|
||||
else if ((b == ' ' || b == ',' || b == ';' || b == ')') && left_byte == '@')
|
||||
{
|
||||
parm_end = x-1;
|
||||
string parm_name = sql.Substring(parm_start, parm_end-parm_start+1);
|
||||
MySQLParameter p = (m_parameters[parm_name] as MySQLParameter);
|
||||
p.SerializeToBytes(ms);
|
||||
ms.WriteByte(b);
|
||||
|
||||
if (b == ';')
|
||||
{
|
||||
byte[] sqlBytes = ms.ToArray();
|
||||
byteArrays.Add( sqlBytes );
|
||||
ms = new System.IO.MemoryStream();
|
||||
}
|
||||
|
||||
left_byte = 0;
|
||||
}
|
||||
|
||||
// we want to write out the bytes in all cases except when we are parsing out a parameter
|
||||
else if (left_byte != '@')
|
||||
ms.WriteByte( b );
|
||||
}
|
||||
|
||||
// if we have any left, then add it at the end
|
||||
if (ms.Length > 0)
|
||||
{
|
||||
byte[] newbytes = ms.ToArray();
|
||||
byteArrays.Add( newbytes );
|
||||
}
|
||||
|
||||
/* string s = new string('c', 0);
|
||||
byte[] bites = (byte[])byteArrays[0];
|
||||
for (int zt=0; zt < bites.Length; zt++)
|
||||
s += Convert.ToChar(bites[zt]);
|
||||
System.Windows.Forms.MessageBox.Show(s);
|
||||
*/
|
||||
return byteArrays;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes a single non-select SQL statement. Examples of this are update,
|
||||
/// insert, etc.
|
||||
/// </summary>
|
||||
/// <returns>Number of rows affected</returns>
|
||||
public int ExecuteNonQuery()
|
||||
{
|
||||
/*
|
||||
* ExecuteNonQuery is intended for commands that do
|
||||
* not return results, instead returning only the number
|
||||
* of records affected.
|
||||
*/
|
||||
|
||||
// There must be a valid and open connection.
|
||||
if (m_connection == null || m_connection.State != ConnectionState.Open)
|
||||
throw new InvalidOperationException("Connection must valid and open");
|
||||
|
||||
ArrayList list = ConvertSQLToBytes( m_sCmdText );
|
||||
m_UpdateCount = 0;
|
||||
|
||||
// Execute the command.
|
||||
Driver d = m_connection.Driver;
|
||||
try
|
||||
{
|
||||
for (int x=0; x < list.Count; x++)
|
||||
{
|
||||
d.SendQuery( (byte[])list[x] );
|
||||
if (d.LastResult == 0)
|
||||
m_UpdateCount += d.ReadLength();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return m_UpdateCount;
|
||||
}
|
||||
|
||||
IDataReader IDbCommand.ExecuteReader ()
|
||||
{
|
||||
return ExecuteReader ();
|
||||
}
|
||||
|
||||
IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
|
||||
{
|
||||
return ExecuteReader (behavior);
|
||||
}
|
||||
|
||||
public MySQLDataReader ExecuteReader()
|
||||
{
|
||||
return ExecuteReader(CommandBehavior.Default);
|
||||
}
|
||||
|
||||
public MySQLDataReader ExecuteReader(CommandBehavior behavior)
|
||||
{
|
||||
/*
|
||||
* ExecuteReader should retrieve results from the data source
|
||||
* and return a DataReader that allows the user to process
|
||||
* the results.
|
||||
*/
|
||||
|
||||
// There must be a valid and open connection.
|
||||
if (m_connection == null || m_connection.State != ConnectionState.Open)
|
||||
throw new InvalidOperationException("Connection must valid and open");
|
||||
|
||||
if (0 != (behavior & CommandBehavior.CloseConnection))
|
||||
{
|
||||
}
|
||||
|
||||
if (0 != (behavior & CommandBehavior.Default))
|
||||
{
|
||||
}
|
||||
|
||||
if (0 != (behavior & CommandBehavior.KeyInfo))
|
||||
{
|
||||
}
|
||||
|
||||
if (0 != (behavior & CommandBehavior.SchemaOnly))
|
||||
{
|
||||
}
|
||||
|
||||
if (0 != (behavior & CommandBehavior.SequentialAccess))
|
||||
{
|
||||
}
|
||||
|
||||
if (0 != (behavior & CommandBehavior.SingleResult))
|
||||
{
|
||||
}
|
||||
|
||||
if (0 != (behavior & CommandBehavior.SingleRow))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ExecuteReader should retrieve results from the data source
|
||||
* and return a DataReader that allows the user to process
|
||||
* the results.
|
||||
*/
|
||||
ArrayList cmds = ConvertSQLToBytes( m_sCmdText );
|
||||
m_UpdateCount = 0;
|
||||
|
||||
MySQLDataReader reader = new MySQLDataReader(m_connection, behavior == CommandBehavior.SequentialAccess);
|
||||
|
||||
// Execute the command.
|
||||
Driver d = m_connection.Driver;
|
||||
try
|
||||
{
|
||||
for (int x=0; x < cmds.Count; x++)
|
||||
{
|
||||
/* string st = new string('c',0);
|
||||
for (int z=0; z < ((byte[])cmds[x]).Length; z++)
|
||||
{
|
||||
st += Convert.ToChar( ((byte[])cmds[x])[z] );
|
||||
}
|
||||
System.Windows.Forms.MessageBox.Show(st); */
|
||||
|
||||
/* System.IO.FileStream fs = new System.IO.FileStream("c:\\cmd.sql", System.IO.FileMode.OpenOrCreate);
|
||||
byte[] bites = (byte[])(cmds[0]);
|
||||
fs.Write(bites, 0, bites.Length);
|
||||
fs.Close();
|
||||
*/
|
||||
d.SendQuery( (byte[])cmds[x] );
|
||||
if (d.LastResult == 0)
|
||||
m_UpdateCount += d.ReadLength();
|
||||
else
|
||||
reader.LoadResults();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return reader;
|
||||
|
||||
//TODO implement rest of command behaviors on ExecuteReader
|
||||
/*
|
||||
* The only CommandBehavior option supported by this
|
||||
* sample is the automatic closing of the connection
|
||||
* when the user is done with the reader.
|
||||
*/
|
||||
// if (behavior == CommandBehavior.CloseConnection)
|
||||
// return new TemplateDataReader(resultset, m_connection);
|
||||
// else
|
||||
// return new TemplateDataReader(resultset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ExecuteScalar executes a single SQL command that will return
|
||||
/// a single row with a single column, or if more rows/columns are
|
||||
/// returned it will return the first column of the first row.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public object ExecuteScalar()
|
||||
{
|
||||
// There must be a valid and open connection.
|
||||
if (m_connection == null || m_connection.State != ConnectionState.Open)
|
||||
throw new InvalidOperationException("Connection must valid and open");
|
||||
|
||||
MySQLDataReader reader = new MySQLDataReader(m_connection, false);
|
||||
ArrayList cmds = ConvertSQLToBytes( m_sCmdText );
|
||||
m_UpdateCount = 0;
|
||||
|
||||
// Execute the command.
|
||||
Driver d = m_connection.Driver;
|
||||
|
||||
try
|
||||
{
|
||||
for (int x=0; x < cmds.Count; x++)
|
||||
{
|
||||
d.SendQuery( (byte[])cmds[x] );
|
||||
if (d.LastResult == 0)
|
||||
m_UpdateCount += d.ReadLength();
|
||||
else
|
||||
reader.LoadResults();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
|
||||
if (! reader.Read()) return null;
|
||||
return reader.GetValue(0);
|
||||
}
|
||||
|
||||
public void Prepare()
|
||||
{
|
||||
}
|
||||
|
||||
#region ICloneable
|
||||
public object Clone()
|
||||
{
|
||||
MySQLCommand clone = new MySQLCommand(m_sCmdText, m_connection, m_txn);
|
||||
foreach (MySQLParameter p in m_parameters)
|
||||
{
|
||||
clone.Parameters.Add(p.Clone());
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="ResMimeType">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="Version">
|
||||
<value>1.0.0.0</value>
|
||||
</resheader>
|
||||
<resheader name="Reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="Writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,186 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
#if WINDOWS
|
||||
[System.Drawing.ToolboxBitmap( typeof(MySQLDataAdapter), "Designers.dataadapter.bmp")]
|
||||
#endif
|
||||
public sealed class MySQLDataAdapter : DbDataAdapter, IDbDataAdapter
|
||||
{
|
||||
private MySQLCommand m_selectCommand;
|
||||
private MySQLCommand m_insertCommand;
|
||||
private MySQLCommand m_updateCommand;
|
||||
private MySQLCommand m_deleteCommand;
|
||||
|
||||
/*
|
||||
* Inherit from Component through DbDataAdapter. The event
|
||||
* mechanism is designed to work with the Component.Events
|
||||
* property. These variables are the keys used to find the
|
||||
* events in the components list of events.
|
||||
*/
|
||||
static private readonly object EventRowUpdated = new object();
|
||||
static private readonly object EventRowUpdating = new object();
|
||||
|
||||
|
||||
public MySQLDataAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
public MySQLDataAdapter( MySQLCommand selectCommand )
|
||||
{
|
||||
SelectCommand = selectCommand;
|
||||
}
|
||||
|
||||
public MySQLDataAdapter( string selectCommandText, string selectConnString)
|
||||
{
|
||||
SelectCommand = new MySQLCommand( selectCommandText,
|
||||
new MySQLConnection(selectConnString) );
|
||||
}
|
||||
|
||||
public MySQLDataAdapter( string selectCommandText, MySQLConnection conn)
|
||||
{
|
||||
SelectCommand = new MySQLCommand( selectCommandText, conn );
|
||||
}
|
||||
|
||||
public MySQLCommand SelectCommand
|
||||
{
|
||||
get { return m_selectCommand; }
|
||||
set { m_selectCommand = value; }
|
||||
}
|
||||
|
||||
IDbCommand IDbDataAdapter.SelectCommand
|
||||
{
|
||||
get { return m_selectCommand; }
|
||||
set { m_selectCommand = (MySQLCommand)value; }
|
||||
}
|
||||
|
||||
public MySQLCommand InsertCommand
|
||||
{
|
||||
get { return m_insertCommand; }
|
||||
set { m_insertCommand = value; }
|
||||
}
|
||||
|
||||
IDbCommand IDbDataAdapter.InsertCommand
|
||||
{
|
||||
get { return m_insertCommand; }
|
||||
set { m_insertCommand = (MySQLCommand)value; }
|
||||
}
|
||||
|
||||
public MySQLCommand UpdateCommand
|
||||
{
|
||||
get { return m_updateCommand; }
|
||||
set { m_updateCommand = value; }
|
||||
}
|
||||
|
||||
IDbCommand IDbDataAdapter.UpdateCommand
|
||||
{
|
||||
get { return m_updateCommand; }
|
||||
set { m_updateCommand = (MySQLCommand)value; }
|
||||
}
|
||||
|
||||
public MySQLCommand DeleteCommand
|
||||
{
|
||||
get { return m_deleteCommand; }
|
||||
set { m_deleteCommand = value; }
|
||||
}
|
||||
|
||||
IDbCommand IDbDataAdapter.DeleteCommand
|
||||
{
|
||||
get { return m_deleteCommand; }
|
||||
set { m_deleteCommand = (MySQLCommand)value; }
|
||||
}
|
||||
|
||||
/*
|
||||
* Implement abstract methods inherited from DbDataAdapter.
|
||||
*/
|
||||
override protected RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
|
||||
{
|
||||
return new MySQLRowUpdatedEventArgs(dataRow, command, statementType, tableMapping);
|
||||
}
|
||||
|
||||
override protected RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
|
||||
{
|
||||
return new MySQLRowUpdatingEventArgs(dataRow, command, statementType, tableMapping);
|
||||
}
|
||||
|
||||
override protected void OnRowUpdating(RowUpdatingEventArgs value)
|
||||
{
|
||||
MySQLRowUpdatingEventHandler handler = (MySQLRowUpdatingEventHandler) Events[EventRowUpdating];
|
||||
if ((null != handler) && (value is MySQLRowUpdatingEventArgs))
|
||||
{
|
||||
handler(this, (MySQLRowUpdatingEventArgs) value);
|
||||
}
|
||||
}
|
||||
|
||||
override protected void OnRowUpdated(RowUpdatedEventArgs value)
|
||||
{
|
||||
MySQLRowUpdatedEventHandler handler = (MySQLRowUpdatedEventHandler) Events[EventRowUpdated];
|
||||
if ((null != handler) && (value is MySQLRowUpdatedEventArgs))
|
||||
{
|
||||
handler(this, (MySQLRowUpdatedEventArgs) value);
|
||||
}
|
||||
}
|
||||
|
||||
public event MySQLRowUpdatingEventHandler RowUpdating
|
||||
{
|
||||
add { Events.AddHandler(EventRowUpdating, value); }
|
||||
remove { Events.RemoveHandler(EventRowUpdating, value); }
|
||||
}
|
||||
|
||||
public event MySQLRowUpdatedEventHandler RowUpdated
|
||||
{
|
||||
add { Events.AddHandler(EventRowUpdated, value); }
|
||||
remove { Events.RemoveHandler(EventRowUpdated, value); }
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void MySQLRowUpdatingEventHandler(object sender, MySQLRowUpdatingEventArgs e);
|
||||
public delegate void MySQLRowUpdatedEventHandler(object sender, MySQLRowUpdatedEventArgs e);
|
||||
|
||||
public class MySQLRowUpdatingEventArgs : RowUpdatingEventArgs
|
||||
{
|
||||
public MySQLRowUpdatingEventArgs(DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
|
||||
: base(row, command, statementType, tableMapping)
|
||||
{
|
||||
}
|
||||
|
||||
// Hide the inherited implementation of the command property.
|
||||
new public MySQLCommand Command
|
||||
{
|
||||
get { return (MySQLCommand)base.Command; }
|
||||
set { base.Command = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public class MySQLRowUpdatedEventArgs : RowUpdatedEventArgs
|
||||
{
|
||||
public MySQLRowUpdatedEventArgs(DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
|
||||
: base(row, command, statementType, tableMapping)
|
||||
{
|
||||
}
|
||||
|
||||
// Hide the inherited implementation of the command property.
|
||||
new public MySQLCommand Command
|
||||
{
|
||||
get { return (MySQLCommand)base.Command; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,464 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
public sealed class MySQLDataReader : MarshalByRefObject, IEnumerable, IDataReader, IDisposable, IDataRecord
|
||||
{
|
||||
// The DataReader should always be open when returned to the user.
|
||||
private bool m_fOpen = true;
|
||||
|
||||
// Keep track of the results and position
|
||||
// within the resultset (starts prior to first record).
|
||||
private MySQLField[] _fields;
|
||||
private ArrayList m_Rows;
|
||||
private bool m_IsSequential;
|
||||
|
||||
/*
|
||||
* Keep track of the connection in order to implement the
|
||||
* CommandBehavior.CloseConnection flag. A null reference means
|
||||
* normal behavior (do not automatically close).
|
||||
*/
|
||||
private MySQLConnection _connection = null;
|
||||
|
||||
/*
|
||||
* Because the user should not be able to directly create a
|
||||
* DataReader object, the constructors are
|
||||
* marked as internal.
|
||||
*/
|
||||
internal MySQLDataReader( MySQLConnection conn, bool Sequential)
|
||||
{
|
||||
_connection = conn;
|
||||
m_IsSequential = Sequential;
|
||||
|
||||
m_Rows = new ArrayList();
|
||||
|
||||
}
|
||||
|
||||
/****
|
||||
* METHODS / PROPERTIES FROM IDataReader.
|
||||
****/
|
||||
public int Depth
|
||||
{
|
||||
/*
|
||||
* Always return a value of zero if nesting is not supported.
|
||||
*/
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public bool IsClosed
|
||||
{
|
||||
/*
|
||||
* Keep track of the reader state - some methods should be
|
||||
* disallowed if the reader is closed.
|
||||
*/
|
||||
get { return !m_fOpen; }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public int RecordsAffected
|
||||
{
|
||||
/*
|
||||
* RecordsAffected is only applicable to batch statements
|
||||
* that include inserts/updates/deletes. The sample always
|
||||
* returns -1.
|
||||
*/
|
||||
get { return -1; }
|
||||
}
|
||||
|
||||
internal void LoadResults()
|
||||
{
|
||||
Driver d = _connection.Driver;
|
||||
|
||||
// When executing query statements, the result byte that is returned
|
||||
// from MySQL is the column count. That is why we reference the LastResult
|
||||
// property here to dimension our field array
|
||||
_fields = new MySQLField[d.LastResult];
|
||||
for (int x=0; x < _fields.Length; x++)
|
||||
{
|
||||
_fields[x] = new MySQLField();
|
||||
}
|
||||
|
||||
_connection.m_State = ConnectionState.Fetching;
|
||||
|
||||
// Load in the column defs
|
||||
for (int i=0; i < _fields.Length; i++)
|
||||
{
|
||||
_fields[i].ReadSchemaInfo( d );
|
||||
}
|
||||
|
||||
// read the end of schema packet
|
||||
d.ReadPacket();
|
||||
if (! d.IsLastPacketSignal())
|
||||
throw new MySQLException("Expected end of column data. Unknown transmission status");
|
||||
|
||||
_connection.m_State = ConnectionState.Open;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
m_fOpen = false;
|
||||
m_Rows.Clear();
|
||||
}
|
||||
|
||||
public bool NextResult()
|
||||
{
|
||||
// The sample only returns a single resultset. However,
|
||||
// DbDataAdapter expects NextResult to return a value.
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Read()
|
||||
{
|
||||
_connection.m_State = ConnectionState.Fetching;
|
||||
Driver d = _connection.Driver;
|
||||
|
||||
try
|
||||
{
|
||||
d.ReadPacket();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.Error.WriteLine("MySQL.Net error: " + e.Message);
|
||||
_connection.m_State = ConnectionState.Open;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (d.IsLastPacketSignal())
|
||||
{
|
||||
_connection.m_State = ConnectionState.Open;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int col=0; col < _fields.Length; col++)
|
||||
{
|
||||
byte [] data = d.ReadColumnData();
|
||||
_fields[col].SetValueData( data );
|
||||
}
|
||||
|
||||
_connection.m_State = ConnectionState.Open;
|
||||
return true;
|
||||
}
|
||||
|
||||
public DataTable GetSchemaTable()
|
||||
{
|
||||
// Only Results from SQL SELECT Queries
|
||||
// get a DataTable for schema of the result
|
||||
// otherwise, DataTable is null reference
|
||||
if (_fields.Length == 0) return null;
|
||||
|
||||
DataTable dataTableSchema = new DataTable ("SchemaTable");
|
||||
|
||||
dataTableSchema.Columns.Add ("ColumnName", typeof (string));
|
||||
dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
|
||||
dataTableSchema.Columns.Add ("ColumnSize", typeof (int));
|
||||
dataTableSchema.Columns.Add ("NumericPrecision", typeof (int));
|
||||
dataTableSchema.Columns.Add ("NumericScale", typeof (int));
|
||||
dataTableSchema.Columns.Add ("IsUnique", typeof (bool));
|
||||
dataTableSchema.Columns.Add ("IsKey", typeof (bool));
|
||||
DataColumn dc = dataTableSchema.Columns["IsKey"];
|
||||
dc.AllowDBNull = true; // IsKey can have a DBNull
|
||||
dataTableSchema.Columns.Add ("BaseCatalogName", typeof (string));
|
||||
dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
|
||||
dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
|
||||
dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
|
||||
dataTableSchema.Columns.Add ("DataType", typeof(Type));
|
||||
dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
|
||||
dataTableSchema.Columns.Add ("ProviderType", typeof (int));
|
||||
dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
|
||||
dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
|
||||
dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
|
||||
dataTableSchema.Columns.Add ("IsAutoIncrement", typeof (bool));
|
||||
dataTableSchema.Columns.Add ("IsRowVersion", typeof (bool));
|
||||
dataTableSchema.Columns.Add ("IsHidden", typeof (bool));
|
||||
dataTableSchema.Columns.Add ("IsLong", typeof (bool));
|
||||
dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
|
||||
|
||||
int ord = 1;
|
||||
foreach (MySQLField f in _fields)
|
||||
{
|
||||
DataRow r = dataTableSchema.NewRow();
|
||||
r["ColumnName"] = f.ColumnName;
|
||||
r["ColumnOrdinal"] = ord++;
|
||||
r["ColumnSize"] = f.ColumnLength;
|
||||
int prec = f.NumericPrecision();
|
||||
int pscale = f.NumericScale();
|
||||
if (prec != -1)
|
||||
r["NumericPrecision"] = (short)prec;
|
||||
if (pscale != -1)
|
||||
r["NumericScale"] = (short)pscale;
|
||||
r["DataType"] = f.GetFieldType();
|
||||
r["ProviderType"] = (int)f.GetDbType();
|
||||
r["IsLong"] = f.IsBlob() && f.ColumnLength > 255;
|
||||
r["AllowDBNull"] = f.AllowsNull();
|
||||
r["IsReadOnly"] = false;
|
||||
r["IsRowVersion"] = false;
|
||||
r["IsUnique"] = f.IsUnique();
|
||||
r["IsKey"] = f.IsPrimaryKey();
|
||||
r["IsAutoIncrement"] = f.IsAutoIncrement();
|
||||
r["BaseSchemaName"] = null;
|
||||
r["BaseCatalogName"] = null;
|
||||
r["BaseTableName"] = f.TableName;
|
||||
r["BaseColumnName"] = f.ColumnName;
|
||||
|
||||
dataTableSchema.Rows.Add( r );
|
||||
}
|
||||
|
||||
return dataTableSchema;
|
||||
}
|
||||
|
||||
/****
|
||||
* METHODS / PROPERTIES FROM IDataRecord.
|
||||
****/
|
||||
public int FieldCount
|
||||
{
|
||||
// Return the count of the number of columns, which in
|
||||
// this case is the size of the column metadata
|
||||
// array.
|
||||
get
|
||||
{
|
||||
return _fields.Length;
|
||||
}
|
||||
}
|
||||
|
||||
public String GetName(int i)
|
||||
{
|
||||
return _fields[i].ColumnName;
|
||||
}
|
||||
|
||||
public String GetDataTypeName(int i)
|
||||
{
|
||||
if (!m_fOpen) throw new Exception("No current query in data reader");
|
||||
if (i >= _fields.Length) throw new IndexOutOfRangeException();
|
||||
|
||||
// return the name of the type used on the backend
|
||||
return _fields[i].GetFieldTypeName();
|
||||
}
|
||||
|
||||
public Type GetFieldType(int i)
|
||||
{
|
||||
if (!m_fOpen) throw new Exception("No current query in data reader");
|
||||
if (i >= _fields.Length) throw new IndexOutOfRangeException();
|
||||
|
||||
return _fields[i].GetFieldType();
|
||||
}
|
||||
|
||||
public Object GetValue(int i)
|
||||
{
|
||||
if (!m_fOpen) throw new Exception("No current query in data reader");
|
||||
if (i >= _fields.Length) throw new IndexOutOfRangeException();
|
||||
|
||||
return _fields[i].GetValue();
|
||||
}
|
||||
|
||||
public int GetValues(object[] values)
|
||||
{
|
||||
for (int i=0; i < _fields.Length; i ++)
|
||||
{
|
||||
values[i] = GetValue(i);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetOrdinal(string name)
|
||||
{
|
||||
if (! m_fOpen)
|
||||
throw new Exception("No current query in data reader");
|
||||
|
||||
for (int i=0; i < _fields.Length; i ++)
|
||||
{
|
||||
if (_fields[i].ColumnName.ToLower().Equals(name.ToLower()))
|
||||
return i;
|
||||
}
|
||||
|
||||
// Throw an exception if the ordinal cannot be found.
|
||||
throw new IndexOutOfRangeException("Could not find specified column in results");
|
||||
}
|
||||
|
||||
public object this [ int i ]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetValue(i);
|
||||
}
|
||||
}
|
||||
|
||||
public object this [ String name ]
|
||||
{
|
||||
// Look up the ordinal and return
|
||||
// the value at that position.
|
||||
get { return this[GetOrdinal(name)]; }
|
||||
}
|
||||
|
||||
public bool GetBoolean(int i)
|
||||
{
|
||||
return (bool)GetValue(i);
|
||||
}
|
||||
|
||||
public byte GetByte(int i)
|
||||
{
|
||||
return (byte)GetValue(i);
|
||||
}
|
||||
|
||||
public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
|
||||
{
|
||||
if (i >= _fields.Length)
|
||||
throw new IndexOutOfRangeException();
|
||||
|
||||
byte[] bytes = (m_Rows[0] as ArrayList)[i] as byte[];
|
||||
|
||||
if (buffer == null)
|
||||
return bytes.Length;
|
||||
|
||||
/// adjust the length so we don't run off the end
|
||||
if (bytes.Length < (fieldOffset+length))
|
||||
{
|
||||
length = (int)(bytes.Length - fieldOffset);
|
||||
}
|
||||
|
||||
for (int x=0; x < length; x++)
|
||||
{
|
||||
buffer[bufferoffset+x] = bytes[fieldOffset+x];
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
public char GetChar(int i)
|
||||
{
|
||||
return (char)GetValue(i);
|
||||
}
|
||||
|
||||
public long GetChars(int i, long fieldOffset, char[] buffer, int bufferoffset, int length)
|
||||
{
|
||||
if (i >= _fields.Length)
|
||||
throw new IndexOutOfRangeException();
|
||||
|
||||
// retrieve the bytes of the column
|
||||
long bytesize = GetBytes(i, 0, null, 0, 0);
|
||||
byte[] bytes = new byte[bytesize];
|
||||
GetBytes(i, 0, bytes, 0, (int)bytesize);
|
||||
|
||||
char[] chars = System.Text.Encoding.UTF8.GetChars(bytes, 0, (int)bytesize);
|
||||
|
||||
if (buffer == null)
|
||||
return chars.Length;
|
||||
|
||||
/// adjust the length so we don't run off the end
|
||||
if (chars.Length < (fieldOffset+length))
|
||||
{
|
||||
length = (int)(chars.Length - fieldOffset);
|
||||
}
|
||||
|
||||
for (int x=0; x < length; x++)
|
||||
{
|
||||
buffer[bufferoffset+x] = chars[fieldOffset+x];
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
public Guid GetGuid(int i)
|
||||
{
|
||||
/*
|
||||
* Force the cast to return the type. InvalidCastException
|
||||
* should be thrown if the data is not already of the correct type.
|
||||
*/
|
||||
// The sample does not support this method.
|
||||
throw new NotSupportedException("GetGUID not supported.");
|
||||
}
|
||||
|
||||
public Int16 GetInt16(int i)
|
||||
{
|
||||
return (Int16)GetValue(i);
|
||||
}
|
||||
|
||||
public Int32 GetInt32(int i)
|
||||
{
|
||||
return (Int32)GetValue(i);
|
||||
}
|
||||
|
||||
public Int64 GetInt64(int i)
|
||||
{
|
||||
return (Int64)GetValue(i);
|
||||
}
|
||||
|
||||
public float GetFloat(int i)
|
||||
{
|
||||
return (float)GetValue(i);
|
||||
}
|
||||
|
||||
public double GetDouble(int i)
|
||||
{
|
||||
return (double)GetValue(i);
|
||||
}
|
||||
|
||||
public String GetString(int i)
|
||||
{
|
||||
return (string)GetValue(i);
|
||||
}
|
||||
|
||||
public Decimal GetDecimal(int i)
|
||||
{
|
||||
return (Decimal)GetValue(i);
|
||||
}
|
||||
|
||||
public DateTime GetDateTime(int i)
|
||||
{
|
||||
return (DateTime)GetValue(i);
|
||||
}
|
||||
|
||||
public IDataReader GetData(int i)
|
||||
{
|
||||
/*
|
||||
* The sample code does not support this method. Normally,
|
||||
* this would be used to expose nested tables and
|
||||
* other hierarchical data.
|
||||
*/
|
||||
throw new NotSupportedException("GetData not supported.");
|
||||
}
|
||||
|
||||
public bool IsDBNull(int i)
|
||||
{
|
||||
return DBNull.Value == GetValue(i);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation specific methods.
|
||||
*/
|
||||
private int _cultureAwareCompare(string strA, string strB)
|
||||
{
|
||||
// return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#region IEnumerator
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return new System.Data.Common.DbEnumerator(this);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,287 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
public sealed class MySQLParameter : MarshalByRefObject, IDataParameter, IDbDataParameter, ICloneable
|
||||
{
|
||||
MySQLDbType m_dbType = MySQLDbType.Null;
|
||||
DbType m_genericType;
|
||||
ParameterDirection m_direction = ParameterDirection.Input;
|
||||
bool m_fNullable = false;
|
||||
string m_sParamName;
|
||||
string m_sSourceColumn;
|
||||
DataRowVersion m_sourceVersion = DataRowVersion.Current;
|
||||
object m_value;
|
||||
|
||||
public MySQLParameter()
|
||||
{
|
||||
}
|
||||
|
||||
public MySQLParameter(string name, MySQLDbType type, ParameterDirection dir, string col, DataRowVersion ver, object val)
|
||||
{
|
||||
m_dbType = type;
|
||||
m_direction = dir;
|
||||
m_sParamName = name;
|
||||
m_sSourceColumn = col;
|
||||
m_sourceVersion = ver;
|
||||
m_value = val;
|
||||
}
|
||||
|
||||
public MySQLParameter(string parameterName, MySQLDbType type)
|
||||
{
|
||||
m_sParamName = parameterName;
|
||||
m_dbType = type;
|
||||
}
|
||||
|
||||
public MySQLParameter(string parameterName, object value)
|
||||
{
|
||||
m_sParamName = parameterName;
|
||||
this.Value = value;
|
||||
// Setting the value also infers the type.
|
||||
}
|
||||
|
||||
public MySQLParameter( string parameterName, MySQLDbType dbType, string sourceColumn )
|
||||
{
|
||||
m_sParamName = parameterName;
|
||||
m_dbType = dbType;
|
||||
m_sSourceColumn = sourceColumn;
|
||||
}
|
||||
|
||||
DbType IDataParameter.DbType
|
||||
{
|
||||
get { return m_genericType; }
|
||||
set { m_genericType = value; }
|
||||
}
|
||||
|
||||
public MySQLDbType DbType
|
||||
{
|
||||
get { return m_dbType; }
|
||||
set { m_dbType = value; }
|
||||
}
|
||||
|
||||
public ParameterDirection Direction
|
||||
{
|
||||
get { return m_direction; }
|
||||
set { m_direction = value; }
|
||||
}
|
||||
|
||||
public Boolean IsNullable
|
||||
{
|
||||
get { return m_fNullable; }
|
||||
}
|
||||
|
||||
public String ParameterName
|
||||
{
|
||||
get { return m_sParamName; }
|
||||
set { m_sParamName = value; }
|
||||
}
|
||||
|
||||
public String SourceColumn
|
||||
{
|
||||
get { return m_sSourceColumn; }
|
||||
set { m_sSourceColumn = value; }
|
||||
}
|
||||
|
||||
public DataRowVersion SourceVersion
|
||||
{
|
||||
get { return m_sourceVersion; }
|
||||
set { m_sourceVersion = value; }
|
||||
}
|
||||
|
||||
public object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_value = value;
|
||||
m_dbType = _inferType(value);
|
||||
}
|
||||
}
|
||||
|
||||
private string ObjectToString()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
private void EscapeByteArray( byte[] bytes, System.IO.MemoryStream s )
|
||||
{
|
||||
byte[] newbytes = new byte[ bytes.Length * 2 ];
|
||||
|
||||
int newx=0;
|
||||
for (int x=0; x < bytes.Length; x++)
|
||||
{
|
||||
byte b = bytes[x];
|
||||
if (b == '\0')
|
||||
{
|
||||
newbytes[newx++] = (byte)'\\';
|
||||
newbytes[newx++] = (byte)'0';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b == '\\' || b == '\'' || b == '"')
|
||||
newbytes[newx++] = (byte)'\\';
|
||||
newbytes[newx++] = b;
|
||||
}
|
||||
}
|
||||
s.Write( newbytes, 0, newx );
|
||||
}
|
||||
|
||||
private string EscapeString( string s )
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (char c in s)
|
||||
{
|
||||
if (c == '\'')
|
||||
sb.Append(c);
|
||||
sb.Append(c);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public void SerializeToBytes( System.IO.MemoryStream s )
|
||||
{
|
||||
string parm_string;
|
||||
|
||||
switch (m_dbType)
|
||||
{
|
||||
case MySQLDbType.Null:
|
||||
parm_string = "Null";
|
||||
break;
|
||||
|
||||
case MySQLDbType.VarChar:
|
||||
parm_string = "'" + EscapeString(Value.ToString()) + "'";
|
||||
break;
|
||||
|
||||
case MySQLDbType.Date:
|
||||
{
|
||||
parm_string = "'" + ((DateTime)Value).ToString("yyyy-MM-dd") + "'";
|
||||
break;
|
||||
}
|
||||
|
||||
case MySQLDbType.Datetime:
|
||||
{
|
||||
parm_string = "'" + ((DateTime)Value).ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
||||
break;
|
||||
}
|
||||
|
||||
case MySQLDbType.Blob:
|
||||
if (m_value.GetType() == Type.GetType("System.Byte[]"))
|
||||
{
|
||||
s.WriteByte((byte)'\'');
|
||||
EscapeByteArray( (byte[])m_value, s );
|
||||
s.WriteByte((byte)'\'');
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
parm_string = Value.ToString();
|
||||
break;
|
||||
}
|
||||
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(parm_string);
|
||||
s.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
private MySQLDbType _inferType(Object value)
|
||||
{
|
||||
switch (Type.GetTypeCode(value.GetType()))
|
||||
{
|
||||
case TypeCode.Empty:
|
||||
throw new SystemException("Invalid data type");
|
||||
|
||||
case TypeCode.Object:
|
||||
return MySQLDbType.Blob;
|
||||
|
||||
case TypeCode.DBNull:
|
||||
return MySQLDbType.Null;
|
||||
|
||||
case TypeCode.Char:
|
||||
case TypeCode.SByte:
|
||||
case TypeCode.Boolean:
|
||||
case TypeCode.Byte:
|
||||
return MySQLDbType.Byte;
|
||||
|
||||
case TypeCode.Int16:
|
||||
case TypeCode.UInt16:
|
||||
return MySQLDbType.Int24;
|
||||
|
||||
case TypeCode.Int32:
|
||||
case TypeCode.UInt32:
|
||||
return MySQLDbType.Long;
|
||||
|
||||
case TypeCode.Int64:
|
||||
case TypeCode.UInt64:
|
||||
return MySQLDbType.LongLong;
|
||||
|
||||
case TypeCode.Single:
|
||||
return MySQLDbType.Float;
|
||||
|
||||
case TypeCode.Double:
|
||||
return MySQLDbType.Double;
|
||||
|
||||
case TypeCode.Decimal:
|
||||
return MySQLDbType.Decimal;
|
||||
|
||||
case TypeCode.DateTime:
|
||||
return MySQLDbType.Datetime;
|
||||
|
||||
case TypeCode.String:
|
||||
return MySQLDbType.VarChar;
|
||||
|
||||
default:
|
||||
throw new SystemException("Value is of unknown data type");
|
||||
}
|
||||
}
|
||||
|
||||
// implement methods of IDbDataParameter
|
||||
public byte Precision
|
||||
{
|
||||
get { return 0; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public byte Scale
|
||||
{
|
||||
get { return 0; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public int Size
|
||||
{
|
||||
get { return 0; }
|
||||
set { }
|
||||
}
|
||||
|
||||
#region ICloneable
|
||||
public object Clone()
|
||||
{
|
||||
MySQLParameter clone = new MySQLParameter( m_sParamName, m_dbType, m_direction,
|
||||
m_sSourceColumn, m_sourceVersion, m_value );
|
||||
return clone;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
public sealed class MySQLParameterCollection : MarshalByRefObject, IDataParameterCollection,
|
||||
IList, ICollection, IEnumerable
|
||||
{
|
||||
private ArrayList _parms = new ArrayList();
|
||||
|
||||
#region ICollection support
|
||||
public int Count
|
||||
{
|
||||
get { return _parms.Count; }
|
||||
}
|
||||
|
||||
public void CopyTo( Array array, int index )
|
||||
{
|
||||
/* if (null == array) throw new ArgumentNullException("array", "Array must not be null");
|
||||
if (index < 0) throw new ArgumentOutOfRangeException("index", index, "Index must be greater than or equal to zero");
|
||||
if (array.Rank > 1) throw new ArgumentException("Array must not be multidimensional", "Array");
|
||||
if (index >= array.Length) throw new ArgumentException("Index must start within the bounds of the array", "Index");
|
||||
if ((index + Count) > array.Length) throw new ArgumentException("Not enough room to copy parameters", "Array");
|
||||
*/
|
||||
_parms.CopyTo(array, index);
|
||||
}
|
||||
|
||||
public bool IsSynchronized
|
||||
{
|
||||
get { return _parms.IsSynchronized; }
|
||||
}
|
||||
|
||||
public object SyncRoot
|
||||
{
|
||||
get { return _parms.SyncRoot; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IList
|
||||
public void Clear()
|
||||
{
|
||||
_parms.Clear();
|
||||
}
|
||||
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return _parms.Contains(value);
|
||||
}
|
||||
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return _parms.IndexOf(value);
|
||||
}
|
||||
|
||||
public void Insert(int index, object value)
|
||||
{
|
||||
_parms.Insert( index, value );
|
||||
}
|
||||
|
||||
public bool IsFixedSize
|
||||
{
|
||||
get { return _parms.IsFixedSize; }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return _parms.IsReadOnly; }
|
||||
}
|
||||
|
||||
public void Remove( object value )
|
||||
{
|
||||
_parms.Remove( value );
|
||||
}
|
||||
|
||||
public void RemoveAt( int index )
|
||||
{
|
||||
_parms.RemoveAt( index );
|
||||
}
|
||||
|
||||
object IList.this[int index]
|
||||
{
|
||||
get { return this[index]; }
|
||||
set
|
||||
{
|
||||
if (! (value is MySQLParameter)) throw new MySQLException("Only MySQLParameter objects may be stored");
|
||||
this[index] = (MySQLParameter)value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Add( object value )
|
||||
{
|
||||
if (! (value is MySQLParameter)) throw new MySQLException("Only MySQLParameter objects may be stored");
|
||||
|
||||
|
||||
if ( ((MySQLParameter)value).ParameterName == null )
|
||||
throw new ArgumentException("parameter must be named");
|
||||
|
||||
return _parms.Add(value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDataParameterCollection
|
||||
public bool Contains(string name)
|
||||
{
|
||||
foreach (MySQLParameter p in _parms)
|
||||
{
|
||||
if (p.ParameterName.ToLower().Equals( name.ToLower() )) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int IndexOf( string name )
|
||||
{
|
||||
for (int x=0; x < _parms.Count; x++)
|
||||
{
|
||||
MySQLParameter p = (MySQLParameter)_parms[x];
|
||||
if (p.ParameterName.ToLower().Equals( name.ToLower() )) return x;
|
||||
}
|
||||
throw new MySQLException("Parameter '" + name + "' not found in collection");
|
||||
}
|
||||
|
||||
public void RemoveAt( string name )
|
||||
{
|
||||
int index = IndexOf( name );
|
||||
_parms.RemoveAt(index);
|
||||
}
|
||||
|
||||
object IDataParameterCollection.this[string name]
|
||||
{
|
||||
get { return this[name]; }
|
||||
set
|
||||
{
|
||||
if (! (value is MySQLParameter)) throw new MySQLException("Only MySQLParameter objects may be stored");
|
||||
this[name] = (MySQLParameter)value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IEnumerable
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return ((IEnumerable)_parms).GetEnumerator();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public MySQLParameter this[int index]
|
||||
{
|
||||
get { return (MySQLParameter)_parms[index]; }
|
||||
set
|
||||
{
|
||||
_parms[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public MySQLParameter this[string name]
|
||||
{
|
||||
get { return (MySQLParameter)_parms[ IndexOf( name ) ]; }
|
||||
set
|
||||
{
|
||||
_parms[ IndexOf( name ) ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public MySQLParameter Add(MySQLParameter value)
|
||||
{
|
||||
if ( value.ParameterName == null ) throw new ArgumentException("parameter must be named");
|
||||
|
||||
_parms.Add(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public MySQLParameter Add(string parameterName, DbType type)
|
||||
{
|
||||
return Add(new MySQLParameter(parameterName, type));
|
||||
}
|
||||
|
||||
public MySQLParameter Add(string parameterName, object value)
|
||||
{
|
||||
return Add(new MySQLParameter(parameterName, value));
|
||||
}
|
||||
|
||||
public MySQLParameter Add(string parameterName, MySQLDbType dbType, string sourceColumn)
|
||||
{
|
||||
return Add(new MySQLParameter(parameterName, dbType, sourceColumn));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
0.65
|
||||
====================
|
||||
[done]Protocol compression
|
||||
[done]Support for GetSchemaTable
|
||||
[done]Named pipes for Windows working
|
||||
[done]Fix issue with ASP.Net data grid
|
||||
[done]Transactions
|
||||
[done]Fixed date/time handling
|
||||
MySQLCommandBuilder
|
||||
|
||||
0.7
|
||||
=================================
|
||||
Support for all CommandBehaviors
|
||||
make XSD internal only
|
||||
Different character sets
|
||||
|
||||
0.8
|
||||
================================
|
||||
Designer support for MySQLCommandBuilder
|
||||
|
||||
0.9
|
||||
===============================
|
||||
?????
|
||||
|
||||
1.0
|
||||
====================
|
||||
Oh yeah!
|
||||
@@ -1,86 +0,0 @@
|
||||
// ByteFX.Data data access components for .Net
|
||||
// Copyright (C) 2002-2003 ByteFX, Inc.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace ByteFX.Data.MySQLClient
|
||||
{
|
||||
public class MySQLTransaction : IDbTransaction
|
||||
{
|
||||
private IsolationLevel _level;
|
||||
private MySQLConnection _conn;
|
||||
private bool _open;
|
||||
|
||||
internal MySQLTransaction()
|
||||
{
|
||||
_open = true;
|
||||
}
|
||||
|
||||
public IsolationLevel IsolationLevel
|
||||
{
|
||||
get { return _level; }
|
||||
set { _level = value; }
|
||||
}
|
||||
|
||||
public IDbConnection Connection
|
||||
{
|
||||
get { return _conn; }
|
||||
set { _conn = (MySQLConnection)value; }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public void Commit()
|
||||
{
|
||||
if (_conn == null || _conn.State != ConnectionState.Open)
|
||||
throw new InvalidOperationException("Connection must be valid and open to commit transaction");
|
||||
if (!_open)
|
||||
throw new InvalidOperationException("Transaction has already been committed or is not pending");
|
||||
Driver d = _conn.Driver;
|
||||
try
|
||||
{
|
||||
d.SendCommand(DBCmd.QUERY, "COMMIT");
|
||||
_open = false;
|
||||
}
|
||||
catch (MySQLException ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void Rollback()
|
||||
{
|
||||
if (_conn == null || _conn.State != ConnectionState.Open)
|
||||
throw new InvalidOperationException("Connection must be valid and open to commit transaction");
|
||||
if (!_open)
|
||||
throw new InvalidOperationException("Transaction has already been rolled back or is not pending");
|
||||
Driver d = _conn.Driver;
|
||||
try
|
||||
{
|
||||
d.SendCommand(DBCmd.QUERY, "ROLLBACK");
|
||||
_open = false;
|
||||
}
|
||||
catch (MySQLException ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
Managed Drivers for MySQL and PostgreSQL
|
||||
======================================
|
||||
|
||||
Current Status of MySQL driver
|
||||
----------------------------------
|
||||
The driver is currently under heavy development.
|
||||
The driver is in beta form with most features working reasonably well, but
|
||||
is not very well tested. Use at your own risk!
|
||||
|
||||
|
||||
|
||||
The goal for version 0.7 is to use many more test cases and improve the stability
|
||||
of the driver greatly.
|
||||
|
||||
|
||||
Current status of the PostgreSQL driver
|
||||
---------------------------------------
|
||||
The PostgreSQL driver is just starting and not really usable yet.
|
||||
It can perform simple reads with a limited set of data types.
|
||||
Watch the project over the next few weeks to see much
|
||||
improvement.
|
||||
|
||||
|
||||
Credit
|
||||
---------------------------------------
|
||||
First of all, many thanks to the MySQL folks for creating such a great database.
|
||||
|
||||
Next, I have to give a big thanks and kudos to Mark Matthews for his Java-based MySQL driver.
|
||||
As the protocol to MySQL is very poorly documented, his driver proved to be invaluable.
|
||||
|
||||
Also, I have to give thanks for Jun Su for starting the SourceForge project and for his wonderful
|
||||
contribution of code and ideas.
|
||||
|
||||
Thanks also go out to Peter Belbin, Timoth Parez, and Daniel Morgan for their input, testing, and all
|
||||
the other things that make open source projects successful!
|
||||
|
||||
|
||||
@@ -1,49 +1,3 @@
|
||||
2003-04-04 Miguel de Icaza <[email protected]>
|
||||
|
||||
*
|
||||
ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib/Zip/Compression/Streams/InflaterInputStream.cs: Do not close the file.
|
||||
|
||||
2003-04-03 Miguel de Icaza <[email protected]>
|
||||
|
||||
*
|
||||
ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib/Zip/Compression/Streams/InflaterInputStream.cs
|
||||
(InflaterInputStream.Skip): Use a more memory friendly implementation.
|
||||
|
||||
2003-04-17 Nick Drochak <[email protected]>
|
||||
|
||||
* library.make: Only try to run the unit tests if there is a Test
|
||||
directory.
|
||||
|
||||
2003-04-11 Duncan Mak <[email protected]>
|
||||
|
||||
* Mono.Globalization/Data/*.xml: Check in XML files used in
|
||||
the implementation of System.Globalization.
|
||||
|
||||
2003-03-31 Martin Willemoes Hansen
|
||||
|
||||
* Stubed System.Drawing.Design
|
||||
|
||||
2003-03-31 Alan Tam <[email protected]>
|
||||
|
||||
* makefile.gnu: Added System.Design to build
|
||||
|
||||
2003-03-31 Alan Tam <[email protected]>
|
||||
|
||||
* library.build: Added back System.Design to build
|
||||
|
||||
2003-03-22 Martin Willemoes Hansen <[email protected]>
|
||||
|
||||
* Stubed Custommarshalers
|
||||
|
||||
2003-03-20 Piers Haken <[email protected]>
|
||||
|
||||
* makefile.gnu: really fix the System.Management build problems
|
||||
|
||||
2003-03-11 Cesar Octavio Lopez Nataren <[email protected]>
|
||||
|
||||
* mcs/class: Added the directories Microsoft.JScript and Microsoft.Vsa that
|
||||
will have the runtime support and CodeDom support for the JScript Compiler.
|
||||
|
||||
2003-03-06 Jackson Harper <[email protected]>
|
||||
|
||||
* makefile.gnu: Add PEAPI to the build
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
2003-04-30 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* list.unix,
|
||||
list: fixed incorrect reference to Util.cs (Misc.cs).
|
||||
|
||||
2003-04-29 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Started.
|
||||
* added ChangeLog, list, list.unix, makefile.gnu and
|
||||
Commons.Xml.Relaxng.build.
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
2003-05-05 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* RdpPattern.cs : added RdpAttribute.expandRef(). UnresolvedRef had
|
||||
remained in attribute patterns.
|
||||
|
||||
2003-04-29 Atsushi Enomoto <[email protected]>
|
||||
|
||||
* Started.
|
||||
* added ChangeLog, RdpNameClasses.cs, RdpObjects.cs, RdpPatterns.cs
|
||||
and Util.cs.
|
||||
|
||||
@@ -1,226 +0,0 @@
|
||||
//
|
||||
// Commons.Xml.Relaxng.Derivative.RdpNameClasses.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <[email protected]>
|
||||
//
|
||||
// 2003 Atsushi Enomoto "No rights reserved."
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace Commons.Xml.Relaxng.Derivative
|
||||
{
|
||||
public enum RdpNameClassType
|
||||
{
|
||||
None = 0,
|
||||
AnyName = 1,
|
||||
AnyNameExcept = 2,
|
||||
NsName = 3,
|
||||
NsNameExcept = 4,
|
||||
Name = 5,
|
||||
NameClassChoice = 6
|
||||
}
|
||||
|
||||
public abstract class RdpNameClass : ICloneable
|
||||
{
|
||||
public abstract RdpNameClassType NameClassType { get; }
|
||||
public abstract bool Contains (string name, string ns);
|
||||
public abstract object Clone ();
|
||||
}
|
||||
|
||||
public class RdpAnyName : RdpNameClass
|
||||
{
|
||||
static RdpAnyName instance;
|
||||
static RdpAnyName ()
|
||||
{
|
||||
instance = new RdpAnyName ();
|
||||
}
|
||||
|
||||
public static RdpAnyName Instance {
|
||||
get { return instance; }
|
||||
}
|
||||
|
||||
private RdpAnyName () {}
|
||||
|
||||
public override RdpNameClassType NameClassType {
|
||||
get { return RdpNameClassType.AnyName; }
|
||||
}
|
||||
|
||||
public override bool Contains (string name, string ns)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override object Clone ()
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public class RdpAnyNameExcept : RdpNameClass
|
||||
{
|
||||
RdpNameClass except;
|
||||
|
||||
public RdpAnyNameExcept (RdpNameClass except)
|
||||
{
|
||||
this.except = except;
|
||||
}
|
||||
|
||||
public override RdpNameClassType NameClassType {
|
||||
get { return RdpNameClassType.AnyNameExcept; }
|
||||
}
|
||||
|
||||
public RdpNameClass ExceptNameClass {
|
||||
get { return except; }
|
||||
}
|
||||
|
||||
public override bool Contains (string name, string ns)
|
||||
{
|
||||
return (except == null) || !except.Contains (name, ns);
|
||||
}
|
||||
|
||||
public override object Clone ()
|
||||
{
|
||||
return new RdpAnyNameExcept (
|
||||
(except != null) ?
|
||||
this.except.Clone () as RdpNameClass :
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
public class RdpNsName : RdpNameClass
|
||||
{
|
||||
string ns;
|
||||
|
||||
public RdpNsName (string ns)
|
||||
{
|
||||
this.ns = ns;
|
||||
}
|
||||
|
||||
public override RdpNameClassType NameClassType {
|
||||
get { return RdpNameClassType.NsName; }
|
||||
}
|
||||
|
||||
public string NamespaceURI {
|
||||
get { return ns; }
|
||||
}
|
||||
|
||||
public override bool Contains (string name, string ns)
|
||||
{
|
||||
return NamespaceURI == ns;
|
||||
}
|
||||
|
||||
public override object Clone ()
|
||||
{
|
||||
return new RdpNsName (this.ns);
|
||||
}
|
||||
}
|
||||
|
||||
public class RdpNsNameExcept : RdpNsName
|
||||
{
|
||||
string ns;
|
||||
RdpNameClass except;
|
||||
|
||||
public RdpNsNameExcept (string ns, RdpNameClass except)
|
||||
: base (ns)
|
||||
{
|
||||
this.ns = ns;
|
||||
this.except = except;
|
||||
}
|
||||
|
||||
public override RdpNameClassType NameClassType {
|
||||
get { return RdpNameClassType.NsNameExcept; }
|
||||
}
|
||||
|
||||
public RdpNameClass ExceptNameClass {
|
||||
get { return except; }
|
||||
}
|
||||
|
||||
public override bool Contains (string name, string ns)
|
||||
{
|
||||
return this.ns == ns &&
|
||||
(except == null || !except.Contains (name, ns));
|
||||
}
|
||||
|
||||
public override object Clone ()
|
||||
{
|
||||
return new RdpNsNameExcept (this.ns,
|
||||
(except != null) ?
|
||||
this.except.Clone () as RdpNameClass :
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
public class RdpName : RdpNameClass
|
||||
{
|
||||
string local;
|
||||
string ns;
|
||||
|
||||
public RdpName (string local, string ns)
|
||||
{
|
||||
this.ns = ns;
|
||||
this.local = local;
|
||||
}
|
||||
|
||||
public override RdpNameClassType NameClassType {
|
||||
get { return RdpNameClassType.Name; }
|
||||
}
|
||||
|
||||
public string NamespaceURI {
|
||||
get { return ns; }
|
||||
}
|
||||
|
||||
public string LocalName {
|
||||
get { return local; }
|
||||
}
|
||||
|
||||
public override bool Contains (string name, string ns)
|
||||
{
|
||||
return this.ns == ns && this.local == name;
|
||||
}
|
||||
|
||||
public override object Clone ()
|
||||
{
|
||||
return new RdpName (this.local, this.ns);
|
||||
}
|
||||
}
|
||||
|
||||
public class RdpNameClassChoice : RdpNameClass
|
||||
{
|
||||
RdpNameClass l;
|
||||
RdpNameClass r;
|
||||
|
||||
public RdpNameClassChoice (RdpNameClass l, RdpNameClass r)
|
||||
{
|
||||
this.l = l;
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
public override RdpNameClassType NameClassType {
|
||||
get { return RdpNameClassType.NameClassChoice; }
|
||||
}
|
||||
|
||||
public RdpNameClass LValue {
|
||||
get { return l; }
|
||||
}
|
||||
|
||||
public RdpNameClass RValue {
|
||||
get { return r; }
|
||||
}
|
||||
|
||||
public override bool Contains (string name, string ns)
|
||||
{
|
||||
return l.Contains (name, ns) || r.Contains (name, ns);
|
||||
}
|
||||
|
||||
public override object Clone ()
|
||||
{
|
||||
return new RdpNameClassChoice (l.Clone () as RdpNameClass,
|
||||
r.Clone () as RdpNameClass);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||