Permalink
Browse files

Moved deprecated library

svn path=/old-code/; revision=152776
  • Loading branch information...
1 parent ee07041 commit 67e6f28e314b28674d549f7d89ada072e28db101 @migueldeicaza migueldeicaza committed Mar 2, 2010
Showing with 43,783 additions and 0 deletions.
  1. +36 −0 FirebirdSql.Data.Firebird/Assembly/AssemblyInfo.cs
  2. +350 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ArrayBase.cs
  3. +125 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ArrayDesc.cs
  4. +161 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/BinaryEncoding.cs
  5. +207 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/BlobBase.cs
  6. +33 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/BlobParameterBuffer.cs
  7. +204 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Charset.cs
  8. +96 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/CharsetCollection.cs
  9. +77 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DatabaseParameterBuffer.cs
  10. +42 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DbDataType.cs
  11. +655 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DbField.cs
  12. +41 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DbStatementType.cs
  13. +270 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/DbValue.cs
  14. +229 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Descriptor.cs
  15. +51 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/EventParameterBuffer.cs
  16. +47 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/GlobalizationHelper.cs
  17. +115 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IDatabase.cs
  18. +54 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IServiceManager.cs
  19. +79 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ITransaction.cs
  20. +1,543 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscCodes.cs
  21. +119 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscError.cs
  22. +56 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscErrorCollection.cs
  23. +209 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscException.cs
  24. +335 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/IscHelper.cs
  25. +129 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ParameterBuffer.cs
  26. +238 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/RemoteEvent.cs
  27. BIN FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Resources/isc_error_msg.resources
  28. +3,598 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/Resources/isc_error_msg.txt
  29. +75 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/ServiceParameterBuffer.cs
  30. +414 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/StatementBase.cs
  31. +114 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/StringCollection.cs
  32. +37 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/TransactionParameterBuffer.cs
  33. +108 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/TypeDecoder.cs
  34. +108 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/TypeEncoder.cs
  35. +445 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Common/TypeHelper.cs
  36. +59 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/ArrayDescMarshal.cs
  37. +120 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/ArrayDescMarshaler.cs
  38. +479 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FbClient.cs
  39. +462 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesArray.cs
  40. +215 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesBlob.cs
  41. +124 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesConnection.cs
  42. +400 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesDatabase.cs
  43. +159 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesServiceManager.cs
  44. +687 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesStatement.cs
  45. +403 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/FesTransaction.cs
  46. +59 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/XSQLDA.cs
  47. +433 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Embedded/XsqldaMarshaler.cs
  48. +1 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird.dll.resources
  49. +137 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird.dll.sources
  50. BIN FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird.snk
  51. +80 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/ClientFactory.cs
  52. +88 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbCharacterSets.cs
  53. +117 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbCheckConstraints.cs
  54. +120 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbChecksByTable.cs
  55. +87 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbCollations.cs
  56. +109 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbColumnPrivileges.cs
  57. +205 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbColumns.cs
  58. +84 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbDataTypes.cs
  59. +178 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbDbSchema.cs
  60. +160 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbDbSchemaFactory.cs
  61. +172 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbDomains.cs
  62. +124 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbForeignKeys.cs
  63. +124 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbFunctions.cs
  64. +120 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbGenerators.cs
  65. +148 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbIndexes.cs
  66. +69 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbMetaDataCollections.cs
  67. +91 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbPrimaryKeys.cs
  68. +188 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbProcedureParameters.cs
  69. +102 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbProcedurePrivileges.cs
  70. +110 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbProcedures.cs
  71. +136 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbRestrictions.cs
  72. +71 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbRoles.cs
  73. +159 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbTableConstraints.cs
  74. +102 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbTablePrivileges.cs
  75. +146 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbTables.cs
  76. +125 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbTriggers.cs
  77. +91 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbUniqueKeys.cs
  78. +189 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbViewColumnUsage.cs
  79. +104 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbViewPrivileges.cs
  80. +88 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/DbSchema/FbViews.cs
  81. +84 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbCharset.cs
  82. +1,303 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbCommand.cs
  83. +1,060 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbCommandBuilder.cs
  84. +38 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbCommandBuilderBehavior.cs
  85. +876 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnection.cs
  86. +383 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnectionInternal.cs
  87. +554 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnectionPool.cs
  88. +484 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnectionString.cs
  89. +350 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbConnectionStringBuilder.cs
  90. +592 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDataAdapter.cs
  91. +779 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDataReader.cs
  92. +351 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDatabaseInfo.cs
  93. +85 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDbSchemaType.cs
  94. +62 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbDbType.cs
  95. +88 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbError.cs
  96. +133 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbErrorCollection.cs
  97. +124 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbException.cs
  98. +71 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbInfoMessageEventArgs.cs
  99. +407 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbParameter.cs
  100. +335 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbParameterCollection.cs
  101. +194 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbRemoteEvent.cs
  102. +72 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbRemoteEventEventArgs.cs
  103. +55 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbRowUpdatedEventArgs.cs
  104. +56 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbRowUpdatingEventArgs.cs
  105. +613 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbTransaction.cs
  106. +67 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/FbTransactionOptions.cs
  107. +109 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/CommandExecutedEventArgs.cs
  108. +98 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/CommandExecutingEventArgs.cs
  109. +807 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/FbBatchExecution.cs
  110. +257 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/FbScript.cs
  111. +365 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/SqlStatementType.cs
  112. +379 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Isql/StringParser.cs
  113. +126 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbBackup.cs
  114. +62 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbBackupFile.cs
  115. +44 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbBackupFlags.cs
  116. +232 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbConfiguration.cs
  117. +58 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbDatabasesInfo.cs
  118. +68 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbLog.cs
  119. +146 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbRestore.cs
  120. +45 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbRestoreFlags.cs
  121. +256 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbSecurity.cs
  122. +188 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbServerConfig.cs
  123. +130 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbServerProperties.cs
  124. +563 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbService.cs
  125. +39 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbServiceState.cs
  126. +33 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbShutdownMode.cs
  127. +86 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbStatistical.cs
  128. +40 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbStatisticalFlags.cs
  129. +146 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbUserData.cs
  130. +86 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbValidation.cs
  131. +42 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/FbValidationFlags.cs
  132. +59 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird/Services/ServiceOutputEventArgs.cs
  133. +19 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Firebird_test.dll.sources
  134. +561 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsArray.cs
  135. +246 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsBlob.cs
  136. +292 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsConnection.cs
  137. +731 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsDatabase.cs
  138. +190 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsEventManager.cs
  139. +71 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsResponse.cs
  140. +207 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsServiceManager.cs
  141. +787 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsStatement.cs
  142. +371 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/GdsTransaction.cs
  143. +719 −0 FirebirdSql.Data.Firebird/FirebirdSql.Data.Gds/XdrStream.cs
  144. +55 −0 FirebirdSql.Data.Firebird/Makefile
  145. +28 −0 FirebirdSql.Data.Firebird/Test/App.config
  146. +31 −0 FirebirdSql.Data.Firebird/Test/AssemblyInfo.cs
  147. +428 −0 FirebirdSql.Data.Firebird/Test/BaseTest.cs
  148. +1,031 −0 FirebirdSql.Data.Firebird/Test/FbArrayTest.cs
  149. +136 −0 FirebirdSql.Data.Firebird/Test/FbBlobTest.cs
  150. +185 −0 FirebirdSql.Data.Firebird/Test/FbCommandBuilderTest.cs
  151. +485 −0 FirebirdSql.Data.Firebird/Test/FbCommandTest.cs
  152. +162 −0 FirebirdSql.Data.Firebird/Test/FbConnectionTest.cs
  153. +683 −0 FirebirdSql.Data.Firebird/Test/FbDataAdapterTest.cs
  154. +382 −0 FirebirdSql.Data.Firebird/Test/FbDataReaderTest.cs
  155. +73 −0 FirebirdSql.Data.Firebird/Test/FbDatabaseInfoTest.cs
  156. +221 −0 FirebirdSql.Data.Firebird/Test/FbDatabaseSchemaTest.cs
  157. +215 −0 FirebirdSql.Data.Firebird/Test/FbImplicitTransactionTest.cs
  158. +43 −0 FirebirdSql.Data.Firebird/Test/FbParameterCollectionTest.cs
  159. +86 −0 FirebirdSql.Data.Firebird/Test/FbParameterTest.cs
  160. +51 −0 FirebirdSql.Data.Firebird/Test/FbScriptTest.cs
  161. +228 −0 FirebirdSql.Data.Firebird/Test/FbServicesTests.cs
  162. +150 −0 FirebirdSql.Data.Firebird/Test/FbStoredProcCallsTest.cs
  163. +142 −0 FirebirdSql.Data.Firebird/Test/FbTransactionTest.cs
  164. +89 −0 FirebirdSql.Data.Firebird/Test/GuidTest.cs
  165. +2,346 −0 FirebirdSql.Data.Firebird/changelog.txt
  166. +549 −0 FirebirdSql.Data.Firebird/license.html
  167. +204 −0 FirebirdSql.Data.Firebird/license.txt
  168. +81 −0 FirebirdSql.Data.Firebird/readme.txt
@@ -0,0 +1,36 @@
+/*
+ * Firebird ADO.NET Data provider for .NET and Mono
+ *
+ * The contents of this file are subject to the Initial
+ * Developer's Public License Version 1.0 (the "License");
+ * you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * http://www.ibphoenix.com/main.nfs?a=ibphoenix&l=;PAGES;NAME='ibp_idpl'
+ *
+ * Software distributed under the License is distributed on
+ * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
+ * express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ * All Rights Reserved.
+ */
+
+using System;
+using System.Resources;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: CLSCompliant(true)]
+[assembly: ComVisible(false)]
+[assembly: AssemblyTitle("Firebird .NET Data Provider")]
+[assembly: AssemblyDescription("Firebird .NET Data Provider")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("FirebirdSQL")]
+[assembly: AssemblyProduct("Firebird .NET Data Provider")]
+[assembly: AssemblyCopyright("(c) 2002-2005. Carlos Guzman Alvarez")]
+[assembly: AssemblyVersion("1.7.1.0")]
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("FirebirdSql.Data.Firebird.snk")]
+[assembly: AssemblyKeyName("")]
@@ -0,0 +1,350 @@
+/*
+ * Firebird ADO.NET Data provider for .NET and Mono
+ *
+ * The contents of this file are subject to the Initial
+ * Developer's Public License Version 1.0 (the "License");
+ * you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * http://www.firebirdsql.org/index.php?op=doc&id=idpl
+ *
+ * Software distributed under the License is distributed on
+ * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
+ * express or implied. See the License for the specific
+ * language governing rights and limitations under the License.
+ *
+ * Copyright (c) 2002, 2005 Carlos Guzman Alvarez
+ * All Rights Reserved.
+ */
+
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace FirebirdSql.Data.Common
+{
+ internal abstract class ArrayBase
+ {
+ #region Fields
+
+ private ArrayDesc descriptor;
+ private string tableName;
+ private string fieldName;
+ private string rdbFieldName;
+
+ #endregion
+
+ #region Properties
+
+ public ArrayDesc Descriptor
+ {
+ get { return this.descriptor; }
+ }
+
+ #endregion
+
+ #region Abstract Properties
+
+ public abstract long Handle
+ {
+ get;
+ set;
+ }
+
+ public abstract IDatabase DB
+ {
+ get;
+ set;
+ }
+
+ public abstract ITransaction Transaction
+ {
+ get;
+ set;
+ }
+
+ #endregion
+
+ #region Constructors
+
+ protected ArrayBase(ArrayDesc descriptor)
+ {
+ this.tableName = descriptor.RelationName;
+ this.fieldName = descriptor.FieldName;
+ this.descriptor = descriptor;
+ }
+
+ protected ArrayBase(string tableName, string fieldName)
+ {
+ this.tableName = tableName;
+ this.fieldName = fieldName;
+ this.rdbFieldName = String.Empty;
+ }
+
+ #endregion
+
+ #region Abstract Methods
+
+ public abstract byte[] GetSlice(int slice_length);
+ public abstract void PutSlice(System.Array source_array, int slice_length);
+
+ #endregion
+
+ #region Protected Abstract Methods
+
+ protected abstract System.Array DecodeSlice(byte[] slice);
+
+ #endregion
+
+ #region Methods
+
+ public Array Read()
+ {
+ byte[] slice = this.GetSlice(this.GetSliceLength(true));
+
+ return this.DecodeSlice(slice);
+ }
+
+ public void Write(System.Array sourceArray)
+ {
+ this.SetDesc(sourceArray);
+ this.PutSlice(sourceArray, this.GetSliceLength(false));
+ }
+
+ public void SetDesc(System.Array sourceArray)
+ {
+ this.descriptor.Dimensions = (short)sourceArray.Rank;
+
+ for (int i = 0; i < sourceArray.Rank; i++)
+ {
+ int lb = this.descriptor.Bounds[i].LowerBound;
+ int ub = sourceArray.GetLength(i) - 1 + lb;
+
+ this.descriptor.Bounds[i].UpperBound = ub;
+ }
+ }
+
+ public void LookupBounds()
+ {
+ this.LookupDesc();
+
+ StatementBase lookup = this.DB.CreateStatement(this.Transaction);
+
+ lookup.Prepare(this.GetArrayBounds());
+ lookup.Execute();
+
+ int i = 0;
+ this.descriptor.Bounds = new ArrayBound[16];
+ DbValue[] values;
+
+ while ((values = lookup.Fetch()) != null)
+ {
+ this.descriptor.Bounds[i].LowerBound = values[0].GetInt32();
+ this.descriptor.Bounds[i].UpperBound = values[1].GetInt32();
+
+ i++;
+ }
+
+ lookup.Release();
+ lookup = null;
+ }
+
+ public void LookupDesc()
+ {
+ // Initializa array descriptor information
+ this.descriptor = new ArrayDesc();
+
+ // Create statement for retrieve information
+ StatementBase lookup = this.DB.CreateStatement(this.Transaction);
+
+ lookup.Prepare(this.GetArrayDesc());
+ lookup.Execute();
+
+ DbValue[] values = lookup.Fetch();
+ if (values != null && values.Length > 0)
+ {
+ this.descriptor.RelationName = tableName;
+ this.descriptor.FieldName = fieldName;
+ this.descriptor.DataType = values[0].GetByte();
+ this.descriptor.Scale = values[1].GetInt16();
+ this.descriptor.Length = values[2].GetInt16();
+ this.descriptor.Dimensions = values[3].GetInt16();
+ this.descriptor.Flags = 0;
+
+ this.rdbFieldName = values[4].GetString().Trim();
+ }
+ else
+ {
+ throw new InvalidOperationException();
+ }
+
+ lookup.Release();
+ lookup = null;
+ }
+
+ #endregion
+
+ #region Protected Methods
+
+ protected int GetSliceLength(bool read)
+ {
+ int length = 0;
+ int elements = 0;
+
+ for (int i = 0; i < this.descriptor.Dimensions; i++)
+ {
+ ArrayBound bound = this.descriptor.Bounds[i];
+
+ elements += (bound.UpperBound - bound.LowerBound) + 1;
+ }
+
+ length = elements * this.descriptor.Length;
+
+ switch (this.descriptor.DataType)
+ {
+ case IscCodes.blr_varying:
+ case IscCodes.blr_varying2:
+ length += elements * 2;
+ break;
+ }
+
+ return length;
+ }
+
+ protected Type GetSystemType()
+ {
+ Type systemType;
+
+ switch (this.descriptor.DataType)
+ {
+ case IscCodes.blr_text:
+ case IscCodes.blr_text2:
+ case IscCodes.blr_cstring:
+ case IscCodes.blr_cstring2:
+ // Char
+ systemType = typeof(System.String);
+ break;
+
+ case IscCodes.blr_varying:
+ case IscCodes.blr_varying2:
+ // VarChar
+ systemType = typeof(System.String);
+ break;
+
+ case IscCodes.blr_short:
+ // Short/Smallint
+ if (this.descriptor.Scale < 0)
+ {
+ systemType = typeof(System.Decimal);
+ }
+ else
+ {
+ systemType = typeof(System.Int16);
+ }
+ break;
+
+ case IscCodes.blr_long:
+ // Integer
+ if (this.descriptor.Scale < 0)
+ {
+ systemType = typeof(System.Decimal);
+ }
+ else
+ {
+ systemType = typeof(System.Int32);
+ }
+ break;
+
+ case IscCodes.blr_float:
+ // Float
+ systemType = typeof(System.Single);
+ break;
+
+ case IscCodes.blr_double:
+ case IscCodes.blr_d_float:
+ // Double
+ systemType = typeof(System.Double);
+ break;
+
+ case IscCodes.blr_quad:
+ case IscCodes.blr_int64:
+ // Long/Quad
+ if (this.descriptor.Scale < 0)
+ {
+ systemType = typeof(System.Decimal);
+ }
+ else
+ {
+ systemType = typeof(System.Int64);
+ }
+ break;
+
+ case IscCodes.blr_timestamp:
+ // Timestamp
+ systemType = typeof(System.DateTime);
+ break;
+
+ case IscCodes.blr_sql_time:
+ // Time
+ systemType = typeof(System.DateTime);
+ break;
+
+ case IscCodes.blr_sql_date:
+ // Date
+ systemType = typeof(System.DateTime);
+ break;
+
+ default:
+ throw new NotSupportedException("Unknown data type");
+ }
+
+ return systemType;
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private string GetArrayDesc()
+ {
+ StringBuilder sql = new StringBuilder();
+
+ sql.Append(
+ "SELECT Y.RDB$FIELD_TYPE, Y.RDB$FIELD_SCALE, Y.RDB$FIELD_LENGTH, Y.RDB$DIMENSIONS, X.RDB$FIELD_SOURCE " +
+ "FROM RDB$RELATION_FIELDS X, RDB$FIELDS Y " +
+ "WHERE X.RDB$FIELD_SOURCE = Y.RDB$FIELD_NAME ");
+
+ if (this.tableName != null && this.tableName.Length != 0)
+ {
+ sql.AppendFormat(
+ CultureInfo.CurrentCulture, " AND X.RDB$RELATION_NAME = '{0}'", tableName);
+ }
+
+ if (this.fieldName != null && this.fieldName.Length != 0)
+ {
+ sql.AppendFormat(
+ CultureInfo.CurrentCulture, " AND X.RDB$FIELD_NAME = '{0}'", fieldName);
+ }
+
+ return sql.ToString();
+ }
+
+ private string GetArrayBounds()
+ {
+ StringBuilder sql = new StringBuilder();
+
+ sql.Append("SELECT X.RDB$LOWER_BOUND, X.RDB$UPPER_BOUND FROM RDB$FIELD_DIMENSIONS X ");
+
+ if (this.fieldName != null && this.fieldName.Length != 0)
+ {
+ sql.AppendFormat(
+ CultureInfo.CurrentCulture, "WHERE X.RDB$FIELD_NAME = '{0}'", rdbFieldName);
+ }
+
+ sql.Append(" ORDER BY X.RDB$DIMENSION");
+
+ return sql.ToString();
+ }
+
+ #endregion
+ }
+}
Oops, something went wrong.

0 comments on commit 67e6f28

Please sign in to comment.