Compare commits

..
2 Commits
Author SHA1 Message Date
nobody 5f2542f763 This commit was manufactured by cvs2svn to create tag 'MCS_0_96'.
svn path=/tags/MCS_0_96/mcs/; revision=29524
2004-06-14 16:35:26 +00:00
nobody 4e4824afab This commit was manufactured by cvs2svn to create branch 'SAVANNAH_CVS'.
svn path=/branches/SAVANNAH_CVS/mcs/; revision=6844
2002-08-21 10:08:33 +00:00
4590 changed files with 16630 additions and 128027 deletions

No files matched your search

-67
View File
@@ -1,70 +1,3 @@
2004-06-24 Raja R Harinath <[email protected]>
* runtime/net_2_0/Makefile.am (gac_assemblies_list): Put back
ICSharpCode.SharpZipLib, not that it has a different version.
2004-06-24 Raja R Harinath <[email protected]>
* Makefile.am (MCS_DIRS, MCS_FILES): Add back Mono.CSharp.Debugger.
(tmpinst-dir-contents, $(tmpinst)/bin/mono.bat): Remove mono.bat
in W32. Use 'mono' and 'mcs' in W32 too.
(bootstrap) [PLATFORM_WIN32]: Back to single stage bootstrap.
* runtime/net_2_0/Makefile.am (gac_assemblies_list): Don't mention
nunit.*, IBM.Data.DB2, ICSharpCode.SharpZipLib.
Fix for #60443, the GAC .DLL-Hell.
2004-06-22 Raja R Harinath <[email protected]>
* Makefile.am (bootstrap) [PLATFORM_WIN32]: Make two-stage.
2004-06-18 Jackson Harper <[email protected]>
* man/mono.1: Add MONO_LOG_LEVEL and MONO_LOG_MASK. Add
instructions on setting multiple mask values.
Fri Jun 18 19:39:09 CEST 2004 Paolo Molaro <[email protected]>
* Makefile.am: process data before runtime, so the config file is
installed and gacutil has a chance to work (finding symlink).
2004-06-18 Raja R Harinath <[email protected]>
* runtime/Makefile.am ($(monoone_DATA) $(monotwo_DATA) $(monobins_DATA)):
Test if files exist in the mcs/ tree before creating symlinks.
Remove symlinks before creating them again.
* runtime/net_1_1/Makefile.am (mscorlib.dll $(gac_assemblies)): Likewise.
* runtime/net_2_0/Makefile.am (mscorlib.dll $(gac_assemblies)): Likewise.
2004-06-18 Raja R Harinath <[email protected]>
* scripts/Makefile.am (REWRITE): New. Common rewriting 'sed' command.
(bin_SCRIPTS): Unify all the script generating rules into one.
2004-06-16 Raja R Harinath <[email protected]>
* Makefile.am (bootstrap) [PLATFORM_WIN32]: Open code. Don't
build and populate net_2_0 profile.
(populate-runtime-subdir): Make into subroutine that takes list of
profiles to populate.
(faststrap): Update.
(MCS_DIRS, MCS_FILES, MONO_CSHARP_DEBUGGER_DIR, MONO_CSHARP_DEBUGGER_FILE):
Avoid automake conditional/+= problems.
(populate-runtime-subdir): Rewrite sanity check.
2004-06-16 Raja R Harinath <[email protected]>
Include prototype completely-untested 'make bootstrap' support for W32.
* Makefile.am (bootstrap): Define to fasterstrap for W32.
(MCS_DIRS, MCS_FILES): Don't refer to Mono.CSharp.Debugger in W32.
(tmpinst-dir): Change sub-make invoke to ...
(tmpinst-dir-contents): ... this. Build 'mono.bat' in W32 instead
of 'mono' and 'mcs'.
($(tmpinst)/bin/mono.bat): New.
2004-06-15 Dick Porter <[email protected]>
* configure.in: Check for struct ip_mreqn and struct ip_mreq on
windows too. Fixes bug 55040.
Mon Jun 14 18:38:34 CEST 2004 Paolo Molaro <[email protected]>
+16 -50
View File
@@ -1,11 +1,11 @@
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I .
SUBDIRS = $(libgc_dir) mono $(ikvm_jni_dir) docs data runtime scripts man samples support web
SUBDIRS = @libgc_dir@ mono @ikvm_jni_dir@ docs runtime scripts man data samples support web
# Keep in sync with SUBDIRS
## 'tools' is not normally built
DIST_SUBDIRS = libgc mono ikvm-jni docs data runtime scripts man samples support web tools
DIST_SUBDIRS = libgc mono ikvm-jni docs runtime scripts man data samples support web tools
EXTRA_DIST= mono.pc.in mono.spec.in mint.pc.in
@@ -28,7 +28,6 @@ mcs_topdir=$(top_srcdir)/../mcs
.PHONY: bootstrap faststrap fasterstrap bootstrap-clean bootstrap-check get-monolite-latest monolite-bootstrap
.PHONY: tmpinst-dir tmpinst-mcs-basic-build tmpinst-mcs-short-build tmpinst-mcs-full-build tmpinst-monolite
.PHONY: mono-do-runtime-only mcs-do-basic-build mcs-do-short-build mcs-do-full-build mcs-do-clean-profiles mcs-do-run-test
.PHONY: populate-runtime-subdir
if USE_JIT
mono_runtime = mono/mini/mono
@@ -52,28 +51,27 @@ MCS_FILES = $(MCS_BASIC_FILES) \
tmpinst = _tmpinst
if PLATFORM_WIN32
populate_profiles = default:net_1_1
# bootstraps using the .NET C# compiler
bootstrap: tmpinst-dir mono-do-runtime-only
$(MAKE) fasterstrap
else
populate_profiles = default:net_1_1 net_2_0:net_2_0
bootstrap: tmpinst-mcs-basic-build mono-do-runtime-only
$(MAKE) tmpinst-mcs-short-build
$(MAKE) fasterstrap
endif
faststrap: tmpinst-mcs-short-build
$(MAKE) mono-do-runtime-only
$(MAKE) fasterstrap
.PHONY: populate-runtime-subdir
## *** warning ***: tested only with GNU make
populate-runtime-subdir:
srcdir=`cd $(srcdir) && pwd`; tmpinst=`pwd`/$(tmpinst) ; \
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
cd $(mcs_topdir) \
&& $(MAKE) PROGRAM_INSTALL_DIR=$$srcdir/runtime LIBRARY_INSTALL_DIR=$$srcdir/runtime/net_1_1 prefix=$$tmpinst/prefix PROFILE=default install \
&& $(MAKE) PROGRAM_INSTALL_DIR=$$srcdir/runtime LIBRARY_INSTALL_DIR=$$srcdir/runtime/net_2_0 prefix=$$tmpinst/prefix PROFILE=net_2_0 install
test -z "`find $(tmpinst)/prefix -name '*.dll'`"
test -z "`find $(tmpinst)/prefix -name '*.exe'`"
set fnord `find $(tmpinst)/prefix -type f | wc -l` ; test "$$2" = 9
rm -rf $(tmpinst)/prefix
fasterstrap: tmpinst-mcs-full-build
$(MAKE) populate-runtime-subdir
$(MAKE)
@@ -141,39 +139,9 @@ mcs-do-run-test: tmpinst-dir
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
cd $(mcs_topdir) && $(MAKE) PROFILE=default run-test
populate-runtime-subdir:
test -n '$(populate_profiles)'
@srcdir=`cd $(srcdir) && pwd`; tmpinst=`pwd`/$(tmpinst) ; \
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
for profile in $(populate_profiles); do \
( set fnord `echo $$profile | sed 's,:, ,g'` && \
echo "cd $(mcs_topdir) && $(MAKE) PROGRAM_INSTALL_DIR=$$srcdir/runtime PROFILE=$$2 LIBRARY_INSTALL_DIR=$$srcdir/runtime/$$3 prefix=$$tmpinst/prefix install" && \
cd $(mcs_topdir) && \
$(MAKE) PROGRAM_INSTALL_DIR=$$srcdir/runtime PROFILE=$$2 LIBRARY_INSTALL_DIR=$$srcdir/runtime/$$3 prefix=$$tmpinst/prefix install ) || exit 1 ; \
done
find $(tmpinst)/prefix -type f -path '*/jay*' -exec rm -f '{}' ';'
test -z "`find $(tmpinst)/prefix -type f -print`"
rm -rf $(tmpinst)/prefix
tmpinst-dir:
mkdir -p $(tmpinst) $(tmpinst)/bin $(tmpinst)/lib $(tmpinst)/etc/mono
$(MAKE) tmpinst-dir-contents
tmpinst-dir-contents: $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/etc/mono/machine.config
if PLATFORM_WIN32
$(tmpinst)/bin/mono: $(srcdir)/Makefile.am
echo '#! /bin/sh' > $@
echo 'builddir="'`pwd`'"; win_builddir="'`cygpath -w -a .`'"' >> $@
echo 'tmpinst="$$win_builddir\\$(tmpinst)"' >> $@
echo 'if test -z "$$MONO_PATH" ; then MONO_PATH="$$tmpinst\\lib"; else MONO_PATH="$${MONO_PATH};$$tmpinst\\lib" ; fi' >> $@
echo 'MONO_CFG_DIR="$$tmpinst\\etc"' >> $@
echo 'export MONO_PATH MONO_CFG_DIR' >> $@
echo 'exec "$$builddir/libtool" --mode=execute "$$builddir/mono.exe" "$$@"' >> $@
chmod +x $@
else
$(MAKE) $(tmpinst)/bin/mono $(tmpinst)/bin/mcs $(tmpinst)/etc/mono/machine.config
$(tmpinst)/bin/mono: $(srcdir)/Makefile.am
echo '#! /bin/sh' > $@
@@ -184,8 +152,6 @@ $(tmpinst)/bin/mono: $(srcdir)/Makefile.am
echo 'exec "$$builddir/libtool" --mode=execute "$$builddir/$(mono_runtime)" --config "$$builddir/data/config" "$$@"' >> $@
chmod +x $@
endif
$(tmpinst)/bin/mcs: $(srcdir)/Makefile.am
(t=`cd $(tmpinst) && pwd`; echo '#! /bin/sh'; echo 'exec "'"$$t/bin/mono"'" "'"$$t/lib/mcs.exe"'" "$$@"') > $@
chmod +x $@
+5 -44
View File
@@ -1,7 +1,7 @@
AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(mono,0.97)
AM_INIT_AUTOMAKE(mono,0.96)
AM_MAINTAINER_MODE
AC_PROG_LN_S
@@ -908,34 +908,6 @@ else
jdk_headers_found=no
AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
dnl *********************************
dnl *** Check for struct ip_mreqn ***
dnl *********************************
AC_MSG_CHECKING(for struct ip_mreqn)
AC_TRY_COMPILE([#include <ws2tcpip.h>], [
struct ip_mreqn mreq;
mreq.imr_address.s_addr = 0;
], [
# Yes, we have it...
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_IP_MREQN)
], [
# We'll just have to try and use struct ip_mreq
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for struct ip_mreq)
AC_TRY_COMPILE([#include <ws2tcpip.h>], [
struct ip_mreq mreq;
mreq.imr_interface.s_addr = 0;
], [
# Yes, we have it...
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_IP_MREQ)
], [
# No multicast support
AC_MSG_RESULT(no)
])
])
fi
dnl socklen_t check
@@ -1076,7 +1048,6 @@ ACCESS_UNALIGNED="yes"
JIT_SUPPORTED=no
LIBC="libc.so.6"
INTL="libc.so.6"
jit_wanted=false
case "$host" in
@@ -1101,15 +1072,12 @@ case "$host" in
JIT_SUPPORTED=yes
ACCESS_UNALIGNED="no"
LIBC="libc.so"
INTL="libintl.so"
jit_wanted=true
;;
alpha*-*-linux* | alpha*-*-osf*)
TARGET=ALPHA;
ACCESS_UNALIGNED="no"
JIT_SUPPORTED=no
arch_target=alpha;
;;
# alpha*-*-linux* | alpha*-*-osf*)
# TARGET=ALPHA;
# ACCESS_UNALIGNED="no"
# ;;
# ia64-*-linux* | ia64-*-hpux*)
# TARGET=IA64;
# arch_target=ia64;
@@ -1129,11 +1097,6 @@ case "$host" in
LIBC="libc.sl"
ACCESS_UNALIGNED="no"
;;
hppa*linux*)
TARGET=HPPA;
arch_target=hppa;
ACCESS_UNALIGNED="no"
;;
macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | \
powerpc-*-sysv* | powerpc-*-darwin*)
TARGET=POWERPC;
@@ -1178,7 +1141,6 @@ case "$host" in
powerpc-*-darwin*)
libsuffix=".dylib"
LIBC="libc.dylib"
INTL="libintl.dylib"
;;
*-*-*netbsd*)
LIBC="libc.so.12"
@@ -1239,7 +1201,6 @@ AM_CONDITIONAL(HPPA, test x$TARGET = xHPPA)
AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
AC_SUBST(LIBC)
AC_SUBST(INTL)
AC_SUBST(arch_target)
AC_SUBST(CFLAGS)
+1
View File
@@ -2,3 +2,4 @@ Makefile.in
Makefile
config
.cvsignore
browscap.ini
+6 -1
View File
@@ -3,10 +3,15 @@ monodir = $(sysconfdir)/mono
EXTRA_DIST = config.in \
machine.config \
DefaultWsdlHelpGenerator.aspx \
browscap.ini
browscap.ini.gz
mono_DATA = config \
machine.config \
DefaultWsdlHelpGenerator.aspx \
browscap.ini
CLEANFILES = browscap.ini
browscap.ini: browscap.ini.gz
gunzip -c $^ > $@
-13082
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
-1
View File
@@ -1,7 +1,6 @@
<configuration>
<dllmap dll="cygwin1.dll" target="@LIBC@" />
<dllmap dll="libc" target="@LIBC@" />
<dllmap dll="libintl" target="@INTL@" />
<dllmap dll="libxslt.dll" target="libxslt@libsuffix@" />
<dllmap dll="libmySQL.dll" target="libmysqlclient@libsuffix@" />
<dllmap dll="odbc32.dll" target="libodbc@libsuffix@" />
-6
View File
@@ -152,12 +152,6 @@
enableSessionState="true"
autoEventWireup="true"
validateRequest="true" />
<clientTarget>
<add alias="ie5" userAgent="Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)" />
<add alias="ie4" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
<add alias="uplevel" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
<add alias="downlevel" userAgent="Unknown" />
</clientTarget>
</system.web>
<system.runtime.remoting>
+246
View File
@@ -0,0 +1,246 @@
System.Object
System.Exception
System.ValueType
System.Delegate
System.MulticastDelegate
System.Enum
System.Activator
System.ArgIterator
System.__ComObject
System.TypedReference
System.Security.AllowPartiallyTrustedCallersAttribute
System.Runtime.Serialization.Formatter
System.Runtime.Serialization.FormatterConverter
System.Runtime.Serialization.FormatterServices
System.Runtime.Serialization.ObjectIDGenerator
System.Runtime.Serialization.ObjectManager
System.Reflection.ModuleResolveEventHandler
System.Reflection.Pointer
System.Globalization.CompareInfo
System.Globalization.HebrewCalendar
System.Globalization.HijriCalendar
System.Globalization.JapaneseCalendar
System.Globalization.KoreanCalendar
System.Globalization.SortKey
System.Globalization.StringInfo
System.Globalization.TaiwanCalendar
System.Globalization.TextElementEnumerator
System.Globalization.TextInfo
System.Globalization.ThaiBuddhistCalendar
System.IO.IsolatedStorage.IsolatedStorageFile
System.Reflection.Emit.MethodRental
System.Runtime.CompilerServices.AccessedThroughPropertyAttribute
System.Runtime.CompilerServices.CallConvCdecl
System.Runtime.CompilerServices.CallConvStdcall
System.Runtime.CompilerServices.CallConvThiscall
System.Runtime.CompilerServices.CallConvFastcall
System.Runtime.CompilerServices.CustomConstantAttribute
System.Runtime.CompilerServices.DateTimeConstantAttribute
System.Runtime.CompilerServices.DiscardableAttribute
System.Runtime.CompilerServices.DecimalConstantAttribute
System.Runtime.CompilerServices.CompilationRelaxationsAttribute
System.Runtime.CompilerServices.CompilerGlobalScopeAttribute
System.Runtime.CompilerServices.IDispatchConstantAttribute
System.Runtime.CompilerServices.IsVolatile
System.Runtime.CompilerServices.IUnknownConstantAttribute
System.Runtime.CompilerServices.RequiredAttributeAttribute
System.Runtime.InteropServices.ArrayWithOffset
System.Runtime.InteropServices.DispIdAttribute
System.Runtime.InteropServices.ClassInterfaceType
System.Runtime.InteropServices.ClassInterfaceAttribute
System.Runtime.InteropServices.ComVisibleAttribute
System.Runtime.InteropServices.LCIDConversionAttribute
System.Runtime.InteropServices.ComRegisterFunctionAttribute
System.Runtime.InteropServices.ComUnregisterFunctionAttribute
System.Runtime.InteropServices.ProgIdAttribute
System.Runtime.InteropServices.ImportedFromTypeLibAttribute
System.Runtime.InteropServices.IDispatchImplType
System.Runtime.InteropServices.IDispatchImplAttribute
System.Runtime.InteropServices.ComSourceInterfacesAttribute
System.Runtime.InteropServices.ComConversionLossAttribute
System.Runtime.InteropServices.TypeLibTypeFlags
System.Runtime.InteropServices.TypeLibFuncFlags
System.Runtime.InteropServices.TypeLibVarFlags
System.Runtime.InteropServices.TypeLibTypeAttribute
System.Runtime.InteropServices.TypeLibFuncAttribute
System.Runtime.InteropServices.TypeLibVarAttribute
System.Runtime.InteropServices.ComImportAttribute
System.Runtime.InteropServices.PreserveSigAttribute
System.Runtime.InteropServices.ComAliasNameAttribute
System.Runtime.InteropServices.AutomationProxyAttribute
System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute
System.Runtime.InteropServices.CoClassAttribute
System.Runtime.InteropServices.ComEventInterfaceAttribute
System.Runtime.InteropServices.COMException
System.Runtime.InteropServices.ComMemberType
System.Runtime.InteropServices.CurrencyWrapper
System.Runtime.InteropServices.DispatchWrapper
System.Runtime.InteropServices.ErrorWrapper
System.Runtime.InteropServices.ExtensibleClassFactory
System.Runtime.InteropServices.HandleRef
System.Runtime.InteropServices.InvalidComObjectException
System.Runtime.InteropServices.InvalidOleVariantTypeException
System.Runtime.InteropServices.TypeLibImporterFlags
System.Runtime.InteropServices.ExporterEventKind
System.Runtime.InteropServices.ITypeLibExporterNotifySink
System.Runtime.InteropServices.ITypeLibConverter
System.Runtime.InteropServices.MarshalDirectiveException
System.Runtime.InteropServices.ObjectCreationDelegate
System.Runtime.InteropServices.RuntimeEnvironment
System.Runtime.InteropServices.RegistrationServices
System.Runtime.InteropServices.SafeArrayRankMismatchException
System.Runtime.InteropServices.SafeArrayTypeMismatchException
System.Runtime.InteropServices.SEHException
System.Runtime.InteropServices.TypeLibConverter
System.Runtime.InteropServices.BIND_OPTS
System.Runtime.InteropServices.UCOMIBindCtx
System.Runtime.InteropServices.UCOMIConnectionPointContainer
System.Runtime.InteropServices.UCOMIConnectionPoint
System.Runtime.InteropServices.UCOMIEnumMoniker
System.Runtime.InteropServices.CONNECTDATA
System.Runtime.InteropServices.UCOMIEnumConnections
System.Runtime.InteropServices.UCOMIEnumConnectionPoints
System.Runtime.InteropServices.UCOMIEnumString
System.Runtime.InteropServices.UCOMIEnumVARIANT
System.Runtime.InteropServices.FILETIME
System.Runtime.InteropServices.UCOMIMoniker
System.Runtime.InteropServices.UCOMIPersistFile
System.Runtime.InteropServices.UCOMIRunningObjectTable
System.Runtime.InteropServices.STATSTG
System.Runtime.InteropServices.UCOMIStream
System.Runtime.InteropServices.DESCKIND
System.Runtime.InteropServices.BINDPTR
System.Runtime.InteropServices.UCOMITypeComp
System.Runtime.InteropServices.TYPEKIND
System.Runtime.InteropServices.TYPEFLAGS
System.Runtime.InteropServices.IMPLTYPEFLAGS
System.Runtime.InteropServices.TYPEATTR
System.Runtime.InteropServices.FUNCDESC
System.Runtime.InteropServices.IDLFLAG
System.Runtime.InteropServices.IDLDESC
System.Runtime.InteropServices.PARAMFLAG
System.Runtime.InteropServices.PARAMDESC
System.Runtime.InteropServices.TYPEDESC
System.Runtime.InteropServices.ELEMDESC
System.Runtime.InteropServices.VARDESC
System.Runtime.InteropServices.DISPPARAMS
System.Runtime.InteropServices.EXCEPINFO
System.Runtime.InteropServices.FUNCKIND
System.Runtime.InteropServices.INVOKEKIND
System.Runtime.InteropServices.CALLCONV
System.Runtime.InteropServices.FUNCFLAGS
System.Runtime.InteropServices.VARFLAGS
System.Runtime.InteropServices.UCOMITypeInfo
System.Runtime.InteropServices.SYSKIND
System.Runtime.InteropServices.LIBFLAGS
System.Runtime.InteropServices.TYPELIBATTR
System.Runtime.InteropServices.UCOMITypeLib
System.Runtime.InteropServices.UnknownWrapper
System.Runtime.Remoting.IObjectHandle
System.Runtime.Remoting.IRemotingTypeInfo
System.Runtime.Remoting.IChannelInfo
System.Runtime.Remoting.IEnvoyInfo
System.Runtime.Remoting.RemotingConfiguration
System.Runtime.Remoting.TypeEntry
System.Runtime.Remoting.ActivatedClientTypeEntry
System.Runtime.Remoting.ActivatedServiceTypeEntry
System.Runtime.Remoting.WellKnownClientTypeEntry
System.Runtime.Remoting.WellKnownServiceTypeEntry
System.Runtime.Remoting.RemotingException
System.Runtime.Remoting.ServerException
System.Runtime.Remoting.RemotingTimeoutException
System.Runtime.Remoting.RemotingServices
System.Runtime.Remoting.InternalRemotingServices
System.Runtime.Remoting.SoapServices
System.Runtime.Remoting.Activation.UrlAttribute
System.Runtime.Remoting.Messaging.IMessageSink
System.Runtime.Remoting.Messaging.AsyncResult
System.Runtime.Remoting.Messaging.CallContext
System.Runtime.Remoting.Messaging.ILogicalThreadAffinative
System.Runtime.Remoting.Messaging.InternalMessageWrapper
System.Runtime.Remoting.Messaging.IMethodCallMessage
System.Runtime.Remoting.Messaging.MethodCallMessageWrapper
System.Runtime.Remoting.Messaging.HeaderHandler
System.Runtime.Remoting.Messaging.IMessageCtrl
System.Runtime.Remoting.Messaging.IRemotingFormatter
System.Runtime.Remoting.Messaging.ReturnMessage
System.Runtime.Remoting.Messaging.MethodCall
System.Runtime.Remoting.Messaging.ConstructionCall
System.Runtime.Remoting.Messaging.MethodResponse
System.Runtime.Remoting.Messaging.ConstructionResponse
System.Runtime.Remoting.Messaging.MethodReturnMessageWrapper
System.Runtime.Remoting.Messaging.OneWayAttribute
System.Runtime.Remoting.Messaging.MessageSurrogateFilter
System.Runtime.Remoting.Messaging.RemotingSurrogateSelector
System.Runtime.Remoting.Contexts.CrossContextDelegate
System.Runtime.Remoting.Contexts.ContextProperty
System.Runtime.Remoting.Contexts.IContextPropertyActivator
System.Runtime.Remoting.Contexts.IContributeClientContextSink
System.Runtime.Remoting.Contexts.IContributeDynamicSink
System.Runtime.Remoting.Contexts.IContributeEnvoySink
System.Runtime.Remoting.Contexts.IContributeObjectSink
System.Runtime.Remoting.Contexts.IContributeServerContextSink
System.Runtime.Serialization.Formatters.InternalRM
System.Runtime.Serialization.Formatters.InternalST
System.Runtime.Serialization.Formatters.SoapMessage
System.Runtime.Serialization.Formatters.SoapFault
System.Runtime.Serialization.Formatters.ServerFault
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
System.Security.Cryptography.CryptoConfig
System.Security.Cryptography.KeyedHashAlgorithm
System.Security.Cryptography.HMACSHA1
System.Security.Cryptography.MACTripleDES
System.Security.Cryptography.MaskGenerationMethod
System.Security.Cryptography.PasswordDeriveBytes
System.Security.Cryptography.PKCS1MaskGenerationMethod
System.Security.Cryptography.RC2
System.Security.Cryptography.RC2CryptoServiceProvider
System.Security.Cryptography.RSACryptoServiceProvider
System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter
System.Security.Cryptography.RSAOAEPKeyExchangeFormatter
System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter
System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter
System.Security.Cryptography.RSAPKCS1SignatureDeformatter
System.Security.Cryptography.RSAPKCS1SignatureFormatter
System.Security.Cryptography.SHA1Managed
System.Security.Cryptography.TripleDES
System.Security.Cryptography.TripleDESCryptoServiceProvider
System.Security.Permissions.EnvironmentPermission
System.Security.Permissions.FileDialogPermission
System.Security.Permissions.IsolatedStorageFilePermission
System.Security.Permissions.PrincipalPermissionAttribute
System.Security.Permissions.SecurityPermissionAttribute
System.Security.Permissions.PublisherIdentityPermissionAttribute
System.Security.Permissions.PublisherIdentityPermission
System.Security.Permissions.ReflectionPermission
System.Security.Permissions.RegistryPermission
System.Security.Permissions.PrincipalPermission
System.Security.Permissions.SiteIdentityPermission
System.Security.Permissions.StrongNameIdentityPermission
System.Security.Permissions.StrongNamePublicKeyBlob
System.Security.Permissions.UIPermission
System.Security.Permissions.UrlIdentityPermission
System.Security.Permissions.ZoneIdentityPermission
System.Security.Policy.ApplicationDirectory
System.Security.Policy.ApplicationDirectoryMembershipCondition
System.Security.Policy.FirstMatchCodeGroup
System.Security.Policy.Hash
System.Security.Policy.HashMembershipCondition
System.Security.Policy.NetCodeGroup
System.Security.Policy.PermissionRequestEvidence
System.Security.Policy.Publisher
System.Security.Policy.PublisherMembershipCondition
System.Security.Policy.Site
System.Security.Policy.SiteMembershipCondition
System.Security.Policy.StrongName
System.Security.Policy.StrongNameMembershipCondition
System.Security.Policy.UnionCodeGroup
System.Security.Policy.Url
System.Security.Policy.UrlMembershipCondition
System.Security.Policy.Zone
System.Security.Policy.ZoneMembershipCondition
System.Security.Principal.WindowsIdentity
System.Security.Principal.WindowsImpersonationContext
System.Security.Principal.WindowsPrincipal
System.Threading.CompressedStack
-8
View File
@@ -1,11 +1,3 @@
2004-06-24 David Waite <[email protected]>
* mono-jni.c: change to C90-style comments from C99/C++-style
Fri Jun 18 13:46:05 CEST 2004 Paolo Molaro <[email protected]>
* mono-jni.c: updates for the API cleanups.
2004-05-05 Zoltan Varga <[email protected]>
* mono-jni.c: Implement some missing JNI functions.
+25 -25
View File
@@ -149,8 +149,8 @@ StringFromUTF8 (const char* psz)
/* TODO: */
return mono_string_new (mono_domain_get (), psz);
#if 0
/* Sun's modified UTF8 encoding is not compatible with System::Text::Encoding::UTF8, so */
/* we need to roll our own */
// Sun's modified UTF8 encoding is not compatible with System::Text::Encoding::UTF8, so
// we need to roll our own
int len, res_len, i;
int *res;
@@ -163,16 +163,16 @@ StringFromUTF8 (const char* psz)
switch (c >> 4)
{
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
/* 0xxxxxxx */
// 0xxxxxxx
break;
case 12: case 13:
/* 110x xxxx 10xx xxxx */
// 110x xxxx 10xx xxxx
char2 = *psz++;
i++;
c = (((c & 0x1F) << 6) | (char2 & 0x3F));
break;
case 14:
/* 1110 xxxx 10xx xxxx 10xx xxxx */
// 1110 xxxx 10xx xxxx 10xx xxxx
char2 = *psz++;
char3 = *psz++;
i++;
@@ -263,50 +263,50 @@ static jobject JNICALL CallObjectMethodA (JNIEnv *env, jobject obj, jmethodID me
static MonoObject *
box_Boolean (jboolean val)
{
return mono_value_box (mono_domain_get (), mono_get_boolean_class (), &val);
return mono_value_box (mono_domain_get (), mono_defaults.boolean_class, &val);
}
static MonoObject *
box_Byte (jbyte val)
{
/* Sbyte ! */
return mono_value_box (mono_domain_get (), mono_get_sbyte_class (), &val);
return mono_value_box (mono_domain_get (), mono_defaults.sbyte_class, &val);
}
static MonoObject *
box_Char (jchar val)
{
return mono_value_box (mono_domain_get (), mono_get_char_class (), &val);
return mono_value_box (mono_domain_get (), mono_defaults.char_class, &val);
}
static MonoObject *
box_Short (jshort val)
{
return mono_value_box (mono_domain_get (), mono_get_int16_class (), &val);
return mono_value_box (mono_domain_get (), mono_defaults.int16_class, &val);
}
static MonoObject *
box_Int (jint val)
{
return mono_value_box (mono_domain_get (), mono_get_int32_class (), &val);
return mono_value_box (mono_domain_get (), mono_defaults.int32_class, &val);
}
static MonoObject *
box_Long (jlong val)
{
return mono_value_box (mono_domain_get (), mono_get_int64_class (), &val);
return mono_value_box (mono_domain_get (), mono_defaults.int64_class, &val);
}
static MonoObject *
box_Float (jfloat val)
{
return mono_value_box (mono_domain_get (), mono_get_single_class (), &val);
return mono_value_box (mono_domain_get (), mono_defaults.single_class, &val);
}
static MonoObject *
box_Double (jdouble val)
{
return mono_value_box (mono_domain_get (), mono_get_double_class (), &val);
return mono_value_box (mono_domain_get (), mono_defaults.double_class, &val);
}
static int
@@ -327,7 +327,7 @@ InvokeHelper (JNIEnv *env, jobject object, jmethodID methodID, jvalue* args)
MonoObject **argarray;
MonoArray *args2;
/* assert(!pLocalRefs->PendingException); */
// assert(!pLocalRefs->PendingException);
g_assert(methodID);
argc = GetMethodArgs(methodID, sig);
@@ -368,7 +368,7 @@ InvokeHelper (JNIEnv *env, jobject object, jmethodID methodID, jvalue* args)
}
}
args2 = mono_array_new (mono_domain_get (), mono_get_object_class (), argc);
args2 = mono_array_new (mono_domain_get (), mono_defaults.object_class, argc);
for (i = 0; i < argc; ++i)
mono_array_set (args2, MonoObject*, i, argarray [i]);
@@ -475,7 +475,7 @@ METHOD_IMPL(Double,jdouble)
/* TODO: These should be put into the macros above... */
// TODO: These should be put into the macros above...
static void JNICALL CallVoidMethodA (JNIEnv *env, jobject obj, jmethodID methodID, jvalue * args) {
InvokeHelper(env, obj, methodID, args);
}
@@ -581,7 +581,7 @@ static type JNICALL GetStatic##Type##Field(JNIEnv *env, jclass clazz, jfieldID f
/* return *(cpptype*)BOXED_VALUE (jniFuncs.GetFieldValue (fieldID, jniFuncs.UnwrapRef (obj))); */
// return *(cpptype*)BOXED_VALUE (jniFuncs.GetFieldValue (fieldID, jniFuncs.UnwrapRef (obj)));
GET_SET_FIELD(Boolean,jboolean,gboolean)
GET_SET_FIELD(Byte,jbyte, gchar)
@@ -734,42 +734,42 @@ static jobjectArray JNICALL NewObjectArray (JNIEnv *env, jsize len, jclass clazz
static jbooleanArray JNICALL NewBooleanArray (JNIEnv *env, jsize len)
{
return (jbooleanArray)new_java_array (env, mono_get_boolean_class (), len);
return (jbooleanArray)new_java_array (env, mono_defaults.boolean_class, len);
}
static jbyteArray JNICALL NewByteArray (JNIEnv *env, jsize len)
{
return (jbyteArray)new_java_array (env, mono_get_sbyte_class (), len);
return (jbyteArray)new_java_array (env, mono_defaults.sbyte_class, len);
}
static jcharArray JNICALL NewCharArray (JNIEnv *env, jsize len)
{
return (jcharArray)new_java_array (env, mono_get_char_class (), len);
return (jcharArray)new_java_array (env, mono_defaults.char_class, len);
}
static jshortArray JNICALL NewShortArray (JNIEnv *env, jsize len)
{
return (jshortArray)new_java_array (env, mono_get_int16_class (), len);
return (jshortArray)new_java_array (env, mono_defaults.int16_class, len);
}
static jintArray JNICALL NewIntArray (JNIEnv *env, jsize len)
{
return (jintArray)new_java_array (env, mono_get_int32_class (), len);
return (jintArray)new_java_array (env, mono_defaults.int32_class, len);
}
static jlongArray JNICALL NewLongArray (JNIEnv *env, jsize len)
{
return (jlongArray)new_java_array (env, mono_get_int64_class (), len);
return (jlongArray)new_java_array (env, mono_defaults.int64_class, len);
}
static jfloatArray JNICALL NewFloatArray (JNIEnv *env, jsize len)
{
return (jfloatArray)new_java_array (env, mono_get_single_class (), len);
return (jfloatArray)new_java_array (env, mono_defaults.single_class, len);
}
static jdoubleArray JNICALL NewDoubleArray (JNIEnv *env, jsize len)
{
return (jdoubleArray)new_java_array (env, mono_get_double_class (), len);
return (jdoubleArray)new_java_array (env, mono_defaults.double_class, len);
}
/* Original version with copy */
+2 -55
View File
@@ -1,9 +1,8 @@
.\"
.\" mono-config configuration page.
.\" mono configuration page.
.\" (C) Ximian, Inc.
.\" Author:
.\" Miguel de Icaza ([email protected])
.\" Paolo Molaro ([email protected])
.\"
.TH Mono "Mono 1.0"
.SH NAME
@@ -13,9 +12,6 @@ The Mono runtime will load configuration data from the
installation prefix /etc/mono/config file, the ~/.mono/config or from
the file pointed by the MONO_CONFIG environment variable.
.PP
For each assembly loaded a config file with the name:
/path/to/the/assembly.exe.config is loaded, too.
.PP
This file controls the behavior of the runtime.
.PP
The file contains an XML-like file with various sections, all of them
@@ -28,37 +24,6 @@ You use the dllmap directive to map shared libraries referenced by
P/Invoke in your assemblies to a different shared library.
.PP
This is typically used to map Windows libraries to Unix library names.
The
.B dllmap
element takes two attributes:
.TP
.I dll
This should be the same string used in the DllImport attribute
.TP
.I target
This should be the name of the library where the function can be found:
this name should be suitable for use with the platform native shared library
loading routines (dlopen etc.), so you may want to check the manpages for that, too.
.SH <dllentry> directive
This directive can be used to map a specific dll/function pair to a different
library and also a different function name. It should appear inside a
.B dllmap
element with only the dll attribute specified.
.PP
The
.B dllentry
element takes 3 attributes:
.TP
.I dll
This is the target library, where the function can be found.
.TP
.I name
This is the name of the fuction as it appears in the metadata: it is the name
of the P/Invoke method.
.TP
.I target
This is the name of the function to lookup instead of the name specified in the
P/Invoke method.
.SH EXAMPLES
The following example maps references to the `cygwin1.dll' shared
library to the `libc.so.6' file.
@@ -67,23 +32,5 @@ library to the `libc.so.6' file.
<dllmap dll="cygwin1.dll" target="libc.so.6"/>
</configuration>
.fi
.PP
This one maps the following C# method:
.nf
[DllImport ("libc")]
static extern void somefunction ();
.fi
to
.B differentfunction
in
.B libdifferent.so.
.nf
<configuration>
<dllmap dll="libc">
<dllentry dll="libdifferent.so" name="somefunction" target="differentfunction" />
</dllmap>
</configuration>
.fi
.SH SEE ALSO
.BR mono(1), monodis(1), mint(1)
.BR mono(1), monodis(1), mint(1)
+9 -15
View File
@@ -252,21 +252,6 @@ If set, this variable overrides the default runtime configuration file
($PREFIX/etc/mono/config). The --config command line options overrides the
environment variable.
.TP
.I "MONO_LOG_LEVEL"
If set, the logging level is changed to the set value. Possible values
are "error", "critical", "warning", "message", "info", "debug". The
default value is "error". Messages with a logging level greater then
or equal to the log level will be printed to stdout/stderr.
.TP
.I "MONO_LOG_MASK"
If set, the log mask is changed to the set value. Possible values are
"asm" (assembly loader), "type", "dll" (native library loader), "gc"
(garbage collector), "cfg" (config file loader), "all". The default value is
"all". Changing the mask value allows you to display only messages for
a certain component. You can use multiple masks by comma separating
them. For example to see config file messages and assembly loader
messages set you mask to "asm,cfg".
.TP
.I "MONO_DEBUG"
If set, enables some features of the runtime useful for debugging.
It makes the runtime display the stack traces for all the threads
@@ -325,6 +310,15 @@ If set its the directory where the ".wapi" handle state is stored.
This is the directory where the Windows I/O Emulation layer stores its
shared state data (files, events, mutexes, pipes). By default Mono
will store the ".wapi" directory in the users's home directory.
.TP
.I "MONO_UNMANAGED_XSLT"
If set any value, System.Xml.Xsl.XslTransform uses libxslt-based
transformation engine (a.k.a Unmanaged XSLT). Unmanaged XSLT has
long been used for XSLT engine while Managed XSLT engine is so
new and might have some bugs. Basically we recommend Managed XSLT
solution, but if it contains some blocking bugs, then you can also
use traditional libxslt. If you want to use msxsl:script, you have
to select Managed XSLT.
.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
-8
View File
@@ -1,11 +1,3 @@
2004-06-22 Todd Berman <[email protected]>
* configure: Patch from Mariano Suárez-Alvarez
<[email protected]> to make configure accept jhbuild style
/prefix /usr options, and to continue past unknown options. Currently
this patch is a bit spammy with multiple unknown options, anyone
who is interested is welcome to fix this.
2004-06-14 Raja R Harinath <[email protected]>
* Makefile (all-profiles, clean-profiles): Simplify slightly.
-22
View File
@@ -1,25 +1,3 @@
2004-06-21 Raja R Harinath <[email protected]>
* executable.make ($(PROGRAM)): Move depend on the makefrags ...
(all-local): ... here.
* library.make ($(the_lib), $(test_lib), $(btest_lib), all-local):
Likewise.
(LIBRARY_SNK): New default define. Allows library to be signed
with a key other than mono.snk.
($(the_lib_signature_stamp)): New stamp file created when an
assembly is signed.
(install-local, uninstall-local, maybe-sign-lib): Set MONO_PATH.
2004-06-16 Raja R Harinath <[email protected]>
* library.make ($(makefrag),$(test_makefrag),$(btest_makefrag)):
Depend on library.make.
* executable.make ($(makefrag)): Depend on executable.make.
2004-06-16 Atsushi Enomoto <[email protected]>
* library.make : Added GACDIR. Use cygpath -w on windows.
2004-06-14 Raja R Harinath <[email protected]>
* platforms/linux.make (PLATFORM_CHANGE_SEPARATOR_CMD): Define to 'cat'.
-1
View File
@@ -1,4 +1,3 @@
*.makefrag
*.response
*.stamp
*.was_signed
+1 -4
View File
@@ -55,7 +55,7 @@ ifndef PROGRAM_COMPILE
PROGRAM_COMPILE = $(CSCOMPILE)
endif
$(PROGRAM): $(BUILT_SOURCES) $(response)
$(PROGRAM): $(makefrag) $(BUILT_SOURCES) $(response)
$(PROGRAM_COMPILE) /target:exe /out:$@ $(BUILT_SOURCES) @$(response)
$(makefrag): $(sourcefile)
@@ -69,6 +69,3 @@ $(response): $(sourcefile)
endif
-include $(makefrag)
all-local: $(makefrag)
$(makefrag): $(topdir)/build/executable.make
+10 -26
View File
@@ -28,9 +28,8 @@ endif
makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
the_lib = $(topdir)/class/lib/$(PROFILE)/$(LIBRARY_NAME)
the_lib_signature_stamp = $(makefrag:.makefrag=.was_signed)
the_pdb = $(the_lib:.dll=.pdb)
library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb) $(the_lib_signature_stamp)
library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb)
ifndef NO_TEST
test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll
@@ -81,15 +80,9 @@ ifeq ($(PROFILE), net_2_0)
PACKAGE = 2.0
endif
ifeq ($(PLATFORM), win32)
GACDIR = `cygpath -w $(DESTDIR)$(prefix)/lib`
else
GACDIR = $(DESTDIR)$(prefix)/lib
endif
all-local: $(the_lib)
install-local: $(the_lib)
install-local: $(the_lib) maybe-sign-lib
ifdef LIBRARY_INSTALL_DIR
install-local:
@@ -102,26 +95,20 @@ uninstall-local:
else
install-local: $(gacutil)
MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(gacutil) /i $(the_lib) /f /root $(GACDIR) /package $(PACKAGE)
$(RUNTIME) $(gacutil) /i $(the_lib) /f /root $(DESTDIR)$(prefix)/lib /package $(PACKAGE)
uninstall-local: $(gacutil)
MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(gacutil) /u $(LIBRARY_NAME:.dll=)
$(RUNTIME) $(gacutil) /u $(LIBRARY_NAME:.dll=)
$(gacutil):
cd $(topdir)/tools/gacutil && $(MAKE)
endif
maybe-sign-lib:
ifndef NO_SIGN_ASSEMBLY
install-local: $(the_lib_signature_stamp)
ifndef LIBRARY_SNK
LIBRARY_SNK = $(topdir)/class/mono.snk
endif
$(the_lib_signature_stamp): $(the_lib) $(sn)
MONO_PATH="$(topdir)/class/lib/$(PROFILE):$$MONO_PATH" $(RUNTIME) $(sn) -q -R $(the_lib) $(LIBRARY_SNK)
echo stamp > $@
maybe-sign-lib: $(sn)
$(RUNTIME) $(sn) -q -R $(the_lib) $(topdir)/class/mono.snk
endif
$(sn):
@@ -207,7 +194,7 @@ endif
# Fun with dependency tracking
$(the_lib): $(response)
$(the_lib): $(makefrag) $(response)
$(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) /target:library /out:$@ @$(response)
$(makefrag): $(sourcefile)
@@ -227,7 +214,7 @@ endif
ifdef HAVE_CS_TESTS
$(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
$(test_lib): $(test_makefrag) $(test_dep) $(test_response) $(test_nunit_dep)
$(TEST_COMPILE) /target:library /out:$@ $(test_flags) @$(test_response)
$(test_response): $(test_sourcefile)
@@ -244,7 +231,7 @@ endif
ifdef HAVE_VB_TESTS
$(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
$(btest_lib): $(btest_makefrag) $(test_dep) $(btest_response) $(test_nunit_dep)
$(BTEST_COMPILE) /target:library /out:$@ $(btest_flags) @$(btest_response)
$(btest_response): $(btest_sourcefile)
@@ -258,6 +245,3 @@ $(btest_makefrag): $(btest_response)
-include $(btest_makefrag)
endif
all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
$(makefrag) $(test_makefrag) $(btest_makefrag): $(topdir)/build/library.make
@@ -4,27 +4,6 @@
// What a horrible interface.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace Accessibility {
public interface IAccessible {
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
interface IAccessibleHandler {
// Opaque for now.
}
@@ -7,27 +7,6 @@
// (C) 2003 Ximian, Inc. http://www.ximian.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Resources;
-8
View File
@@ -1,11 +1,3 @@
2004-06-24 Raja R Harinath <[email protected]>
* IBM.Data.DB2/Makefile: Disable for 'net_2_0'.
2004-06-23 Gonzalo Paniagua Javier <[email protected]>
* Makefile: enabled Mono.CSharp.Debugger on windows.
2004-06-11 Duncan Mak <[email protected]>
* IBM.Data.DB2/IBM.Data.DB2.dll.sources:
@@ -8,27 +8,6 @@
// (C) 2004 Novell (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.InteropServices;
@@ -8,27 +8,6 @@
// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
internal sealed class Locale {
private Locale ()
@@ -1,12 +1,3 @@
2004-06-21 Atsushi Enomoto <[email protected]>
* RdpPatterns.cs : Fixed ExpandRef() that caused incorrect nest error.
2004-06-17 Atsushi Enomoto <[email protected]>
* RdpPatterns.cs : Quick workaround for infinite loop happening in
some kind of recursive expansion.
2004-03-12 Atsushi Enomoto <[email protected]>
* RdpPatterns.cs : Fixed TextDeriv() to allow whitespace text nodes
@@ -8,27 +8,6 @@
//
// See RELAX NG spec 7.2
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace Commons.Xml.Relaxng.Derivative
{
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Xml;
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
@@ -1404,17 +1383,11 @@ namespace Commons.Xml.Relaxng.Derivative
bool isExpanded;
short expanding; // FIXME: It is totally not required, but there is
// some bugs in simplification and without it it causes infinite loop.
internal override RdpPattern ExpandRef (Hashtable defs)
{
if (!isExpanded) {
isExpanded = true;
if (expanding == 100)
throw new RelaxngException (String.Format ("Invalid recursion was found. Name is {0}", nameClass));
expanding++;
children = children.ExpandRef (defs);
expanding--;
}
return this;
}
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
@@ -7,27 +7,6 @@
// (C)2003 Atsushi Enomoto
// (C)2004 Novell Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
@@ -1,22 +1,3 @@
2004-06-21 Atsushi Enomoto <[email protected]>
* Misc.cs,
RelaxngPattern.cs,
RelaxngReader.cs :
Use XmlResolver (or XmlUrlResolver) directly. XmlResolver was
incorrectly _used_ before null check. Don't create XmlResolver
instance for _every_ pattern object.
* RelaxngPattern.cs : UnresolvedRef.ExpandRef() should return not
try to find target derivative pattern twice. It was the culprit of
infinite loop. Removed dirty switches.
* RelaxngGrammar.cs : code cleanup.
2004-06-17 Atsushi Enomoto <[email protected]>
* Misc.cs, RelaxngGrammar.cs, RelaxngPattern.cs, RelaxngReader.cs :
Added XmlResolver property to fix bug #60334.
Check incrrect recursion check that caused possible infinite loop.
2004-05-31 Atsushi Enomoto <[email protected]>
* Misc.cs : made Util class internal.
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.IO;
@@ -37,18 +16,42 @@ namespace Commons.Xml.Relaxng
{
internal class Util
{
/*
public static string ResolveUri (string baseUri, string href, XmlResolver resolver)
public static string ResolveUri (string baseUri, string href)
{
#if true
Uri uri = null;
if (baseUri != null && baseUri.Length > 0)
uri = new Uri (baseUri);
Uri result = resolver.ResolveUri (uri, href);
Uri result = new XmlUrlResolver ().ResolveUri (uri, href);
if (result.Query.Length > 0 || result.Fragment.Length > 0)
throw new RelaxngException ("Invalid URI format: " + href);
return result.ToString ();
#else
// If baseUri does not exist, then it is only the way.
if (baseUri == String.Empty)
return href;
// If href itself is a uri, then return it directly.
try {
return new Uri (href).ToString ();
} catch (UriFormatException) {
}
// If baseUri is a valid uri, then make relative uri.
try {
return new Uri (
new Uri (baseUri), href).ToString ();
} catch (UriFormatException) {
}
// Otherwise, they might be filesystem path.
if (Path.IsPathRooted (href))
return href;
return Path.Combine (
Path.GetDirectoryName (baseUri), href);
#endif
}
*/
public static string NormalizeWhitespace (string s)
{
@@ -6,27 +6,6 @@
//
// (C)2004 Novell Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Xml;
@@ -6,27 +6,6 @@
//
// (C)2004 Novell Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Xml;
@@ -6,27 +6,6 @@
//
// (C)2004 Novell Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Xml;
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.IO;
@@ -6,27 +6,7 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.IO;
@@ -61,6 +41,7 @@ namespace Commons.Xml.Relaxng
Hashtable includedUris = new Hashtable ();
RelaxngGrammar parentGrammar;
ArrayList includedGrammars;
Hashtable refPatterns = new Hashtable (); // key = RdpPattern of assembledDefs
// only for checkRecursion()
@@ -195,7 +176,13 @@ namespace Commons.Xml.Relaxng
// here we collected element-replaced definitions
foreach (DictionaryEntry entry in elementReplacedDefs)
assembledDefs.Add (entry.Key, entry.Value);
#if REPLACE_IN_ADVANCE
// Well, actual expandRef should be done after checking constraints
// 4.19 (c) expandRef
startPattern = compiledStart.ExpandRef (assembledDefs);
#else
startPattern = compiledStart;
#endif
// 4.20,21 reduce notAllowed and empty.
bool b;
do {
@@ -220,8 +207,10 @@ namespace Commons.Xml.Relaxng
// TODO: 7.3
#if !REPLACE_IN_ADVANCE
// 4.19 (c) expandRef - actual replacement
startPattern = compiledStart.ExpandRef (assembledDefs);
#endif
// return its start pattern.
IsCompiled = true;
@@ -231,8 +220,10 @@ namespace Commons.Xml.Relaxng
private void CheckStartPatternContent (RdpPattern p)
{
switch (p.PatternType) {
#if !REPLACE_IN_ADVANCE
case RelaxngPatternType.Ref:
CheckStartPatternContent (((RdpUnresolvedRef) p).RefPattern);
#endif
break;
case RelaxngPatternType.Element:
break;
@@ -286,8 +277,8 @@ namespace Commons.Xml.Relaxng
checkRecursionDepth = (int) checkedDepth;
// get refPattern
RdpUnresolvedRef pref = p as RdpUnresolvedRef;
RelaxngGrammar target = pref.TargetGrammar;
RdpPattern refPattern = pref.RefPattern;
RelaxngGrammar target = pref.TargetGrammar;//pref.IsParentRef ? parentGrammar : this;
RdpPattern refPattern = pref.RefPattern;//target.assembledDefs [pref.Name] as RdpPattern;
if (refPattern == null)
throw new RelaxngException ("No matching define found for " + pref.Name);
@@ -324,15 +315,21 @@ namespace Commons.Xml.Relaxng
private void CollectGrammars ()
{
// collect ref and parentRef for each define.
includedGrammars = (parentGrammar != null) ?
parentGrammar.includedGrammars : new ArrayList ();
// FIXME: This should be assembledStart.
CheckReferences (compiledStart);
FixupReference ();
this.unresolvedPatterns.Clear ();
// Hashtable ht = assembledDefs.Clone () as Hashtable;
// foreach (string name in ht.Keys) {
foreach (string name in assembledDefs.Keys) {
RdpPattern p = (RdpPattern) assembledDefs [name];
CheckReferences (p);
FixupReference ();
this.unresolvedPatterns.Clear ();
}
// If it is child of any other pattern:
@@ -347,22 +344,15 @@ namespace Commons.Xml.Relaxng
if (al == null)
continue; // Not referenced.
// At this point, parent grammar doesn't
// collect assembledDefs as yet
string uname = GetUniqueName (name, parentGrammar);
parentGrammar.assembledDefs [uname] = assembledDefs [name];
if (parentGrammar.assembledDefs [name] == null)
parentGrammar.assembledDefs [name] =
this.assembledDefs [name];
else
replaceDefines (name, al);
}
}
}
private static string GetUniqueName (string name, RelaxngGrammar grammar)
{
foreach (RelaxngDefine def in grammar.Defines)
if (def.Name == name)
return GetUniqueName (name + '_', grammar);
return name;
}
private void FixupReference ()
{
foreach (RdpUnresolvedRef pref in this.unresolvedPatterns) {
@@ -376,7 +366,6 @@ namespace Commons.Xml.Relaxng
}
al.Add (pref);
}
this.unresolvedPatterns.Clear ();
}
private void replaceDefines (string name, ArrayList al)
@@ -6,27 +6,6 @@
//
// (C)2004 Novell Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using Commons.Xml.Relaxng.XmlSchema;
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
@@ -288,13 +267,10 @@ namespace Commons.Xml.Relaxng
{
grammar.CheckIncludeRecursion (Href);
grammar.IncludedUris.Add (Href, Href);
if (grammar.Resolver == null)
throw new RelaxngException ("To compile 'include' element, XmlResolver is required.");
Uri uri = grammar.Resolver.ResolveUri (BaseUri != String.Empty ? new Uri (BaseUri) : null, Href);
XmlTextReader xtr = null;
string url = Util.ResolveUri (BaseUri, href);
XmlTextReader xtr = new XmlTextReader (url);
RelaxngGrammar g = null;
try {
xtr = new XmlTextReader (uri.AbsoluteUri, (Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream)));
RelaxngReader r = new RelaxngReader (xtr, ns);
r.MoveToContent ();
g = r.ReadPattern () as RelaxngGrammar;
@@ -432,17 +408,8 @@ namespace Commons.Xml.Relaxng
// Private Fields
RdpPattern startRelaxngPattern;
RelaxngDatatypeProvider provider;
XmlResolver resolver;
bool nullResolver;
// Public
public XmlResolver XmlResolver {
set {
nullResolver = value == null;
resolver = value;
}
}
public abstract RelaxngPatternType PatternType { get; }
public RelaxngDatatypeProvider DataProvider {
get {
@@ -460,7 +427,6 @@ namespace Commons.Xml.Relaxng
g = (RelaxngGrammar) this;
else {
g = new RelaxngGrammar ();
g.XmlResolver = this.Resolver;
g.BaseUri = this.BaseUri;
g.LineNumber = this.LineNumber;
g.LinePosition = this.LinePosition;
@@ -478,16 +444,6 @@ namespace Commons.Xml.Relaxng
// Internal
internal XmlResolver Resolver {
get {
if (nullResolver)
return null;
if (resolver == null)
resolver = new XmlUrlResolver ();
return resolver;
}
}
internal abstract void CheckConstraints ();
protected RelaxngPattern ()
@@ -961,7 +917,11 @@ namespace Commons.Xml.Relaxng
}
public override RdpContentType ContentType {
#if REPLACE_IN_ADVANCE
get { throw new InvalidOperationException (); }
#else
get { return RdpContentType.Empty; }
#endif
}
@@ -973,7 +933,10 @@ namespace Commons.Xml.Relaxng
internal override RdpPattern ExpandRef (Hashtable defs)
{
return referencedPattern.ExpandRef (defs);
RdpPattern target = (RdpPattern) defs [this.name];
if (target == null)
throw new RelaxngException ("Target definition " + name + " not found.");
return target.ExpandRef (defs);
}
internal override void MarkReachableDefs ()
@@ -1100,27 +1063,17 @@ namespace Commons.Xml.Relaxng
{
grammar.CheckIncludeRecursion (Href);
grammar.IncludedUris.Add (Href, Href);
if (grammar.Resolver == null)
throw new RelaxngException ("To compile 'include' element, XmlResolver is required.");
Uri uri = grammar.Resolver.ResolveUri (BaseUri != String.Empty ? new Uri (BaseUri) : null, Href);
XmlTextReader xtr = null;
try {
xtr = new XmlTextReader (uri.AbsoluteUri, (Stream) grammar.Resolver.GetEntity (uri, null, typeof (Stream)));
RelaxngReader r = new RelaxngReader (xtr, ns);
r.MoveToContent ();
RelaxngPattern p = r.ReadPattern ();
p.DataProvider = grammar.Provider;
string uri = Util.ResolveUri (this.BaseUri, href);
RelaxngReader r = new RelaxngReader (new XmlTextReader (uri), ns);
r.MoveToContent ();
RelaxngPattern p = r.ReadPattern ();
p.DataProvider = grammar.Provider;
RdpPattern ret = p.Compile (grammar);
RdpPattern ret = p.Compile (grammar);
grammar.IncludedUris.Remove (Href);
return ret;
} finally {
if (xtr != null)
xtr.Close ();
}
grammar.IncludedUris.Remove (Href);
return ret;
}
internal override void CheckConstraints ()
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Collections.Specialized;
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
@@ -54,7 +33,6 @@ namespace Commons.Xml.Relaxng
// fields
Stack nsStack = new Stack ();
Stack datatypeLibraryStack = new Stack ();
XmlResolver resolver = new XmlUrlResolver ();
// ctor
public RelaxngReader (XmlReader reader)
@@ -74,14 +52,6 @@ namespace Commons.Xml.Relaxng
MoveToContent ();
}
public XmlResolver XmlResolver {
set { resolver = value; }
}
internal XmlResolver Resolver {
get { return resolver; }
}
private void FillLocation (RelaxngElementBase el)
{
el.BaseUri = BaseURI;
@@ -462,8 +432,7 @@ namespace Commons.Xml.Relaxng
string href = GetSpaceStrippedAttribute ("href");
if (href == null)
throw new RelaxngException ("Required attribute href was not found.");
XmlResolver res = resolver != null ? resolver : new XmlUrlResolver ();
i.Href = res.ResolveUri (BaseURI != null ? new Uri (BaseURI) : null, href).AbsoluteUri;
i.Href = Util.ResolveUri (BaseURI, href);
if (!IsEmptyElement) {
Read ();
this.readGrammarIncludeContent (i.Starts, i.Defines, i.Divs, null);
@@ -662,8 +631,7 @@ namespace Commons.Xml.Relaxng
string href = GetSpaceStrippedAttribute ("href");
if (href == null)
throw new RelaxngException ("Required attribute href was not found.");
XmlResolver res = resolver != null ? resolver : new XmlUrlResolver ();
r.Href = res.ResolveUri (BaseURI != null ? new Uri (BaseURI) : null, href).AbsoluteUri;
r.Href = Util.ResolveUri (BaseURI, href);
r.NSContext = ContextNamespace;
if (!IsEmptyElement) {
Read ();
@@ -6,27 +6,6 @@
//
// (C)2003 Atsushi Enomoto. "Some rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Xml;
@@ -6,27 +6,6 @@
//
// (C)2004 Novell Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Text;
@@ -1,7 +1,3 @@
2004-06-17 Atsushi Enomoto <[email protected]>
* XmlDefaultReader.cs : don't catch the exception.
2004-02-25 Atsushi Enomoto <[email protected]>
* XmlDefaultReader.cs : Added support for IXmlLineInfo.
@@ -6,27 +6,6 @@
//
// 2003 Atsushi Enomoto "No rights reserved."
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
// Similar to SAX DefaultHandler
@@ -207,7 +186,11 @@ namespace Commons.Xml
public override bool Read ()
{
return Reader.Read ();
try {
return Reader.Read ();
} catch (Exception ex) {
throw ex;
}
}
public override string ReadString ()
@@ -1,8 +1,3 @@
2004-06-17 Atsushi Enomoto <[email protected]>
* relaxngtest.cs : Now we can test all cases (though resulting in
failure). Catch unexpected exception and report them as such.
2004-05-31 Atsushi Enomoto <[email protected]>
* anglia-test-runner.cs : Added support for RELAX NG compact syntax
@@ -20,7 +20,6 @@ Console.WriteLine ("Finished: " + DateTime.Now.ToString ("yyyy-MM-dd HH:mm:ss.ff
foreach (DirectoryInfo di in
new DirectoryInfo (@"relax-ng").GetDirectories ()) {
/*
if (di.Name == "056") // baseURI
continue;
if (di.Name == "102") // invalid URI fragment
@@ -29,7 +28,6 @@ if (di.Name == "208") // infinite loop!!
continue;
if (di.Name == "210") // infinite loop!!
continue;
*/
XmlTextReader xtr = null;
FileInfo fi = new FileInfo (di.FullName + "/i.rng");
@@ -42,9 +40,9 @@ if (di.Name == "210") // infinite loop!!
} catch (RelaxngException ex) {
} catch (XmlException ex) {
} catch (ArgumentNullException ex) {
} catch (UriFormatException ex) {
} catch (Exception ex) {
Console.WriteLine ("Unexpected error type : " + di.Name + " : " + ex.Message);
// } catch (UriFormatException ex) {
// } catch (Exception ex) {
// Console.WriteLine ("Unexpected error type : " + di.Name + " : " + ex.Message);
} finally {
xtr.Close ();
}
@@ -57,9 +55,9 @@ if (di.Name == "210") // infinite loop!!
try {
p = RelaxngPattern.Read (xtr);
p.Compile ();
} catch (Exception ex) {
Console.WriteLine ("Invalidated grammar: " + di.Name + " : " + ex.Message);
continue;
// } catch (Exception ex) {
// Console.WriteLine ("Invalidated grammar: " + di.Name + " : " + ex.Message);
// continue;
} finally {
xtr.Close ();
}
@@ -7,27 +7,6 @@
// (C) 2003 Ximian, Inc. http://www.ximian.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.InteropServices;
-21
View File
@@ -8,27 +8,6 @@
// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
internal sealed class Locale {
private Locale ()
@@ -6,27 +6,6 @@
// (C) 2002 Jackson Harper, All rights reserved.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using System.Text;
@@ -6,27 +6,6 @@
// (C) 2002 Jackson Harper, All rights reserved.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Text;
@@ -6,27 +6,6 @@
// (C) 2002 Jackson Harper, All rights reserved.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace Microsoft.CSharp {
public enum ErrorLevel {
@@ -6,27 +6,6 @@
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace Microsoft.CSharp {
@@ -7,27 +7,6 @@
// (C) 2003 Ximian, Inc. http://www.ximian.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.InteropServices;
@@ -8,27 +8,6 @@
// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
internal sealed class Locale {
private Locale ()
@@ -6,27 +6,6 @@
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
/// <summary>
@@ -7,27 +7,6 @@
// (C) 2003 Martin Willemoes Hansen
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Runtime.InteropServices.CustomMarshalers
{
public class EnumerableToDispatchMarshaler : ICustomMarshaler {
@@ -7,27 +7,6 @@
// (C) 2003 Martin Willemoes Hansen
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Runtime.InteropServices.CustomMarshalers
{
public class EnumeratorToEnumVariantMarshaler : ICustomMarshaler {
@@ -7,27 +7,6 @@
// (C) 2003 Martin Willemoes Hansen
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Runtime.InteropServices.CustomMarshalers
{
public class ExpandoToDispatchExMarshaler : ICustomMarshaler {
@@ -7,27 +7,6 @@
// (C) 2003 Martin Willemoes Hansen
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Runtime.InteropServices.CustomMarshalers
{
public class TypeToTypeInfoMarshaler : ICustomMarshaler {
-2
View File
@@ -122,8 +122,6 @@ public class Manager
e = Instantiate (alias) as Encoding;
}
}
if (e == null)
return null;
// e.g. Neither euc_jp nor shift-jis not allowed (Normalize() badness)
if (orgName.IndexOf ('_') > 0 && e.WebName.IndexOf ('-') > 0)
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Reflection;
using System.Runtime.CompilerServices;
@@ -1,20 +1,18 @@
./Assembly/AssemblyInfo.cs
./IBM.Data.DB2/DB2ClientUtils.cs
./IBM.Data.DB2/DB2CLIWrapper.cs
./IBM.Data.DB2/DB2Command.cs
./IBM.Data.DB2/DB2CommandBuilder.cs
./IBM.Data.DB2/DB2ClientUtils.cs
./IBM.Data.DB2/DB2OpenConnection.cs
./IBM.Data.DB2/DB2Command.cs
./IBM.Data.DB2/DB2Connection.cs
./IBM.Data.DB2/DB2ConnectionPool.cs
./IBM.Data.DB2/DB2ConnectionSettings.cs
./IBM.Data.DB2/DB2Constants.cs
./IBM.Data.DB2/DB2DataAdapter.cs
./IBM.Data.DB2/DB2DataReader.cs
./IBM.Data.DB2/DB2Environment.cs
./IBM.Data.DB2/DB2Error.cs
./IBM.Data.DB2/DB2ErrorCollection.cs
./IBM.Data.DB2/DB2Exception.cs
./IBM.Data.DB2/DB2InfoMessageEventHandler.cs
./IBM.Data.DB2/DB2InfoMessageEventArgs.cs
./IBM.Data.DB2/DB2Parameter.cs
./IBM.Data.DB2/DB2ParameterCollection.cs
./IBM.Data.DB2/DB2RowUpdatedEventArgs.cs
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.Runtime.InteropServices;
@@ -30,134 +9,6 @@ namespace IBM.Data.DB2
/// DB2Prototypes class is a wrapper for the DB2.lib, IBM's Call Level Interface to DB2
/// </summary>
///
#region comented
/*internal class DB2CLIWrapper
{
#if (OS_LINUX)
private const string libname = "db2_36";
#endif
#if (OS_WINDOWS)
private const string libname = "db2cli";
#endif
[DllImport("db2cli", EntryPoint = "SQLAllocHandle")]
internal static extern short SQLAllocHandle(short handleType, IntPtr inputHandle, ref IntPtr outputHandle);
[DllImport("db2cli", EntryPoint = "SQLFreeHandle")]
internal static extern short SQLFreeHandle(short handleType, IntPtr inputHandle);
[DllImport("db2cli", EntryPoint = "SQLGetConnectAttrW")]
internal static extern short SQLGetConnectAttr(IntPtr ConnectionHandle, int Attribute, [Out] IntPtr ValuePtr, int BufferLength, out int StringLengthPtr);
[DllImport("db2cli", EntryPoint = "SQLGetConnectAttrW")]
internal static extern short SQLGetConnectAttr(IntPtr ConnectionHandle, int Attribute, out int Value, int BufferLength, IntPtr Zero);
[DllImport("db2cli", EntryPoint = "SQLFreeStmt")]
internal static extern short SQLFreeStmt(IntPtr StatementHandle, short option);
[DllImport("db2cli", EntryPoint = "SQLConnect")]
internal static extern short SQLConnect(IntPtr sqlHdbc, string serverName, short serverNameLength, string userName, short userNameLength, string authentication, short authenticationLength);
[DllImport("db2cli", EntryPoint = "SQLColAttribute")]
internal static extern short SQLColAttribute(IntPtr StatementHandle, short ColumnNumber, short FieldIdentifier, IntPtr CharacterAttribute, short BufferLength, ref short StringLength, ref int NumericAttribute);
//[DllImport("db2cli", EntryPoint = "SQLGetData")]
// internal static extern short SQLGetData(IntPtr StatementHandle, short ColumnNumber, short TargetType, IntPtr TargetPtr, IntPtr BufferLength, ref IntPtr StrLen_or_Ind);
[DllImport("db2cli", EntryPoint="SQLMoreResults")]
internal static extern short SQLMoreResults(IntPtr StatementHandle);
//[DllImport("db2cli", EntryPoint = "SQLGetData")]
//internal static extern short SQLGetData(IntPtr StatementHandle, short ColumnNumber, short TargetType, IntPtr TargetPtr, IntPtr BufferLength, out int StrLen_or_Ind);
[DllImport("db2cli", EntryPoint = "SQLGetData")]
internal static extern short SQLGetData(IntPtr StatementHandle, short ColumnNumber, short TargetType, IntPtr TargetPtr, int BufferLength, out int StrLen_or_Ind);
//[DllImport("db2cli", EntryPoint = "SQLGetData")]
//internal static extern short SQLGetData(IntPtr StatementHandle, short ColumnNumber, short TargetType, byte[] TargetPtr, IntPtr BufferLength, ref IntPtr StrLen_or_Ind);
[DllImport("db2cli", EntryPoint = "SQLGetData")]
internal static extern short SQLGetData(IntPtr StatementHandle, short ColumnNumber, short TargetType, byte[] TargetPtr, int BufferLength, out int StrLen_or_Ind);
[DllImport("db2cli", EntryPoint = "SQLGetData")]
internal static extern short SQLGetData(IntPtr StatementHandle, short ColumnNumber, short TargetType, [Out] StringBuilder sb, int BufferLength, out int StrLen_or_Ind);
[DllImport("db2cli", EntryPoint = "SQLColAttributeW")]
internal static extern short SQLColAttribute(IntPtr StatementHandle, short ColumnNumber, short FieldIdentifier, [Out] StringBuilder CharacterAttribute, short BufferLength, out short StringLength, out int NumericAttribute);
[DllImport("db2cli", CharSet = CharSet.Auto, EntryPoint = "SQLDisconnect")]
internal static extern short SQLDisconnect(IntPtr sqlHdbc);
[DllImport("db2cli", EntryPoint = "SQLGetDiagRec")]
internal static extern short SQLGetDiagRec( short handleType, IntPtr handle, short recNum, [Out] StringBuilder sqlState, ref IntPtr nativeErrorPtr, [Out] StringBuilder errorMessage, short bufferLength, ref IntPtr shortTextLengthPtr);
[DllImport("db2cli", EntryPoint = "SQLSetConnectAttr")]
internal static extern short SQLSetConnectAttr(IntPtr sqlHdbc, long sqlAttr, [In] IntPtr sqlValuePtr, long sqlValueLength);
[DllImport("db2cli", EntryPoint = "SQLSetStmtAttr")]
internal static extern short SQLSetStmtAttr(IntPtr sqlHstmt, long sqlAttr, [In] IntPtr sqlValuePtr, long sqlValueLength);
[DllImport("db2cli", EntryPoint = "SQLEndTran")]
internal static extern short SQLEndTran (short handleType, IntPtr handle, short fType);
[DllImport("db2cli", EntryPoint = "SQLCancel")]
internal static extern short SQLCancel(IntPtr handle);
[DllImport("db2cli", EntryPoint = "SQLNumResultCols")]
internal static extern short SQLNumResultCols(IntPtr handle, ref int numCols);
[DllImport("db2cli", EntryPoint = "SQLFetch")]
internal static extern short SQLFetch(IntPtr handle);
[DllImport("db2cli", EntryPoint = "SQLRowCount")]
internal static extern short SQLRowCount(IntPtr stmtHandle, ref int numRows);
[DllImport("db2cli", EntryPoint = "SQLExecute")]
internal static extern short SQLExecute(IntPtr handle);
[DllImport ("db2cli", EntryPoint = "SQLExecDirect")]
internal static extern short SQLExecDirect(IntPtr stmtHandle, string stmt, int length);
[DllImport("db2cli", EntryPoint = "SQLDescribeCol")]
internal static extern short SQLDescribeCol(IntPtr stmtHandle, ushort colNum, StringBuilder colName, short colNameMaxLength, IntPtr colNameLength, ref IntPtr dataType, ref IntPtr colSizePtr, ref IntPtr scalePtr, ref IntPtr nullablePtr );
[DllImport("db2cli", EntryPoint = "SQLBindCol")]
internal static extern short SQLBindCol(IntPtr StatementHandle, short ColumnNumber, short TargetType, IntPtr TargetValue, IntPtr BufferLength, ref IntPtr StrLen_or_Ind);
[DllImport("db2cli", EntryPoint = "SQLDriverConnect")]
internal static extern short SQLDriverConnect(IntPtr hdbc, int centered, [In] string inConnectStr, [In] int inStrLength, [Out] StringBuilder outConnectStr, [Out] int outStrCapacity, [Out] IntPtr outStrLengthReturned, [In] int completion);
[DllImport("db2cli", EntryPoint = "SQLPrepare")]
internal static extern short SQLPrepare(IntPtr stmtHandle, string stmt, int length);
[DllImport("db2cli", EntryPoint = "SQLDescribeParam")]
internal static extern short SQLDescribeParam(IntPtr stmtHandle, short paramNumber,ref IntPtr dataType, ref IntPtr paramSize, ref IntPtr decimalDigits, ref IntPtr nullable);
[DllImport("db2cli", EntryPoint = "SQLNumParams")]
internal static extern short SQLNumParams(IntPtr stmtHandle, ref IntPtr numParams);
[DllImport("db2cli")]
internal static extern short SQLBindParameter(IntPtr stmtHandle, ushort paramNumber,
short dataType, short valueType, short paramType, uint colSize, short decDigits,
IntPtr dataBufferPtr, int dataBufferLength, IntPtr StrLen_or_IndPtr);
[DllImport("db2cli")]
internal static extern short SQLBindParameter(IntPtr stmtHandle, ushort paramNumber,
short dataType, short valueType, short paramType, uint colSize, short decDigits,
byte[] dataBufferPtr, int dataBufferLength, IntPtr StrLen_or_IndPtr);
[DllImport("db2cli", EntryPoint = "SQLBindParameter")]
internal static extern short SQLBindParameter(IntPtr stmtHandle, ushort paramNumber,
short dataType, short valueType, short paramType, uint colSize, short decDigits,
ref int dataBufferPtr, int dataBufferLength, IntPtr StrLen_or_IndPtr);
[DllImport("db2cli", EntryPoint = "SQLBindParameter")]
internal static extern short SQLBindParameter(IntPtr stmtHandle, ushort paramNumber,
short dataType, short valueType, short paramType, uint colSize, short decDigits,
ref double dataBufferPtr, int dataBufferLength, IntPtr StrLen_or_IndPtr);
[DllImport("db2cli", EntryPoint = "SQLDescribeParam")]
internal static extern short SQLDescribeParam(IntPtr stmtHandle, short ParameterNumber, IntPtr DataTypePtr, IntPtr ParameterSizePtr, IntPtr DecimalDigitsPtr, IntPtr NullablePtr);
[DllImport("db2cli", EntryPoint = "SQLGetLength")]
internal static extern short SQLGetLength( IntPtr stmtHandle, short locatorCType, int Locator,
IntPtr stringLength, IntPtr indicatorValue);
[DllImport("db2cli", EntryPoint = "SQLGetPosition")]
internal static extern short SQLGetPosition(IntPtr stmtHandle, short locatorCType, int sourceLocator, int searchLocator,
string searchLiteral, int searchLiteralLength, uint fromPosition, IntPtr locatedAt, IntPtr indicatorValue);
[DllImport("db2cli", EntryPoint = "SQLGetPosition")]
internal static extern short SQLBindFileToCol (IntPtr stmtHandle, ushort colNum, string fileName, IntPtr fileNameLength,
IntPtr fileOptions, short maxFileNameLength, IntPtr stringLength, IntPtr indicatorValue);
[DllImport("db2cli", EntryPoint = "SQLGetPosition")]
internal static extern short SQLBindFileToParam (IntPtr stmtHandle, ushort targetType, short dataType, string fileName,
IntPtr fileNameLength, short maxFileNameLength, IntPtr indicatorValue);
}*/
#endregion
internal class DB2CLIWrapper
{
@@ -165,14 +16,16 @@ namespace IBM.Data.DB2
static public short Initialize(ref IntPtr pEnvHandle)
{
string OSVersion = Environment.OSVersion.ToString();
useLibCli = true;
if(OSVersion.Substring(0,4)=="Unix"){
useLibCli = false;
useLibCli = false;
try
{
return DB2CLIWrapper.SQLAllocHandle(DB2Constants.SQL_HANDLE_ENV, IntPtr.Zero, out pEnvHandle);
}
return DB2CLIWrapper.SQLAllocHandle(DB2Constants.SQL_HANDLE_ENV, IntPtr.Zero, out pEnvHandle);
catch {}
useLibCli = false;
return DB2CLIWrapper.SQLAllocHandle(DB2Constants.SQL_HANDLE_ENV, IntPtr.Zero, out pEnvHandle);
}
static public short SQLAllocHandle(short handleType, IntPtr inputHandle, out IntPtr outputHandle)
{
if(useLibCli)
@@ -269,15 +122,6 @@ namespace IBM.Data.DB2
return StaticWrapperCli.SQLSetStmtAttr(sqlHdbc, sqlAttr, sqlValuePtr, sqlValueLength);
return StaticWrapper36.SQLSetStmtAttr(sqlHdbc, sqlAttr, sqlValuePtr, sqlValueLength);
}
//for bulk operations
static public short SQLSetStmtAttr(IntPtr sqlHdbc, int sqlAttr, ushort[] sqlValuePtr, int sqlValueLength)
{
if(useLibCli)
return StaticWrapperCli.SQLSetStmtAttr(sqlHdbc, sqlAttr, sqlValuePtr, sqlValueLength);
return StaticWrapper36.SQLSetStmtAttr(sqlHdbc, sqlAttr, sqlValuePtr, sqlValueLength);
}
static public short SQLEndTran (short handleType, IntPtr handle, short fType)
{
if(useLibCli)
@@ -338,13 +182,6 @@ namespace IBM.Data.DB2
return StaticWrapperCli.SQLBindParameter(stmtHandle, paramNumber, dataType, valueType, paramType, colSize, decDigits, dataBufferPtr, dataBufferLength, StrLen_or_IndPtr);
return StaticWrapper36.SQLBindParameter(stmtHandle, paramNumber, dataType, valueType, paramType, colSize, decDigits, dataBufferPtr, dataBufferLength, StrLen_or_IndPtr);
}
static public short SQLBindParameter(IntPtr stmtHandle, short paramNumber, short dataType, short valueType, short paramType, int colSize, short decDigits, int[] dataBufferPtr, int dataBufferLength, IntPtr StrLen_or_IndPtr)
{
if(useLibCli)
return StaticWrapperCli.SQLBindParameter(stmtHandle, paramNumber, dataType, valueType, paramType, colSize, decDigits, dataBufferPtr, dataBufferLength, StrLen_or_IndPtr);
return StaticWrapper36.SQLBindParameter(stmtHandle, paramNumber, dataType, valueType, paramType, colSize, decDigits, dataBufferPtr, dataBufferLength, StrLen_or_IndPtr);
}
public static short SQLGetInfo(IntPtr sqlHdbc, short fInfoType, [Out] StringBuilder rgbInfoValue, short cbInfoValueMax, out short pcbInfoValue)
{
if(useLibCli)
@@ -401,14 +238,8 @@ namespace IBM.Data.DB2
[DllImport(libname, EntryPoint = "SQLSetConnectAttr")]
public static extern short SQLSetConnectAttr(IntPtr sqlHdbc, int sqlAttr, [In] IntPtr sqlValuePtr, int sqlValueLength);
[DllImport(libname, EntryPoint = "SQLSetStmtAttr")]
public static extern short SQLSetStmtAttr(IntPtr sqlHdbc, int sqlAttr, [In] IntPtr sqlValuePtr, int sqlValueLength);
//For bulk operations
[DllImport(libname, EntryPoint = "SQLSetStmtAttr")]
public static extern short SQLSetStmtAttr(IntPtr sqlHdbc, int sqlAttr, ushort[] sqlValuePtr, int sqlValueLength);
[DllImport(libname, EntryPoint = "SQLEndTran")]
public static extern short SQLEndTran (short handleType, IntPtr handle, short fType);
[DllImport(libname, EntryPoint = "SQLCancel")]
@@ -431,12 +262,6 @@ namespace IBM.Data.DB2
public static extern short SQLBindParameter(IntPtr stmtHandle, short paramNumber,
short dataType, short valueType, short paramType, int colSize, short decDigits,
IntPtr dataBufferPtr, int dataBufferLength, IntPtr StrLen_or_IndPtr);
[DllImport(libname)]
public static extern short SQLBindParameter(IntPtr stmtHandle, short paramNumber,
short dataType, short valueType, short paramType, int colSize, short decDigits,
int[] dataBufferPtr, int dataBufferLength, IntPtr StrLen_or_IndPtr);
[DllImport(libname, EntryPoint = "SQLGetInfoW", CharSet=CharSet.Unicode)]
public static extern short SQLGetInfo(IntPtr sqlHdbc, short fInfoType, [Out] StringBuilder rgbInfoValue, short cbInfoValueMax, out short pcbInfoValue);
}
@@ -453,7 +278,7 @@ namespace IBM.Data.DB2
[DllImport(libname, EntryPoint = "SQLFreeStmt")]
public static extern short SQLFreeStmt(IntPtr StatementHandle, short option);
[DllImport(libname, EntryPoint = "SQLConnect", CharSet=CharSet.Ansi)]
[DllImport(libname, EntryPoint = "SQLConnect")]
public static extern short SQLConnect(IntPtr sqlHdbc, string serverName, short serverNameLength, string userName, short userNameLength, string authentication, short authenticationLength);
[DllImport(libname, EntryPoint = "SQLColAttributeW", CharSet=CharSet.Unicode)]
@@ -489,11 +314,6 @@ namespace IBM.Data.DB2
public static extern short SQLSetConnectAttr(IntPtr sqlHdbc, int sqlAttr, [In] IntPtr sqlValuePtr, int sqlValueLength);
[DllImport(libname, EntryPoint = "SQLSetStmtAttr")]
public static extern short SQLSetStmtAttr(IntPtr sqlHdbc, int sqlAttr, [In] IntPtr sqlValuePtr, int sqlValueLength);
//for bulk operations
[DllImport(libname, EntryPoint = "SQLSetStmtAttr")]
public static extern short SQLSetStmtAttr(IntPtr sqlHdbc, int sqlAttr, ushort[] sqlValuePtr, int sqlValueLength);
[DllImport(libname, EntryPoint = "SQLEndTran")]
public static extern short SQLEndTran (short handleType, IntPtr handle, short fType);
[DllImport(libname, EntryPoint = "SQLCancel")]
@@ -516,13 +336,7 @@ namespace IBM.Data.DB2
public static extern short SQLBindParameter(IntPtr stmtHandle, short paramNumber,
short dataType, short valueType, short paramType, int colSize, short decDigits,
IntPtr dataBufferPtr, int dataBufferLength, IntPtr StrLen_or_IndPtr);
[DllImport(libname)]
public static extern short SQLBindParameter(IntPtr stmtHandle, short paramNumber,
short dataType, short valueType, short paramType, int colSize, short decDigits,
int[] dataBufferPtr, int dataBufferLength, IntPtr StrLen_or_IndPtr);
[DllImport(libname, EntryPoint = "SQLGetInfoW", CharSet=CharSet.Unicode)]
[DllImport(libname, EntryPoint = "SQLGetInfo")]
public static extern short SQLGetInfo(IntPtr sqlHdbc, short fInfoType, [Out] StringBuilder rgbInfoValue, short cbInfoValueMax, out short pcbInfoValue);
}
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace IBM.Data.DB2
+405 -437
View File
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.Runtime.InteropServices;
@@ -31,21 +10,20 @@ namespace IBM.Data.DB2
{
#region Private data members
private WeakReference refDataReader;
private string commandText;
private CommandType commandType = CommandType.Text;
private DB2Connection db2Conn;
private DB2Transaction db2Trans;
private int commandTimeout = 30;
private bool prepared = false;
private bool binded = false;
private IntPtr hwndStmt = IntPtr.Zero; //Our statement handle
private DB2ParameterCollection parameters = new DB2ParameterCollection();
private bool disposed = false;
private bool statementOpen;
private CommandBehavior previousBehavior;
private UpdateRowSource updatedRowSource = UpdateRowSource.Both;
private IntPtr statementParametersMemory;
private WeakReference refDataReader;
private string commandText;
private CommandType commandType = CommandType.Text;
private DB2Connection db2Conn;
private DB2Transaction db2Trans;
private int commandTimeout = 30;
private bool prepared = false;
private IntPtr hwndStmt = IntPtr.Zero; //Our statement handle
private DB2ParameterCollection parameters = new DB2ParameterCollection();
private bool disposed = false;
private bool statementOpen;
private CommandBehavior previousBehavior;
private UpdateRowSource updatedRowSource = UpdateRowSource.Both;
private IntPtr statementParametersMemory;
private int statementParametersMemorySize;
#endregion
@@ -56,113 +34,114 @@ namespace IBM.Data.DB2
{
hwndStmt = IntPtr.Zero;
}
public DB2Command(string commandStr):this()
public DB2Command(string commandStr)
{
commandText = commandStr;
hwndStmt = IntPtr.Zero;
}
public DB2Command(string commandStr, DB2Connection con) : this()
public DB2Command(string commandStr, DB2Connection con) :this()
{
db2Conn = con;
commandText = commandStr;
if(con != null)
{
con.AddCommand(this);
if(con != null)
{
con.AddCommand(this);
}
}
public DB2Command (string commandStr, DB2Connection con, DB2Transaction trans)
{
commandText = commandStr;
db2Conn = con;
db2Trans = trans;
if(con != null)
{
con.AddCommand(this);
commandText = commandStr;
db2Conn = con;
db2Trans = trans;
if(con != null)
{
con.AddCommand(this);
}
}
#endregion
#region Dispose
public new void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected override void Dispose(bool disposing)
{
if(!disposed)
{
if(disposing)
{
ConnectionClosed();
if(db2Conn != null)
{
db2Conn.RemoveCommand(this);
db2Conn = null;
}
}
if(statementParametersMemory != IntPtr.Zero)
{
Marshal.FreeHGlobal(statementParametersMemory);
statementParametersMemory = IntPtr.Zero;
}
}
base.Dispose(disposing);
disposed = true;
}
~DB2Command()
{
Dispose(false);
}
internal void DataReaderClosed()
{
CloseStatementHandle(false);
if((previousBehavior & CommandBehavior.CloseConnection) != 0)
Connection.Close();
refDataReader = null;
}
private void CloseStatementHandle(bool dispose)
{
if(hwndStmt != IntPtr.Zero)
{
if(statementOpen)
{
short sqlRet = DB2CLIWrapper.SQLFreeStmt(hwndStmt, DB2Constants.SQL_CLOSE);
}
if((!prepared && statementOpen) ||
dispose)
{
short sqlRet = DB2CLIWrapper.SQLFreeHandle(DB2Constants.SQL_HANDLE_STMT, hwndStmt);
hwndStmt = IntPtr.Zero;
prepared = false;
}
statementOpen = false;
}
}
internal void ConnectionClosed()
{
DB2DataReader reader = null;
if((refDataReader != null) && refDataReader.IsAlive)
{
reader = (DB2DataReader)refDataReader.Target;
}
if((reader != null) && refDataReader.IsAlive)
{
reader.Dispose();
refDataReader = null;
}
CloseStatementHandle(true);
db2Trans = null;
}
#region Dispose
public new void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected override void Dispose(bool disposing)
{
if(!disposed)
{
if(disposing)
{
ConnectionClosed();
if(db2Conn != null)
{
db2Conn.RemoveCommand(this);
db2Conn = null;
}
}
if(statementParametersMemory != IntPtr.Zero)
{
Marshal.FreeHGlobal(statementParametersMemory);
statementParametersMemory = IntPtr.Zero;
}
}
base.Dispose(disposing);
disposed = true;
}
~DB2Command()
{
Dispose(false);
}
internal void DataReaderClosed()
{
CloseStatementHandle(false);
if((previousBehavior & CommandBehavior.CloseConnection) != 0)
Connection.Close();
refDataReader = null;
}
private void CloseStatementHandle(bool dispose)
{
if(hwndStmt != IntPtr.Zero)
{
if(statementOpen)
{
short sqlRet = DB2CLIWrapper.SQLFreeStmt(hwndStmt, DB2Constants.SQL_CLOSE);
}
if((!prepared && statementOpen) ||
dispose)
{
short sqlRet = DB2CLIWrapper.SQLFreeHandle(DB2Constants.SQL_HANDLE_STMT, hwndStmt);
hwndStmt = IntPtr.Zero;
prepared = false;
}
statementOpen = false;
}
}
internal void ConnectionClosed()
{
DB2DataReader reader = null;
if((refDataReader != null) && refDataReader.IsAlive)
{
reader = (DB2DataReader)refDataReader.Target;
}
if((reader != null) && refDataReader.IsAlive)
{
reader.Dispose();
refDataReader = null;
}
CloseStatementHandle(true);
db2Trans = null;
}
#endregion
#region SelfDescribe property
@@ -206,18 +185,18 @@ namespace IBM.Data.DB2
///
/// The Timeout property states how long we wait for results to return
///
public int CommandTimeout
{
get
{
return commandTimeout;
}
set
{
commandTimeout = value;
if(hwndStmt != IntPtr.Zero)
SetStatementTimeout();
}
public int CommandTimeout
{
get
{
return commandTimeout;
}
set
{
commandTimeout = value;
if(hwndStmt != IntPtr.Zero)
SetStatementTimeout();
}
}
#endregion
@@ -252,24 +231,24 @@ namespace IBM.Data.DB2
}
}
public DB2Connection Connection
{
get
{
return db2Conn;
}
set
{
if(db2Conn != null)
{
db2Conn.RemoveCommand(this);
}
db2Conn = value;
if(db2Conn != null)
{
db2Conn.AddCommand(this);
}
}
public DB2Connection Connection
{
get
{
return db2Conn;
}
set
{
if(db2Conn != null)
{
db2Conn.RemoveCommand(this);
}
db2Conn = value;
if(db2Conn != null)
{
db2Conn.AddCommand(this);
}
}
}
#endregion
@@ -309,25 +288,25 @@ namespace IBM.Data.DB2
}
}
public DB2Transaction Transaction
{
get
{
return db2Trans;
}
set
{
db2Trans = value;
}
public DB2Transaction Transaction
{
get
{
return db2Trans;
}
set
{
db2Trans = value;
}
}
#endregion
#region UpdatedRowSource property
public UpdateRowSource UpdatedRowSource
{
get { return updatedRowSource; }
set { updatedRowSource = value; }
public UpdateRowSource UpdatedRowSource
{
get { return updatedRowSource; }
set { updatedRowSource = value; }
}
#endregion
@@ -346,23 +325,23 @@ namespace IBM.Data.DB2
#region AllocateStatement function
internal void AllocateStatement(string location)
{
if (db2Conn.DBHandle.ToInt32() == 0) return;
short sqlRet;
sqlRet = DB2CLIWrapper.SQLAllocHandle(DB2Constants.SQL_HANDLE_STMT, db2Conn.DBHandle, out hwndStmt);
if ((sqlRet != DB2Constants.SQL_SUCCESS) && (sqlRet != DB2Constants.SQL_SUCCESS_WITH_INFO))
throw new DB2Exception(DB2Constants.SQL_HANDLE_DBC, db2Conn.DBHandle, location +": Unable to allocate statement handle.");
parameters.HwndStmt = hwndStmt;
SetStatementTimeout();
internal void AllocateStatement(string location)
{
if (db2Conn.DBHandle.ToInt32() == 0) return;
short sqlRet;
sqlRet = DB2CLIWrapper.SQLAllocHandle(DB2Constants.SQL_HANDLE_STMT, db2Conn.DBHandle, out hwndStmt);
if ((sqlRet != DB2Constants.SQL_SUCCESS) && (sqlRet != DB2Constants.SQL_SUCCESS_WITH_INFO))
throw new DB2Exception(DB2Constants.SQL_HANDLE_DBC, db2Conn.DBHandle, location +": Unable to allocate statement handle.");
parameters.HwndStmt = hwndStmt;
SetStatementTimeout();
}
private void SetStatementTimeout()
{
short sqlRet = DB2CLIWrapper.SQLSetStmtAttr(hwndStmt, DB2Constants.SQL_ATTR_QUERY_TIMEOUT, new IntPtr(commandTimeout), 0);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "Set statement timeout.", db2Conn);
private void SetStatementTimeout()
{
short sqlRet = DB2CLIWrapper.SQLSetStmtAttr(hwndStmt, DB2Constants.SQL_ATTR_QUERY_TIMEOUT, new IntPtr(commandTimeout), 0);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "Set statement timeout.", db2Conn);
}
#endregion
@@ -370,13 +349,13 @@ namespace IBM.Data.DB2
/// <summary>
/// Attempt to cancel an executing command
/// </summary>
public void Cancel()
{
if(hwndStmt == IntPtr.Zero)
{
throw new InvalidOperationException("Nothing to Cancel.");
}
DB2CLIWrapper.SQLCancel(hwndStmt);
public void Cancel()
{
if(hwndStmt == IntPtr.Zero)
{
throw new InvalidOperationException("Nothing to Cancel.");
}
DB2CLIWrapper.SQLCancel(hwndStmt);
}
#endregion
@@ -392,135 +371,161 @@ namespace IBM.Data.DB2
#region ExecuteNonQuery
public int ExecuteNonQuery()
{
ExecuteNonQueryInternal(CommandBehavior.Default);
int numRows;
//How many rows affected. numRows will be -1 if we aren't dealing with an Insert, Delete or Update, or if the statement did not execute successfully
short sqlRet = DB2CLIWrapper.SQLRowCount(hwndStmt, out numRows);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLExecDirect error.", db2Conn);
do
{
sqlRet = DB2CLIWrapper.SQLMoreResults(this.hwndStmt);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "DB2ClientDataReader - SQLMoreResults", db2Conn);
} while(sqlRet != DB2Constants.SQL_NO_DATA_FOUND);
CloseStatementHandle(false);
return numRows;
}
public void ExecuteNonQueryInternal(CommandBehavior behavior)
{
short sqlRet;
if(prepared && binded)
{
sqlRet = DB2CLIWrapper.SQLExecute(hwndStmt);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLExecute error.", db2Conn);
return;
}
if((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
throw new InvalidOperationException("Prepare needs an open connection");
if((refDataReader != null) &&
(refDataReader.IsAlive))
throw new InvalidOperationException("There is already an open DataReader associated with this Connection which must be closed first.");
DB2Transaction connectionTransaction = null;
if(db2Conn.WeakRefTransaction != null)
connectionTransaction = (DB2Transaction)db2Conn.WeakRefTransaction.Target;
if(!Object.ReferenceEquals(connectionTransaction, Transaction))
{
if(Transaction == null)
throw new InvalidOperationException("A transaction was started in the connection, but the command doesn't specify a transaction");
throw new InvalidOperationException("The transaction specified at the connection doesn't belong to the connection");
}
if (hwndStmt == IntPtr.Zero)
{
AllocateStatement("InternalExecuteNonQuery");
previousBehavior = 0;
}
if(previousBehavior != behavior)
{
if(((previousBehavior ^ behavior) & CommandBehavior.SchemaOnly) != 0)
{
sqlRet = DB2CLIWrapper.SQLSetStmtAttr(hwndStmt, DB2Constants.SQL_ATTR_DEFERRED_PREPARE,
new IntPtr((behavior & CommandBehavior.SchemaOnly) != 0 ? 0 : 1), 0);
// TODO: don't check. what if it is not supported???
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "Defered prepare.", db2Conn);
previousBehavior = (previousBehavior & ~CommandBehavior.SchemaOnly) | (behavior & CommandBehavior.SchemaOnly);
}
if(((previousBehavior ^ behavior) & CommandBehavior.SingleRow) != 0)
{
sqlRet = DB2CLIWrapper.SQLSetStmtAttr(hwndStmt, DB2Constants.SQL_ATTR_MAX_ROWS,
new IntPtr((behavior & CommandBehavior.SingleRow) == 0 ? 0 : 1), 0);
// TODO: don't check. what if it is not supported???
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "Set max rows", db2Conn);
previousBehavior = (previousBehavior & ~CommandBehavior.SingleRow) | (behavior & CommandBehavior.SingleRow);
}
previousBehavior = behavior;
}
if((Transaction == null) &&
!db2Conn.openConnection.autoCommit)
{
sqlRet = DB2CLIWrapper.SQLSetConnectAttr(db2Conn.DBHandle, DB2Constants.SQL_ATTR_AUTOCOMMIT, new IntPtr(DB2Constants.SQL_AUTOCOMMIT_ON), 0);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, db2Conn.DBHandle, "Error setting AUTOCOMMIT ON in transaction CTOR.", db2Conn);
db2Conn.openConnection.autoCommit = true;
sqlRet = DB2CLIWrapper.SQLSetConnectAttr(db2Conn.DBHandle, DB2Constants.SQL_ATTR_TXN_ISOLATION, new IntPtr(DB2Constants.SQL_TXN_READ_COMMITTED), 0);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, db2Conn.DBHandle, "Error setting isolation level.", db2Conn);
}
if ((commandText == null) ||(commandText.Length == 0))
throw new InvalidOperationException("Command string is empty");
if(CommandType.StoredProcedure == commandType && !commandText.StartsWith("CALL "))
commandText = "CALL " + commandText + " ()";
if((behavior & CommandBehavior.SchemaOnly) != 0)
{
if(!prepared)
{
Prepare();
}
}
else
{
if(statementParametersMemory != IntPtr.Zero)
{
Marshal.FreeHGlobal(statementParametersMemory);
statementParametersMemory = IntPtr.Zero;
}
BindParams();
if (prepared)
{
sqlRet = DB2CLIWrapper.SQLExecute(hwndStmt);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLExecute error.", db2Conn);
}
else
{
sqlRet = DB2CLIWrapper.SQLExecDirect(hwndStmt, commandText, commandText.Length);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLExecDirect error.", db2Conn);
}
statementOpen = true;
parameters.GetOutValues();
if(statementParametersMemory != IntPtr.Zero)
{
Marshal.FreeHGlobal(statementParametersMemory);
statementParametersMemory = IntPtr.Zero;
}
}
public int ExecuteNonQuery()
{
ExecuteNonQueryInternal(CommandBehavior.Default);
int numRows;
//How many rows affected. numRows will be -1 if we aren't dealing with an Insert, Delete or Update, or if the statement did not execute successfully
short sqlRet = DB2CLIWrapper.SQLRowCount(hwndStmt, out numRows);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLExecDirect error.", db2Conn);
do
{
sqlRet = DB2CLIWrapper.SQLMoreResults(this.hwndStmt);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "DB2ClientDataReader - SQLMoreResults", db2Conn);
} while(sqlRet != DB2Constants.SQL_NO_DATA_FOUND);
CloseStatementHandle(false);
return numRows;
}
public void ExecuteNonQueryInternal(CommandBehavior behavior)
{
short sqlRet;
if((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
throw new InvalidOperationException("Prepare needs an open connection");
if((refDataReader != null) &&
(refDataReader.IsAlive))
throw new InvalidOperationException("There is already an open DataReader associated with this Connection which must be closed first.");
DB2Transaction connectionTransaction = null;
if(db2Conn.WeakRefTransaction != null)
connectionTransaction = (DB2Transaction)db2Conn.WeakRefTransaction.Target;
if(!Object.ReferenceEquals(connectionTransaction, Transaction))
{
if(Transaction == null)
throw new InvalidOperationException("A transaction was started in the connection, but the command doesn't specify a transaction");
throw new InvalidOperationException("The transaction specified at the connection doesn't belong to the connection");
}
if (hwndStmt == IntPtr.Zero)
{
AllocateStatement("InternalExecuteNonQuery");
previousBehavior = 0;
}
if(previousBehavior != behavior)
{
if(((previousBehavior ^ behavior) & CommandBehavior.SchemaOnly) != 0)
{
sqlRet = DB2CLIWrapper.SQLSetStmtAttr(hwndStmt, DB2Constants.SQL_ATTR_DEFERRED_PREPARE,
new IntPtr((behavior & CommandBehavior.SchemaOnly) != 0 ? 0 : 1), 0);
// TODO: don't check. what if it is not supported???
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "Defered prepare.", db2Conn);
previousBehavior = (previousBehavior & ~CommandBehavior.SchemaOnly) | (behavior & CommandBehavior.SchemaOnly);
}
if(((previousBehavior ^ behavior) & CommandBehavior.SingleRow) != 0)
{
sqlRet = DB2CLIWrapper.SQLSetStmtAttr(hwndStmt, DB2Constants.SQL_ATTR_MAX_ROWS,
new IntPtr((behavior & CommandBehavior.SingleRow) == 0 ? 0 : 1), 0);
// TODO: don't check. what if it is not supported???
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "Set max rows", db2Conn);
previousBehavior = (previousBehavior & ~CommandBehavior.SingleRow) | (behavior & CommandBehavior.SingleRow);
}
previousBehavior = behavior;
}
if((Transaction == null) &&
!db2Conn.openConnection.autoCommit)
{
sqlRet = DB2CLIWrapper.SQLSetConnectAttr(db2Conn.DBHandle, DB2Constants.SQL_ATTR_AUTOCOMMIT, new IntPtr(DB2Constants.SQL_AUTOCOMMIT_ON), 0);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, db2Conn.DBHandle, "Error setting AUTOCOMMIT ON in transaction CTOR.", db2Conn);
db2Conn.openConnection.autoCommit = true;
sqlRet = DB2CLIWrapper.SQLSetConnectAttr(db2Conn.DBHandle, DB2Constants.SQL_ATTR_TXN_ISOLATION, new IntPtr(DB2Constants.SQL_TXN_READ_COMMITTED), 0);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, db2Conn.DBHandle, "Error setting isolation level.", db2Conn);
}
if ((commandText == null) ||(commandText.Length == 0))
throw new InvalidOperationException("Command string is empty");
if(CommandType.StoredProcedure == commandType && !commandText.StartsWith("CALL "))
commandText = "CALL " + commandText;
// if(!prepared)
// {
// Prepare();
// }
if((behavior & CommandBehavior.SchemaOnly) != 0)
{
if(!prepared)
{
Prepare();
}
}
else
{
if(statementParametersMemory != IntPtr.Zero)
{
Marshal.FreeHGlobal(statementParametersMemory);
statementParametersMemory = IntPtr.Zero;
}
if(parameters.Count > 0)
{
statementParametersMemorySize = 0;
for(int i = 0; i < parameters.Count; i++)
{
DB2Parameter param = parameters[i];
param.CalculateRequiredmemory();
statementParametersMemorySize += param.requiredMemory + 8;
}
statementParametersMemory = Marshal.AllocHGlobal(statementParametersMemorySize);
int offset = 0;
for(int i = 0; i < parameters.Count; i++)
{
DB2Parameter param = parameters[i];
//param.internalBuffer = new IntPtr(statementParametersMemory.ToInt64() + offset);
int memSize = statementParametersMemory.ToInt32() + offset;
param.internalBuffer = Marshal.AllocHGlobal(memSize);
offset += param.requiredMemory;
//param.internalLengthBuffer = new IntPtr(statementParametersMemory.ToInt32() + offset);
param.internalLengthBuffer = Marshal.AllocHGlobal(4);
offset += 8;
sqlRet = param.Bind(this.hwndStmt, (short)(i + 1));
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "Error binding parameter in DB2Command: ", db2Conn);
}
}
if (prepared)
{
sqlRet = DB2CLIWrapper.SQLExecute(hwndStmt);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLExecute error.", db2Conn);
}
else
{
sqlRet = DB2CLIWrapper.SQLExecDirect(hwndStmt, commandText, commandText.Length);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLExecDirect error.", db2Conn);
}
statementOpen = true;
parameters.GetOutValues();
if(statementParametersMemory != IntPtr.Zero)
{
Marshal.FreeHGlobal(statementParametersMemory);
statementParametersMemory = IntPtr.Zero;
}
}
}
#endregion
@@ -528,34 +533,34 @@ namespace IBM.Data.DB2
///
///ExecuteReader
///
IDataReader IDbCommand.ExecuteReader()
{
return ExecuteReader(CommandBehavior.Default);
}
IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior)
{
return ExecuteReader(behavior);
}
public DB2DataReader ExecuteReader()
{
return ExecuteReader(CommandBehavior.Default);
}
public DB2DataReader ExecuteReader(CommandBehavior behavior)
{
if((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
throw new InvalidOperationException("Prepare needs an open connection");
DB2DataReader reader;
ExecuteNonQueryInternal(behavior);
reader = new DB2DataReader(db2Conn, this, behavior);
refDataReader = new WeakReference(reader);
return reader;
IDataReader IDbCommand.ExecuteReader()
{
return ExecuteReader(CommandBehavior.Default);
}
IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior)
{
return ExecuteReader(behavior);
}
public DB2DataReader ExecuteReader()
{
return ExecuteReader(CommandBehavior.Default);
}
public DB2DataReader ExecuteReader(CommandBehavior behavior)
{
if((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
throw new InvalidOperationException("Prepare needs an open connection");
DB2DataReader reader;
ExecuteNonQueryInternal(behavior);
reader = new DB2DataReader(db2Conn, this, behavior);
refDataReader = new WeakReference(reader);
return reader;
}
#endregion
@@ -563,102 +568,65 @@ namespace IBM.Data.DB2
///
/// ExecuteScalar
///
public object ExecuteScalar()
{
if((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
throw new InvalidOperationException("Prepare needs an open connection");
using(DB2DataReader reader = ExecuteReader(CommandBehavior.SingleResult | CommandBehavior.SingleRow))
{
if(reader.Read() && (reader.FieldCount > 0))
{
return reader[0];
}
}
return null;
public object ExecuteScalar()
{
if((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
throw new InvalidOperationException("Prepare needs an open connection");
using(DB2DataReader reader = ExecuteReader(CommandBehavior.SingleResult | CommandBehavior.SingleRow))
{
if(reader.Read() && (reader.FieldCount > 0))
{
return reader[0];
}
}
return null;
}
#endregion
#region Prepare ()
public void Prepare ()
{
if((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
throw new InvalidOperationException("Prepare needs an open connection");
CloseStatementHandle(false);
if (hwndStmt == IntPtr.Zero)
{
AllocateStatement("InternalExecuteNonQuery");
}
short sqlRet = 0;
IntPtr numParams = IntPtr.Zero;
sqlRet = DB2CLIWrapper.SQLPrepare(hwndStmt, commandText, commandText.Length);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLPrepare error.", db2Conn);
statementOpen = true;
prepared=true;
public void Prepare ()
{
if((db2Conn == null) || (db2Conn.State != ConnectionState.Open))
throw new InvalidOperationException("Prepare needs an open connection");
CloseStatementHandle(false);
if (hwndStmt == IntPtr.Zero)
{
AllocateStatement("InternalExecuteNonQuery");
}
short sqlRet = 0;
IntPtr numParams = IntPtr.Zero;
sqlRet = DB2CLIWrapper.SQLPrepare(hwndStmt, commandText, commandText.Length);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "SQLPrepare error.", db2Conn);
statementOpen = true;
prepared=true;
}
#endregion
private string AddCallParam( string _cmString)
#region ICloneable Members
object ICloneable.Clone()
{
if(_cmString.IndexOf("()") != -1)
{
return _cmString.Replace("()","(?)");
}
return _cmString.Replace(")", ",?)");
DB2Command clone = new DB2Command();
clone.Connection = Connection;
clone.commandText = commandText;
clone.commandType = commandType;
clone.Transaction = db2Trans;
clone.commandTimeout = commandTimeout;
clone.updatedRowSource = updatedRowSource;
clone.parameters = new DB2ParameterCollection();
for(int i = 0; i < parameters.Count; i++)
clone.Parameters.Add(((ICloneable)parameters[i]).Clone());
return clone;
}
private void BindParams()
{
if(parameters.Count > 0)
{
statementParametersMemorySize = 0;
int offset = 0;
short sqlRet;
for(int i = 0; i < parameters.Count; i++)
{
if(commandType == CommandType.StoredProcedure)
{
commandText = AddCallParam(commandText);
}
DB2Parameter param = parameters[i];
param.CalculateRequiredmemory();
statementParametersMemorySize += param.requiredMemory + 8;
param.internalBuffer = Marshal.AllocHGlobal(param.requiredMemory);
offset += param.requiredMemory;
param.internalLengthBuffer = Marshal.AllocHGlobal(4);
Marshal.WriteInt32(param.internalLengthBuffer, param.requiredMemory);
sqlRet = param.Bind(this.hwndStmt, (short)(i + 1));
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_STMT, hwndStmt, "Error binding parameter in DB2Command: ", db2Conn);
}
binded = true;
}
}
#region ICloneable Members
object ICloneable.Clone()
{
DB2Command clone = new DB2Command();
clone.Connection = Connection;
clone.commandText = commandText;
clone.commandType = commandType;
clone.Transaction = db2Trans;
clone.commandTimeout = commandTimeout;
clone.updatedRowSource = updatedRowSource;
clone.parameters = new DB2ParameterCollection();
for(int i = 0; i < parameters.Count; i++)
clone.Parameters.Add(((ICloneable)parameters[i]).Clone());
return clone;
}
#endregion
}
}
@@ -1,291 +0,0 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.ComponentModel;
namespace IBM.Data.DB2
{
public sealed class DB2CommandBuilder : Component
{
bool disposed = false;
private DB2DataAdapter dataAdapter;
private DB2Command insertCommand;
private DB2Command updateCommand;
private DB2Command deleteCommand;
private string tableName = String.Empty;
public DB2CommandBuilder ()
{}
public DB2CommandBuilder (DB2DataAdapter adapter)
{
DataAdapter = adapter;
}
public DB2DataAdapter DataAdapter
{
get
{
return dataAdapter;
}
set
{
if (dataAdapter != null)
{
throw new Exception ("DataAdapter is already set");
}
dataAdapter = value;
string select_text = dataAdapter.SelectCommand.CommandText;
string[] words = select_text.Split(new char [] {' '});
bool from_found = false;
for (int i = 0; i < words.Length; i++)
{
if (from_found && (words[i] != String.Empty))
{
tableName = words[i];
break;
}
if (words[i].ToLower() == "from")
{
from_found = true;
}
}
}
}
public string QuotePrefix
{
get
{
return "";
}
set
{ }
}
public string QuoteSuffix
{
get
{
return "";
}
set
{ }
}
public static void DeriveParameters (DB2Command command)
{}
public DB2Command GetInsertCommand ()
{
DataTable dt = GetSchema();
if (insertCommand == null)
{
string fields = "";
string values = "";
for (int i = 0; i < dt.Rows.Count; i++)
{
//DataColumn column = dt.Columns[i];
DataRow dr = dt.Rows[i];
DataColumn column = new DataColumn((string)dr["ColumnName"], DB2TypeConverter.GetManagedType((int)dr["ProviderType"]));
if (fields.Length != 0 && !((bool)dr["IsAutoIncrement"]))
{
fields += ", ";
values += ", ";
}
if(!((bool)dr["IsAutoIncrement"]))
{
fields += column.ColumnName;
//values += ":v_" + column.ColumnName;
values += "?";
}
}
if (tableName == String.Empty)
{
tableName = dt.TableName;
}
DB2Command cmdaux = new DB2Command("insert into " + tableName + " (" + fields + ") values (" + values + ")", dataAdapter.SelectCommand.Connection);
for (int i = 0;i < dt.Rows.Count;i++)
{
//DataColumn column = dt.Columns[i];
DataRow dr = dt.Rows[i];
DataColumn column = new DataColumn((string)dr["ColumnName"], DB2TypeConverter.GetManagedType((int)dr["ProviderType"]));
if (!((bool)dr["IsAutoIncrement"]))
{
DB2Parameter aux = new DB2Parameter("v_" + column.ColumnName, column.DataType);
aux.Direction = ParameterDirection.Input;
aux.SourceColumn = column.ColumnName;
cmdaux.Parameters.Add(aux);
}
}
insertCommand = cmdaux;
}
return insertCommand;
}
public DB2Command GetUpdateCommand ()
{
DataTable dt = GetSchema();
if (updateCommand == null)
{
string sets = "";
string wheres = "";
for (int i = 0; i < dt.Rows.Count; i++)
{
if (sets.Length != 0 && !((bool)dt.Rows[i]["IsAutoIncrement"]))
{
sets += ", ";
}
if (i != 0)
{
wheres += " and ";
}
DataRow dr = dt.Rows[i];
DataColumn column = new DataColumn((string)dr["ColumnName"], DB2TypeConverter.GetManagedType((int)dr["ProviderType"]));
if(!((bool)dr["IsAutoIncrement"])){sets += String.Format("{0} = ? ", column.ColumnName);}
wheres += String.Format("(({0} is null) or ({0} = ?))", column.ColumnName);
}
if (tableName == String.Empty)
{
tableName = (string)dt.Rows[0]["BaseTableName"];
}
DB2Command cmdaux = new DB2Command("update " + tableName + " set " + sets + " where ( " + wheres + " )", dataAdapter.SelectCommand.Connection);
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
DataColumn column = new DataColumn((string)dr["ColumnName"], DB2TypeConverter.GetManagedType((int)dr["ProviderType"]));
if (!((bool)dr["IsAutoIncrement"]))
{
DB2Parameter aux = new DB2Parameter("s_" + column.ColumnName, column.DataType);
aux.Direction = ParameterDirection.Input;
aux.SourceColumn = column.ColumnName;
aux.SourceVersion = DataRowVersion.Current;
cmdaux.Parameters.Add(aux);
}
}
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
DataColumn column = new DataColumn((string)dr["ColumnName"], DB2TypeConverter.GetManagedType((int)dr["ProviderType"]));
DB2Parameter aux = new DB2Parameter("w_" + column.ColumnName, column.DataType);
aux.Direction = ParameterDirection.Input;
aux.SourceColumn = column.ColumnName;
aux.SourceVersion = DataRowVersion.Original;
cmdaux.Parameters.Add(aux);
}
updateCommand = cmdaux;
}
return updateCommand;
}
public DB2Command GetDeleteCommand ()
{
DataTable dt = GetSchema();
if (deleteCommand == null)
{
string wheres = "";
for (int i = 0; i < dt.Rows.Count; i++)
{
//DataColumn column = row.Table.Columns[i];
DataRow dr = dt.Rows[i];
DataColumn column = new DataColumn((string)dr["ColumnName"], DB2TypeConverter.GetManagedType((int)dr["ProviderType"]));
if (i != 0)
{
wheres += " and ";
}
//wheres += String.Format("(({0} is null) or ({0} = v_{0}))", column.ColumnName);
wheres += String.Format("(({0} is null) or ({0} = ?))", column.ColumnName);
}
if (tableName == String.Empty)
{
tableName = (string)dt.Rows[0]["BaseTableName"];
}
DB2Command cmdaux = new DB2Command("delete from " + tableName + " where ( " + wheres + " )", dataAdapter.SelectCommand.Connection);
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
DataColumn column = new DataColumn((string)dr["ColumnName"], DB2TypeConverter.GetManagedType((int)dr["ProviderType"]));
DB2Parameter aux = new DB2Parameter("v_" + column.ColumnName, column.DataType);
aux.Direction = ParameterDirection.Input;
aux.SourceColumn = column.ColumnName;
aux.SourceVersion = DataRowVersion.Original;
cmdaux.Parameters.Add(aux);
}
deleteCommand = cmdaux;
}
return deleteCommand;
}
public void RefreshSchema ()
{
insertCommand = null;
updateCommand = null;
deleteCommand = null;
}
private DataTable GetSchema()
{
dataAdapter.SelectCommand.Connection.Open();
DB2Command cmd = new DB2Command(dataAdapter.SelectCommand.CommandText, dataAdapter.SelectCommand.Connection);
DB2DataReader fake = cmd.ExecuteReader(CommandBehavior.KeyInfo);
DataTable dt = fake.GetSchemaTable();
fake.Close();
dataAdapter.SelectCommand.Connection.Close();
return dt;
}
protected override void Dispose (bool disposing)
{
if (!disposed)
{
if (disposing)
{
if (insertCommand != null)
{
insertCommand.Dispose();
}
if (updateCommand != null)
{
updateCommand.Dispose();
}
if (deleteCommand != null)
{
deleteCommand.Dispose();
}
}
}
}
}
}
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Collections.Specialized;
@@ -30,7 +9,7 @@ namespace IBM.Data.DB2
{
public class DB2Connection : System.ComponentModel.Component, IDbConnection, ICloneable
public sealed class DB2Connection : System.ComponentModel.Component, IDbConnection, ICloneable
{
#region private data members
@@ -46,9 +25,7 @@ namespace IBM.Data.DB2
#region Constructors
public DB2Connection()
{
connectionTimeout = 15;
{
}
public DB2Connection(string conString)
@@ -107,7 +84,6 @@ namespace IBM.Data.DB2
{
get
{
//if ((long)dbHandle.ToPointer() == DB2Constants.SQL_NULL_HANDLE)
if (openConnection == null)
return ConnectionState.Closed;
return ConnectionState.Open;
@@ -270,7 +246,6 @@ namespace IBM.Data.DB2
#endregion
#region Open
unsafe public void Open()
{
if(disposed)
@@ -1,214 +1,194 @@
using System;
using System.Collections;
using System.Text;
using System.Threading;
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Text;
using System.Threading;
namespace IBM.Data.DB2
{
/// <summary>
///
/// </summary>
/// <remarks>One connection pool per connectionstring</remarks>
internal sealed class DB2ConnectionPool
{
private ArrayList openFreeConnections; // list of pooled connections sorted by age. First connection is present at index 'connectionsUsableOffset'
private Queue openFreeMinimalAllocated;
private int connectionsOpen; // total number of connections open (in pool, an in use by application)
private int connectionsInUse; // total connection in use by application
private int connectionsUsableOffset; // Offset to the first pooled connection in 'openFreeConnections'
private Timer timer;
public string databaseProductName;
public string databaseVersion;
public int majorVersion;
public int minorVersion;
private DB2ConnectionSettings connectionSettings;
public DB2ConnectionPool(DB2ConnectionSettings connectionSettings)
{
this.connectionSettings = connectionSettings;
openFreeConnections = new ArrayList();
}
public DB2ConnectionSettings ConnectionSettings
{
get { return connectionSettings; }
}
public DB2OpenConnection GetOpenConnection(DB2Connection db2Conn)
{
DB2OpenConnection connection = null;
lock(openFreeConnections.SyncRoot)
{
if((connectionSettings.ConnectionPoolSizeMax > 0) &&
(connectionsOpen >= connectionSettings.ConnectionPoolSizeMax))
{
throw new ArgumentException("Maximum connections reached for connectionstring");
}
while(connectionsOpen > connectionsInUse)
{
connection = (DB2OpenConnection)openFreeConnections[openFreeConnections.Count - 1];
openFreeConnections.RemoveAt(openFreeConnections.Count - 1);
// check if connection is dead
int isDead;
short sqlRet = DB2CLIWrapper.SQLGetConnectAttr(connection.DBHandle, DB2Constants.SQL_ATTR_CONNECTION_DEAD, out isDead, 0, IntPtr.Zero);
if(((sqlRet == DB2Constants.SQL_SUCCESS_WITH_INFO) || (sqlRet == DB2Constants.SQL_SUCCESS)) &&
(isDead == DB2Constants.SQL_CD_FALSE))
{
connectionsInUse++;
break;
}
else
{
connectionsOpen--;
connection.Dispose();
connection = null;
}
}
if(connectionsOpen == connectionsInUse)
{
if(timer != null)
{
timer.Dispose();
timer = null;
}
}
}
if(connection == null)
{
openFreeConnections.Clear();
connectionsUsableOffset = 0;
connection = new DB2OpenConnection(connectionSettings, db2Conn);
connectionsOpen++;
connectionsInUse++;
}
return connection;
}
private void DisposeTimedoutConnections(object state)
{
lock(openFreeConnections.SyncRoot)
{
if(timer != null)
{
TimeSpan timeToDispose = TimeSpan.Zero;
DB2OpenConnection connection;
while(connectionsOpen > connectionsInUse)
{
connection = (DB2OpenConnection)openFreeConnections[connectionsUsableOffset];
timeToDispose = connection.poolDisposalTime.Subtract(DateTime.Now);
if((timeToDispose.Ticks < 0) || // time to die
(timeToDispose > connectionSettings.ConnectionLifeTime)) // messing with system clock
{
connection.Dispose();
openFreeConnections[connectionsUsableOffset] = null;
connectionsOpen--;
connectionsUsableOffset++;
}
else
{
break;
}
}
if(connectionsOpen > connectionsInUse)
{
connection = (DB2OpenConnection)openFreeConnections[connectionsUsableOffset];
timer.Change(timeToDispose, new TimeSpan(-1));
}
else
{
timer.Dispose();
timer = null;
}
}
if((connectionsUsableOffset > (openFreeConnections.Capacity / 2)) &&
(connectionsOpen > connectionsInUse))
{
openFreeConnections.RemoveRange(0, connectionsUsableOffset); // cleanup once in a while
connectionsUsableOffset = 0;
}
}
}
public void AddToFreeConnections(DB2OpenConnection connection)
{
lock(openFreeConnections.SyncRoot)
{
connection.poolDisposalTime = DateTime.Now.Add(connectionSettings.ConnectionLifeTime);
if(timer == null)
{
timer = new Timer(new TimerCallback(DisposeTimedoutConnections), null,
connectionSettings.ConnectionLifeTime, new TimeSpan(-1));
}
connectionsInUse--;
openFreeConnections.Add(connection);
}
}
public void OpenConnectionFinalized()
{
lock(openFreeConnections.SyncRoot)
{
connectionsOpen--;
connectionsInUse--;
}
}
/// <summary>
/// Find a specific connection pool
/// </summary>
/// <param name="connectionString"></param>
/// <returns></returns>
static public DB2ConnectionPool FindConnectionPool(string connectionString)
{
return (DB2ConnectionPool)DB2Environment.Instance.connectionPools[connectionString];
}
/// <summary>
/// Get a connection pool. If it doesn't exist yet, create it
/// </summary>
/// <param name="connectionSettings"></param>
/// <returns></returns>
static public DB2ConnectionPool GetConnectionPool(DB2ConnectionSettings connectionSettings)
{
DB2Environment environment = DB2Environment.Instance;
lock(environment.connectionPools.SyncRoot)
{
DB2ConnectionPool pool = (DB2ConnectionPool)environment.connectionPools[connectionSettings.ConnectionString];
if(pool == null)
{
pool = new DB2ConnectionPool(connectionSettings);
environment.connectionPools.Add(connectionSettings.ConnectionString, pool);
}
return pool;
}
}
}
}
namespace IBM.Data.DB2
{
/// <summary>
///
/// </summary>
/// <remarks>One connection pool per connectionstring</remarks>
internal sealed class DB2ConnectionPool
{
private ArrayList openFreeConnections; // list of pooled connections sorted by age. First connection is present at index 'connectionsUsableOffset'
private Queue openFreeMinimalAllocated;
private int connectionsOpen; // total number of connections open (in pool, an in use by application)
private int connectionsInUse; // total connection in use by application
private int connectionsUsableOffset; // Offset to the first pooled connection in 'openFreeConnections'
private Timer timer;
public string databaseProductName;
public string databaseVersion;
public int majorVersion;
public int minorVersion;
private DB2ConnectionSettings connectionSettings;
public DB2ConnectionPool(DB2ConnectionSettings connectionSettings)
{
this.connectionSettings = connectionSettings;
openFreeConnections = new ArrayList();
}
public DB2ConnectionSettings ConnectionSettings
{
get { return connectionSettings; }
}
public DB2OpenConnection GetOpenConnection(DB2Connection db2Conn)
{
DB2OpenConnection connection = null;
lock(openFreeConnections.SyncRoot)
{
if((connectionSettings.ConnectionPoolSizeMax > 0) &&
(connectionsOpen >= connectionSettings.ConnectionPoolSizeMax))
{
throw new ArgumentException("Maximum connections reached for connectionstring");
}
while(connectionsOpen > connectionsInUse)
{
connection = (DB2OpenConnection)openFreeConnections[openFreeConnections.Count - 1];
openFreeConnections.RemoveAt(openFreeConnections.Count - 1);
// check if connection is dead
int isDead;
short sqlRet = DB2CLIWrapper.SQLGetConnectAttr(connection.DBHandle, DB2Constants.SQL_ATTR_CONNECTION_DEAD, out isDead, 0, IntPtr.Zero);
if(((sqlRet == DB2Constants.SQL_SUCCESS_WITH_INFO) || (sqlRet == DB2Constants.SQL_SUCCESS)) &&
(isDead == DB2Constants.SQL_CD_FALSE))
{
connectionsInUse++;
break;
}
else
{
connectionsOpen--;
connection.Dispose();
connection = null;
}
}
if(connectionsOpen == connectionsInUse)
{
if(timer != null)
{
timer.Dispose();
timer = null;
}
}
}
if(connection == null)
{
openFreeConnections.Clear();
connectionsUsableOffset = 0;
connection = new DB2OpenConnection(connectionSettings, db2Conn);
connectionsOpen++;
connectionsInUse++;
}
return connection;
}
private void DisposeTimedoutConnections(object state)
{
lock(openFreeConnections.SyncRoot)
{
if(timer != null)
{
TimeSpan timeToDispose = TimeSpan.Zero;
DB2OpenConnection connection;
while(connectionsOpen > connectionsInUse)
{
connection = (DB2OpenConnection)openFreeConnections[connectionsUsableOffset];
timeToDispose = connection.poolDisposalTime.Subtract(DateTime.Now);
if((timeToDispose.Ticks < 0) || // time to die
(timeToDispose > connectionSettings.ConnectionLifeTime)) // messing with system clock
{
connection.Dispose();
openFreeConnections[connectionsUsableOffset] = null;
connectionsOpen--;
connectionsUsableOffset++;
}
else
{
break;
}
}
if(connectionsOpen > connectionsInUse)
{
connection = (DB2OpenConnection)openFreeConnections[connectionsUsableOffset];
timer.Change(timeToDispose, new TimeSpan(-1));
}
else
{
timer.Dispose();
timer = null;
}
}
if((connectionsUsableOffset > (openFreeConnections.Capacity / 2)) &&
(connectionsOpen > connectionsInUse))
{
openFreeConnections.RemoveRange(0, connectionsUsableOffset); // cleanup once in a while
connectionsUsableOffset = 0;
}
}
}
public void AddToFreeConnections(DB2OpenConnection connection)
{
lock(openFreeConnections.SyncRoot)
{
connection.poolDisposalTime = DateTime.Now.Add(connectionSettings.ConnectionLifeTime);
if(timer == null)
{
timer = new Timer(new TimerCallback(DisposeTimedoutConnections), null,
connectionSettings.ConnectionLifeTime, new TimeSpan(-1));
}
connectionsInUse--;
openFreeConnections.Add(connection);
}
}
public void OpenConnectionFinalized()
{
lock(openFreeConnections.SyncRoot)
{
connectionsOpen--;
connectionsInUse--;
}
}
/// <summary>
/// Find a specific connection pool
/// </summary>
/// <param name="connectionString"></param>
/// <returns></returns>
static public DB2ConnectionPool FindConnectionPool(string connectionString)
{
return (DB2ConnectionPool)DB2Environment.Instance.connectionPools[connectionString];
}
/// <summary>
/// Get a connection pool. If it doesn't exist yet, create it
/// </summary>
/// <param name="connectionSettings"></param>
/// <returns></returns>
static public DB2ConnectionPool GetConnectionPool(DB2ConnectionSettings connectionSettings)
{
DB2Environment environment = DB2Environment.Instance;
lock(environment.connectionPools.SyncRoot)
{
DB2ConnectionPool pool = (DB2ConnectionPool)environment.connectionPools[connectionSettings.ConnectionString];
if(pool == null)
{
pool = new DB2ConnectionPool(connectionSettings);
environment.connectionPools.Add(connectionSettings.ConnectionString, pool);
}
return pool;
}
}
}
}
@@ -1,202 +1,181 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace IBM.Data.DB2
{
internal sealed class DB2ConnectionSettings
{
private string connectionString;
private string userName = "";
private string passWord = "";
private string databaseAlias = "";
private string server = "";
private bool pooling = true;
private TimeSpan connectTimeout = new TimeSpan(0, 0, 15);
private TimeSpan connectionLifeTime = new TimeSpan(0, 0, 15); // 15 seconds
private int connectionPoolSizeMin = 0;
private int connectionPoolSizeMax = -1; // no maximum
private DB2ConnectionPool pool;
private DB2ConnectionSettings(string connectionString)
{
this.connectionString = connectionString;
this.Parse();
}
public static DB2ConnectionSettings GetConnectionSettings(string connectionString)
{
DB2ConnectionPool pool = DB2ConnectionPool.FindConnectionPool(connectionString);
if(pool != null)
{
return pool.ConnectionSettings;
}
DB2ConnectionSettings settings = new DB2ConnectionSettings(connectionString);
if(settings.Pooling)
{
settings.pool = DB2ConnectionPool.GetConnectionPool(settings);
}
return settings;
}
public DB2OpenConnection GetRealOpenConnection(DB2Connection connection)
{
if(pool != null)
{
return pool.GetOpenConnection(connection);
}
else
{
return new DB2OpenConnection(this, connection);
}
}
public DB2ConnectionPool Pool
{
get { return pool; }
}
public string ConnectionString
{
get { return connectionString; }
}
public string UserName
{
get { return userName; }
}
public string PassWord
{
get { return passWord; }
}
/// <summary>
/// database alias (for cataloged database)
/// </summary>
public string DatabaseAlias
{
get { return databaseAlias; }
}
/// <summary>
/// server name with optional port number for direct connection (<server name/ip address>[:<port>])
/// </summary>
public string Server
{
get { return server; }
}
public TimeSpan ConnectTimeout
{
get { return connectTimeout; }
}
/// <summary>
/// Connection pooling yes/no
/// </summary>
public bool Pooling
{
get { return pooling; }
}
public int ConnectionPoolSizeMin
{
get { return connectionPoolSizeMin; }
}
public int ConnectionPoolSizeMax
{
get { return connectionPoolSizeMin; }
}
public TimeSpan ConnectionLifeTime
{
get { return connectionLifeTime; }
}
/// <summary>
/// parsed according to IBM DB2 .NET data provider help
/// </summary>
public void Parse()
{
string[] parts = connectionString.Split(new char[]{';'});
foreach(string part in parts)
{
string[] pairs = part.Split(new char[]{'='});
switch(pairs[0].ToLower())
{
case "database":
case "dsn":
databaseAlias = pairs[1];
break;
case "uid":
case "user id":
userName = pairs[1];
break;
case "pwd":
case "password":
passWord = pairs[1];
break;
case "server":
server = pairs[1];
break;
case "pooling":
pooling = (pairs[1].ToLower() == "true") || (pairs[1]== "1");
break;
case "connect timeout":
case "timeout":
case "connection timeout":
connectTimeout = new TimeSpan(0, 0, int.Parse(pairs[1]));
break;
case "min pool size":
connectionPoolSizeMin = int.Parse(pairs[1]);
break;
case "max pool size":
connectionPoolSizeMax = int.Parse(pairs[1]);
break;
case "connection lifetime":
connectionLifeTime = new TimeSpan(0, 0, int.Parse(pairs[1]));
break;
}
}
if(connectionLifeTime.Ticks <= 0)
{
pooling = false;
}
}
public override int GetHashCode()
{
return connectionString.GetHashCode ();
}
public override bool Equals(object obj)
{
return connectionString.Equals (obj);
}
}
}
namespace IBM.Data.DB2
{
internal sealed class DB2ConnectionSettings
{
private string connectionString;
private string userName = "";
private string passWord = "";
private string databaseAlias = "";
private string server = "";
private bool pooling = true;
private TimeSpan connectTimeout = new TimeSpan(0, 0, 15);
private TimeSpan connectionLifeTime = new TimeSpan(0, 0, 15); // 15 seconds
private int connectionPoolSizeMin = 0;
private int connectionPoolSizeMax = -1; // no maximum
private DB2ConnectionPool pool;
private DB2ConnectionSettings(string connectionString)
{
this.connectionString = connectionString;
this.Parse();
}
public static DB2ConnectionSettings GetConnectionSettings(string connectionString)
{
DB2ConnectionPool pool = DB2ConnectionPool.FindConnectionPool(connectionString);
if(pool != null)
{
return pool.ConnectionSettings;
}
DB2ConnectionSettings settings = new DB2ConnectionSettings(connectionString);
if(settings.Pooling)
{
settings.pool = DB2ConnectionPool.GetConnectionPool(settings);
}
return settings;
}
public DB2OpenConnection GetRealOpenConnection(DB2Connection connection)
{
if(pool != null)
{
return pool.GetOpenConnection(connection);
}
else
{
return new DB2OpenConnection(this, connection);
}
}
public DB2ConnectionPool Pool
{
get { return pool; }
}
public string ConnectionString
{
get { return connectionString; }
}
public string UserName
{
get { return userName; }
}
public string PassWord
{
get { return passWord; }
}
/// <summary>
/// database alias (for cataloged database)
/// </summary>
public string DatabaseAlias
{
get { return databaseAlias; }
}
/// <summary>
/// server name with optional port number for direct connection (<server name/ip address>[:<port>])
/// </summary>
public string Server
{
get { return server; }
}
public TimeSpan ConnectTimeout
{
get { return connectTimeout; }
}
/// <summary>
/// Connection pooling yes/no
/// </summary>
public bool Pooling
{
get { return pooling; }
}
public int ConnectionPoolSizeMin
{
get { return connectionPoolSizeMin; }
}
public int ConnectionPoolSizeMax
{
get { return connectionPoolSizeMin; }
}
public TimeSpan ConnectionLifeTime
{
get { return connectionLifeTime; }
}
/// <summary>
/// parsed according to IBM DB2 .NET data provider help
/// </summary>
public void Parse()
{
string[] parts = connectionString.Split(new char[]{';'});
foreach(string part in parts)
{
string[] pairs = part.Split(new char[]{'='});
switch(pairs[0].ToLower())
{
case "database":
case "dsn":
databaseAlias = pairs[1];
break;
case "uid":
case "user id":
userName = pairs[1];
break;
case "pwd":
case "password":
passWord = pairs[1];
break;
case "server":
server = pairs[1];
break;
case "pooling":
pooling = (pairs[1].ToLower() == "true") || (pairs[1]== "1");
break;
case "connect timeout":
case "timeout":
case "connection timeout":
connectTimeout = new TimeSpan(0, 0, int.Parse(pairs[1]));
break;
case "min pool size":
connectionPoolSizeMin = int.Parse(pairs[1]);
break;
case "max pool size":
connectionPoolSizeMax = int.Parse(pairs[1]);
break;
case "connection lifetime":
connectionLifeTime = new TimeSpan(0, 0, int.Parse(pairs[1]));
break;
}
}
if(connectionLifeTime.Ticks <= 0)
{
pooling = false;
}
}
public override int GetHashCode()
{
return connectionString.GetHashCode ();
}
public override bool Equals(object obj)
{
return connectionString.Equals (obj);
}
}
}
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace IBM.Data.DB2
@@ -78,12 +57,6 @@ namespace IBM.Data.DB2
public const int SQL_ATTR_MAX_ROWS = 1;
public const int SQL_ATTR_DEFERRED_PREPARE = 1277;
/*Used for batch operations*/
public const int SQL_ATTR_PARAMSET_SIZE = 22;
public const int SQL_ATTR_PARAM_STATUS_PTR = 20;
public const int SQL_ATTR_PARAMS_PROCESSED_PTR = 21;
public const int SQL_ATTR_PARAM_BIND_TYPE = 18;
public const int SQL_IS_POINTER = -4;
public const int SQL_IS_UINTEGER = -5;
public const int SQL_IS_INTEGER = -6;
@@ -168,8 +141,6 @@ namespace IBM.Data.DB2
public const int SQL_NULLABLE = 1;
public const int SQL_NULLABLE_UNKNOWN = 2;
public const int SQL_PARAM_BIND_BY_COLUMN = 0;
/* Defines for SQLBindParameter and SQLProcedureColumns */
public const int SQL_PARAM_TYPE_UNKNOWN = 0;
public const int SQL_PARAM_INPUT = 1;
@@ -1,184 +0,0 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
namespace IBM.Data.DB2 {
public sealed class DB2DataAdapter : DbDataAdapter, IDbDataAdapter
{
#region Fields
bool disposed = false;
DB2Command deleteCommand;
DB2Command insertCommand;
DB2Command selectCommand;
DB2Command updateCommand;
#endregion
#region Constructors
public DB2DataAdapter ()
: this (new DB2Command ())
{
}
public DB2DataAdapter (DB2Command selectCommand)
{
DeleteCommand = null;
InsertCommand = null;
SelectCommand = selectCommand;
UpdateCommand = null;
}
public DB2DataAdapter (string selectCommandText, DB2Connection selectConnection)
: this (new DB2Command (selectCommandText, selectConnection))
{
}
public DB2DataAdapter (string selectCommandText, string selectConnectionString)
: this (selectCommandText, new DB2Connection (selectConnectionString))
{
}
#endregion
#region Properties
public DB2Command DeleteCommand {
get { return deleteCommand; }
set { deleteCommand = value; }
}
public DB2Command InsertCommand {
get { return insertCommand; }
set { insertCommand = value; }
}
public DB2Command SelectCommand {
get { return selectCommand; }
set { selectCommand = value; }
}
public DB2Command UpdateCommand {
get { return updateCommand; }
set { updateCommand = value; }
}
IDbCommand IDbDataAdapter.DeleteCommand {
get { return DeleteCommand; }
set {
if (!(value is DB2Command))
throw new ArgumentException ();
DeleteCommand = (DB2Command)value;
}
}
IDbCommand IDbDataAdapter.InsertCommand {
get { return InsertCommand; }
set {
if (!(value is DB2Command))
throw new ArgumentException ();
InsertCommand = (DB2Command)value;
}
}
IDbCommand IDbDataAdapter.SelectCommand {
get { return SelectCommand; }
set {
if (!(value is DB2Command))
throw new ArgumentException ();
SelectCommand = (DB2Command)value;
}
}
IDbCommand IDbDataAdapter.UpdateCommand {
get { return UpdateCommand; }
set {
if (!(value is DB2Command))
throw new ArgumentException ();
UpdateCommand = (DB2Command)value;
}
}
ITableMappingCollection IDataAdapter.TableMappings {
get { return TableMappings; }
}
#endregion
#region Methods
protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
{
return new DB2RowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
}
protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
{
return new DB2RowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
}
protected override void Dispose (bool disposing)
{
if (!disposed) {
if (disposing) {
}
disposed = true;
}
}
protected override void OnRowUpdated (RowUpdatedEventArgs value)
{
if (RowUpdated != null)
RowUpdated (this, (DB2RowUpdatedEventArgs) value);
}
protected override void OnRowUpdating (RowUpdatingEventArgs value)
{
if (RowUpdating != null)
RowUpdating (this, (DB2RowUpdatingEventArgs) value);
}
#endregion
#region Events and Delegates
public event DB2RowUpdatedEventHandler RowUpdated;
public event DB2RowUpdatingEventHandler RowUpdating;
#endregion
}
}
File diff suppressed because it is too large. Load diff
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
using System.Text;
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Text;
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
using System.Text;
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.Runtime.InteropServices;
@@ -1,69 +0,0 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.Runtime.InteropServices;
namespace IBM.Data.DB2
{
public delegate void DB2InfoMessageEventHandler(object sender, DB2InfoMessageEventArgs e);
public sealed class DB2InfoMessageEventArgs : EventArgs
{
private DB2ErrorCollection errors;
public DB2InfoMessageEventArgs(DB2ErrorCollection errors)
{
this.errors = errors;
}
public DB2ErrorCollection Errors
{
get
{
return errors;
}
}
public string Message
{
get
{
if(errors.Count > 0)
{
string result = "";
for(int i = 0; i < errors.Count; i++)
{
if(i > 0)
{
result += " ";
}
result += "INFO [" + errors[i].SQLState + "] " + errors[i].Message;
}
return result;
}
return "No information";
}
}
}
}
@@ -1,211 +1,196 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace IBM.Data.DB2
{
internal sealed class DB2OpenConnection : IDisposable
{
private IntPtr dbHandle = IntPtr.Zero;
private DB2ConnectionSettings settings;
private bool disposed = false;
internal DateTime poolDisposalTime; // time to live used for disposal of connections in the connection pool
public bool transactionOpen;
public bool autoCommit = true;
private string databaseProductName;
private string databaseVersion;
private int majorVersion;
private int minorVersion;
public IntPtr DBHandle
{
get { return dbHandle; }
}
public string DatabaseProductName
{
get { return databaseProductName; }
}
public string DatabaseVersion
{
get { return databaseVersion; }
}
public int MajorVersion
{
get { return majorVersion; }
}
public int MinorVersion
{
get { return minorVersion; }
}
public DB2OpenConnection(DB2ConnectionSettings settings, DB2Connection connection)
{
this.settings = settings;
try
{
short sqlRet = DB2CLIWrapper.SQLAllocHandle(DB2Constants.SQL_HANDLE_DBC, DB2Environment.Instance.penvHandle, out dbHandle);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, DB2Environment.Instance.penvHandle, "Unable to allocate database handle in DB2Connection.", connection);
if(settings.Server.Length > 0)
{
StringBuilder outConnectStr = new StringBuilder(60); // TODO: ????
short numOutCharsReturned;
sqlRet = DB2CLIWrapper.SQLDriverConnect(dbHandle, IntPtr.Zero,
settings.ConnectionString, (short)settings.ConnectionString.Length,
outConnectStr, (short)outConnectStr.Length, out numOutCharsReturned,
DB2Constants.SQL_DRIVER_NOPROMPT /*SQL_DRIVER_COMPLETE*/);
}
else
{
sqlRet = DB2CLIWrapper.SQLConnect(dbHandle,
settings.DatabaseAlias, (short)settings.DatabaseAlias.Length,
settings.UserName, (short)settings.UserName.Length,
settings.PassWord, (short)settings.PassWord.Length);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, dbHandle, "Unable to connect to the database.", connection);
}
if((settings.Pool == null) || (settings.Pool.databaseProductName == null))
{
StringBuilder sb = new StringBuilder(256);
short stringLength;
sqlRet = DB2CLIWrapper.SQLGetInfo(dbHandle, /*SQL_DBMS_NAME*/17, sb, (short)(sb.Capacity / 2), out stringLength);
new DB2ErrorCollection(DB2Constants.SQL_HANDLE_DBC, dbHandle).ToString();
if(sqlRet == 0)
databaseProductName = sb.ToString(0, Math.Min(sb.Capacity, stringLength / 2));
sqlRet = DB2CLIWrapper.SQLGetInfo(dbHandle, /*SQL_DBMS_VER*/18, sb, (short)(sb.Capacity / 2), out stringLength);
if(sqlRet == 0)
{
databaseVersion = sb.ToString(0, Math.Min(sb.Capacity, stringLength / 2));
try
{
string[] splitVersion = databaseVersion.Split('.');
majorVersion = int.Parse(splitVersion[0]);
minorVersion = int.Parse(splitVersion[1]);
}
catch{}
}
if(settings.Pool != null)
{
settings.Pool.databaseProductName = databaseProductName;
settings.Pool.databaseVersion = databaseVersion;
settings.Pool.majorVersion = majorVersion;
settings.Pool.minorVersion = minorVersion;
}
}
else if(settings.Pool != null)
{
if(settings.Pool != null)
{
databaseProductName = settings.Pool.databaseProductName;
databaseVersion = settings.Pool.databaseVersion;
majorVersion = settings.Pool.majorVersion;
minorVersion = settings.Pool.minorVersion;
}
}
}
catch
{
if(dbHandle != IntPtr.Zero)
{
DB2CLIWrapper.SQLFreeHandle(DB2Constants.SQL_HANDLE_DBC, dbHandle);
dbHandle = IntPtr.Zero;
}
throw;
}
}
public void RollbackDeadTransaction()
{
DB2CLIWrapper.SQLEndTran(DB2Constants.SQL_HANDLE_DBC, DBHandle, DB2Constants.SQL_ROLLBACK);
transactionOpen = false;
}
public void Close()
{
if(transactionOpen)
RollbackDeadTransaction();
if(settings.Pool != null)
{
settings.Pool.AddToFreeConnections(this);
}
else
{
Dispose();
}
}
private void FreeHandles()
{
if(dbHandle != IntPtr.Zero)
{
short sqlRet = DB2CLIWrapper.SQLDisconnect(dbHandle);
// Note that SQLDisconnect() automatically drops any statements and
// descriptors open on the connection.
sqlRet = DB2CLIWrapper.SQLFreeHandle(DB2Constants.SQL_HANDLE_DBC, dbHandle);
dbHandle = IntPtr.Zero;
}
}
#region IDisposable Members
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if(!disposed)
{
if(disposing)
{
// dispose managed resources
}
FreeHandles();
}
disposed = true;
}
~DB2OpenConnection()
{
if(settings.Pool != null)
{
settings.Pool.OpenConnectionFinalized();
}
Dispose(false);
}
#endregion
}
}
namespace IBM.Data.DB2
{
internal sealed class DB2OpenConnection : IDisposable
{
private IntPtr dbHandle = IntPtr.Zero;
private DB2ConnectionSettings settings;
private bool disposed = false;
internal DateTime poolDisposalTime; // time to live used for disposal of connections in the connection pool
public bool transactionOpen;
public bool autoCommit = true;
private string databaseProductName;
private string databaseVersion;
private int majorVersion;
private int minorVersion;
public IntPtr DBHandle
{
get { return dbHandle; }
}
public string DatabaseProductName
{
get { return databaseProductName; }
}
public string DatabaseVersion
{
get { return databaseVersion; }
}
public int MajorVersion
{
get { return majorVersion; }
}
public int MinorVersion
{
get { return minorVersion; }
}
public DB2OpenConnection(DB2ConnectionSettings settings, DB2Connection connection)
{
this.settings = settings;
try
{
short sqlRet = DB2CLIWrapper.SQLAllocHandle(DB2Constants.SQL_HANDLE_DBC, DB2Environment.Instance.penvHandle, out dbHandle);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, DB2Environment.Instance.penvHandle, "Unable to allocate database handle in DB2Connection.", connection);
if(settings.Server.Length > 0)
{
StringBuilder outConnectStr = new StringBuilder(60); // TODO: ????
short numOutCharsReturned;
sqlRet = DB2CLIWrapper.SQLDriverConnect(dbHandle, IntPtr.Zero,
settings.ConnectionString, (short)settings.ConnectionString.Length,
outConnectStr, (short)outConnectStr.Length, out numOutCharsReturned,
DB2Constants.SQL_DRIVER_NOPROMPT /*SQL_DRIVER_COMPLETE*/);
}
else
{
sqlRet = DB2CLIWrapper.SQLConnect(dbHandle,
settings.DatabaseAlias, (short)settings.DatabaseAlias.Length,
settings.UserName, (short)settings.UserName.Length,
settings.PassWord, (short)settings.PassWord.Length);
DB2ClientUtils.DB2CheckReturn(sqlRet, DB2Constants.SQL_HANDLE_DBC, dbHandle, "Unable to connect to the database.", connection);
}
if((settings.Pool == null) || (settings.Pool.databaseProductName == null))
{
StringBuilder sb = new StringBuilder(256);
short stringLength;
sqlRet = DB2CLIWrapper.SQLGetInfo(dbHandle, /*SQL_DBMS_NAME*/17, sb, (short)(sb.Capacity / 2), out stringLength);
new DB2ErrorCollection(DB2Constants.SQL_HANDLE_DBC, dbHandle).ToString();
if(sqlRet == 0)
databaseProductName = sb.ToString(); //(0, Math.Min(sb.Capacity, stringLength / 2));
sqlRet = DB2CLIWrapper.SQLGetInfo(dbHandle, /*SQL_DBMS_VER*/18, sb, (short)(sb.Capacity / 2), out stringLength);
if(sqlRet == 0)
{
databaseVersion = sb.ToString(0, Math.Min(sb.Capacity, stringLength / 2));
try
{
string[] splitVersion = databaseVersion.Split('.');
majorVersion = int.Parse(splitVersion[0]);
minorVersion = int.Parse(splitVersion[1]);
}
catch{}
}
if(settings.Pool != null)
{
settings.Pool.databaseProductName = databaseProductName;
settings.Pool.databaseVersion = databaseVersion;
settings.Pool.majorVersion = majorVersion;
settings.Pool.minorVersion = minorVersion;
}
}
else if(settings.Pool != null)
{
if(settings.Pool != null)
{
databaseProductName = settings.Pool.databaseProductName;
databaseVersion = settings.Pool.databaseVersion;
majorVersion = settings.Pool.majorVersion;
minorVersion = settings.Pool.minorVersion;
}
}
}
catch
{
if(dbHandle != IntPtr.Zero)
{
DB2CLIWrapper.SQLFreeHandle(DB2Constants.SQL_HANDLE_DBC, dbHandle);
dbHandle = IntPtr.Zero;
}
throw;
}
}
public void RollbackDeadTransaction()
{
DB2CLIWrapper.SQLEndTran(DB2Constants.SQL_HANDLE_DBC, DBHandle, DB2Constants.SQL_ROLLBACK);
transactionOpen = false;
}
public void Close()
{
if(transactionOpen)
RollbackDeadTransaction();
if(settings.Pool != null)
{
settings.Pool.AddToFreeConnections(this);
}
else
{
Dispose();
}
}
private void FreeHandles()
{
if(dbHandle != IntPtr.Zero)
{
short sqlRet = DB2CLIWrapper.SQLDisconnect(dbHandle);
// Note that SQLDisconnect() automatically drops any statements and
// descriptors open on the connection.
sqlRet = DB2CLIWrapper.SQLFreeHandle(DB2Constants.SQL_HANDLE_DBC, dbHandle);
dbHandle = IntPtr.Zero;
}
}
#region IDisposable Members
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if(!disposed)
{
if(disposing)
{
// dispose managed resources
}
FreeHandles();
}
disposed = true;
}
~DB2OpenConnection()
{
if(settings.Pool != null)
{
settings.Pool.OpenConnectionFinalized();
}
Dispose(false);
}
#endregion
}
}
File diff suppressed because it is too large. Load diff
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.Collections;
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.Data.Common;
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace IBM.Data.DB2 {
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.Data.Common;
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace IBM.Data.DB2 {
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Data;
using System.Runtime.InteropServices;
@@ -1,24 +1,3 @@
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace IBM.Data.DB2
@@ -53,39 +32,4 @@ namespace IBM.Data.DB2
RowId = 25,
XmlReader = 26,
}
public class DB2TypeConverter
{
public static Type GetManagedType(int sql_type)
{
switch(sql_type)
{
case DB2Constants.SQL_INTEGER:
return typeof(int);
case DB2Constants.SQL_SMALLINT:
return typeof(short);
case DB2Constants.SQL_BIGINT:
return typeof(long);
case DB2Constants.SQL_DOUBLE:
return typeof(double);
case DB2Constants.SQL_DECIMAL:
return typeof(decimal);
case DB2Constants.SQL_DATETIME:
case DB2Constants.SQL_TYPE_DATE:
case DB2Constants.SQL_TYPE_TIMESTAMP:
return typeof(DateTime);
case DB2Constants.SQL_TYPE_TIME:
return typeof(TimeSpan);
case DB2Constants.SQL_CHAR:
case DB2Constants.SQL_VARCHAR:
case DB2Constants.SQL_TYPE_CLOB:
return typeof(string);
case DB2Constants.SQL_TYPE_BLOB:
case DB2Constants.SQL_TYPE_BINARY:
case DB2Constants.SQL_LONGVARBINARY:
case DB2Constants.SQL_VARBINARY:
return typeof(byte[]);
}
throw new NotImplementedException("Unknown SQL type " + sql_type);
}
}
}
-4
View File
@@ -7,9 +7,5 @@ LIB_MCS_FLAGS = /unsafe /r:$(corlib) /r:System.dll \
/r:System.Xml.dll /r:System.Data.dll
NO_TEST = yes
ifeq (net_2_0, $(PROFILE))
all-local install-local test-local run-test-local clean-local dist-local uninstall-local:
else
include ../../build/library.make
endif
@@ -1,8 +1,3 @@
2004-06-21 Raja R Harinath <[email protected]>
* Makefile (LIBRARY_SNK): Sign with SharpZipLib.key. The library
is delay-signed according to ICSharpCode.SharpZipLib/AssemblyInfo.cs.
2004-06-09 Sebastien Pouliot <[email protected]>
* Makefile: Don't sign this assembly as it is fully signed during
@@ -47,12 +47,7 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
#if NET_2_0
[assembly: AssemblyVersion("2.6.0.0")]
#else
// not worrying about the NET_1_0 profile for now.
[assembly: AssemblyVersion("0.6.0.0")]
#endif
[assembly: AssemblyDelaySign(true)]
[assembly: AssemblyKeyFile ("SharpZipLib.pub")]
@@ -1,10 +1,5 @@
2004-06-24 Raja R Harinath <[email protected]>
* AssemblyInfo.cs (AssemblyVersion): Set different version for the
net_2_0 profile.
2004-05-28 Duncan Mak <[email protected]>
* AssemblyInfo.cs: Use the new SharpZipLib.pub.
* Zip/Compression/DeflaterHuffman.cs (FlushBlock): Add some
parenthesis to help the generics compiler read this source.
parenthesis to help the generics compiler read this source.
+3 -3
View File
@@ -3,10 +3,10 @@ SUBDIRS =
include ../../build/rules.make
LIBRARY = ICSharpCode.SharpZipLib.dll
LIBRARY_SNK = SharpZipLib.key
LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll /r:System.Xml.dll
NO_TEST = yes
EXTRA_DISTFILES = $(LIBRARY_SNK)
EXTRA_DISTFILES = SharpZipLib.key
NO_SIGN_ASSEMBLY = yes
include ../../build/library.make
+4 -1
View File
@@ -2,8 +2,11 @@ thisdir = class
include ../build/rules.make
MONO_POSIX = Mono.Posix
ifeq ($(PLATFORM),linux)
MONO_CSHARP_DEBUGGER = Mono.CSharp.Debugger
else
MONO_CSHARP_DEBUGGER =
endif
SUBDIRS = \
corlib \
System \
@@ -7,27 +7,6 @@
// (C) 2003 Ximian, Inc. http://www.ximian.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.InteropServices;
@@ -8,27 +8,6 @@
// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
internal sealed class Locale {
private Locale ()
@@ -6,27 +6,6 @@
// (C) Cesar Octavio Lopez Nataren, <[email protected]>
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using Microsoft.Vsa;
Loaded 100 of 4590 files, more files were not shown because too many files have changed in this diff. Show more