From: <cin...@us...> - 2009-08-30 12:03:51
|
Revision: 1006 http://firebird.svn.sourceforge.net/firebird/?rev=1006&view=rev Author: cincura_net Date: 2009-08-30 12:01:41 +0000 (Sun, 30 Aug 2009) Log Message: ----------- Initial work on protocol 12 - isc_dpb_utf8_filename. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj Added Paths: ----------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs 2009-08-16 21:03:30 UTC (rev 1005) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs 2009-08-30 12:01:41 UTC (rev 1006) @@ -168,7 +168,7 @@ outputStream.Write(1); // Architecture of client - Generic outputStream.Write(database); // Database path - outputStream.Write(2); // Protocol versions understood + outputStream.Write(3); // Protocol versions understood outputStream.WriteBuffer(user_id.ToArray()); // User identification Stuff outputStream.Write(IscCodes.PROTOCOL_VERSION10);// Protocol version @@ -182,6 +182,12 @@ outputStream.Write(2); // Minumum type (ptype_rpc) outputStream.Write(5); // Maximum type (ptype_lazy_send) outputStream.Write(1); // Preference weight + + outputStream.Write(IscCodes.PROTOCOL_VERSION12);// Protocol version + outputStream.Write(1); // Architecture of client - Generic + outputStream.Write(2); // Minumum type (ptype_rpc) + outputStream.Write(5); // Maximum type (ptype_lazy_send) + outputStream.Write(2); // Preference weight } outputStream.Flush(); @@ -193,7 +199,8 @@ if (this.protocolVersion < 0) { - this.protocolVersion = (this.protocolVersion & IscCodes.FB_PROTOCOL_FLAG) | 11; + //this.protocolVersion = (this.protocolVersion & IscCodes.FB_PROTOCOL_FLAG) | 11; + this.protocolVersion = (ushort)(this.protocolVersion & IscCodes.FB_PROTOCOL_MASK) | IscCodes.FB_PROTOCOL_FLAG; } } else Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2009-08-16 21:03:30 UTC (rev 1005) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2009-08-30 12:01:41 UTC (rev 1006) @@ -202,15 +202,9 @@ { try { - // Attach to the database - this.Write(IscCodes.op_attach); - this.Write((int)0); // Database object ID - this.Write(database); // Database PATH - this.WriteBuffer(dpb.ToArray()); // DPB Parameter buffer + SendAttachToBuffer(dpb, database); this.Flush(); - - // Save the database connection handle - this.handle = this.ReadGenericResponse().ObjectHandle; + ProcessAttachResponse(this.ReadGenericResponse()); } catch (IOException) { @@ -230,6 +224,21 @@ } } + protected virtual void SendAttachToBuffer(DatabaseParameterBuffer dpb, string database) + { + // Attach to the database + this.Write(IscCodes.op_attach); + this.Write((int)0); // Database object ID + this.Write(database); // Database PATH + this.WriteBuffer(dpb.ToArray()); // DPB Parameter buffer + } + + protected virtual void ProcessAttachResponse(GenericResponse response) + { + // Save the database connection handle + this.handle = response.ObjectHandle; + } + public virtual void AttachWithTrustedAuth(DatabaseParameterBuffer dpb, string dataSource, int port, string database) { throw new NotSupportedException("Trusted Auth isn't supported on < FB2.1."); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs 2009-08-16 21:03:30 UTC (rev 1005) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs 2009-08-30 12:01:41 UTC (rev 1006) @@ -75,27 +75,13 @@ using (SSPIHelper sspiHelper = new SSPIHelper()) { byte[] authData = sspiHelper.InitializeClientSecurity(); - dpb.Append(IscCodes.isc_dpb_trusted_auth, authData); - - // Attach to the database - this.Write(IscCodes.op_attach); - this.Write((int)0); // Database object ID - this.Write(database); // Database PATH - this.WriteBuffer(dpb.ToArray()); // DPB Parameter buffer + SendTrustedAuthToBuffer(dpb, authData); + SendAttachToBuffer(dpb, database); this.Flush(); IResponse response = this.ReadResponse(); - while (response is AuthResponse) - { - authData = sspiHelper.GetClientSecurity(((AuthResponse)response).Data); - this.Write(IscCodes.op_trusted_auth); - this.WriteBuffer(authData); - this.Flush(); - response = this.ReadResponse(); - } - - // Save the database connection handle - this.handle = ((GenericResponse)response).ObjectHandle; + ProcessTrustedAuthResponse(sspiHelper, ref response); + ProcessAttachResponse((GenericResponse)response); } } catch (IOException) @@ -118,6 +104,23 @@ throw new NotSupportedException(); #endif } + + protected virtual void SendTrustedAuthToBuffer(DatabaseParameterBuffer dpb, byte[] authData) + { + dpb.Append(IscCodes.isc_dpb_trusted_auth, authData); + } + + protected virtual void ProcessTrustedAuthResponse(SSPIHelper sspiHelper, ref IResponse response) + { + while (response is AuthResponse) + { + byte[] authData = sspiHelper.GetClientSecurity(((AuthResponse)response).Data); + this.Write(IscCodes.op_trusted_auth); + this.WriteBuffer(authData); + this.Flush(); + response = this.ReadResponse(); + } + } #endregion #region Public methods Added: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs (rev 0) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs 2009-08-30 12:01:41 UTC (rev 1006) @@ -0,0 +1,49 @@ +/* + * 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) 2009 Jiri Cincura (ji...@ci...) + * + * All Rights Reserved. + */ + +using System; +using System.Collections; +using System.Data; +using System.Globalization; +using System.IO; +using System.Text; +using System.Net; +using System.Collections.Generic; + +using FirebirdSql.Data.Common; + +namespace FirebirdSql.Data.Client.Managed.Version12 +{ + internal class GdsDatabase : Version11.GdsDatabase + { + public GdsDatabase(Version10.GdsConnection connection) + : base(connection) + { } + + protected override void SendAttachToBuffer(DatabaseParameterBuffer dpb, string database) + { + // Attach to the database + this.Write(IscCodes.op_attach); + this.Write((int)0); // Database object ID + dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); + this.WriteBuffer(Encoding.UTF8.GetBytes(database)); // Database PATH + this.WriteBuffer(dpb.ToArray()); // DPB Parameter buffer + } + } +} \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs 2009-08-16 21:03:30 UTC (rev 1005) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs 2009-08-30 12:01:41 UTC (rev 1006) @@ -82,7 +82,8 @@ switch (connection.ProtocolVersion) { - case IscCodes.PROTOCOL_VERSION12: + case IscCodes.PROTOCOL_VERSION12: + return new FirebirdSql.Data.Client.Managed.Version12.GdsDatabase(connection); case IscCodes.PROTOCOL_VERSION11: return new FirebirdSql.Data.Client.Managed.Version11.GdsDatabase(connection); case IscCodes.PROTOCOL_VERSION10: @@ -97,7 +98,7 @@ FirebirdSql.Data.Client.Managed.Version10.GdsConnection connection = new FirebirdSql.Data.Client.Managed.Version10.GdsConnection(options.DataSource, options.Port, options.PacketSize, Charset.GetCharset(options.Charset)); connection.Connect(); - connection.Identify(!String.IsNullOrEmpty(options.Database) ? options.Database : ""); + connection.Identify(!string.IsNullOrEmpty(options.Database) ? options.Database : string.Empty); switch (connection.ProtocolVersion) { Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2009-08-16 21:03:30 UTC (rev 1005) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2009-08-30 12:01:41 UTC (rev 1006) @@ -80,6 +80,7 @@ <ItemGroup> <Compile Include="Client\Managed\Version11\AuthResponse.cs" /> <Compile Include="Client\Managed\Version11\SSPIHelper.cs" /> + <Compile Include="Client\Managed\Version12\GdsDatabase.cs" /> <Compile Include="Entity\DmlSqlGenerator.cs" /> <Compile Include="Entity\ExpressionTranslator.cs" /> <Compile Include="Entity\FirstClause.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2009-09-05 12:03:04
|
Revision: 1008 http://firebird.svn.sourceforge.net/firebird/?rev=1008&view=rev Author: cincura_net Date: 2009-09-05 12:01:14 +0000 (Sat, 05 Sep 2009) Log Message: ----------- DNET-265 Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtArray.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsArray.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesArray.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/ArrayBase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbField.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/StatementBase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/DmlSqlGenerator.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlGenerator.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommandBuilder.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbInfoMessageEventArgs.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameter.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameterCollection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FirebirdClientPermission.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Isql/FbBatchExecution.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Isql/FbScript.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Services/FbService.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtArray.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtArray.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtArray.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -366,7 +366,7 @@ { case DbDataType.Char: { - string value = source != null ? (string)source : String.Empty; + string value = source != null ? (string)source : string.Empty; byte[] buffer = charset.GetBytes(value); writer.Write(buffer); @@ -383,7 +383,7 @@ case DbDataType.VarChar: { - string value = source != null ? (string)source : String.Empty; + string value = source != null ? (string)source : string.Empty; byte[] buffer = charset.GetBytes(value); writer.Write(buffer); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsArray.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsArray.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsArray.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -110,7 +110,7 @@ this.database.Write(this.handle); // Array id this.database.Write(sliceLength); // Slice length this.database.WriteBuffer(sdl); // Slice descriptor language - this.database.Write(String.Empty); // Slice parameters + this.database.Write(string.Empty); // Slice parameters this.database.Write(0); // Slice proper this.database.Flush(); @@ -137,7 +137,7 @@ this.database.Write((long)0); // Array Handle this.database.Write(sliceLength); // Slice length this.database.WriteBuffer(sdl); // Slice descriptor language - this.database.Write(String.Empty); // Slice parameters + this.database.Write(string.Empty); // Slice parameters this.database.Write(sliceLength); // Slice length this.database.Write(slice, 0, slice.Length); // Slice proper this.database.Flush(); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesArray.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesArray.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesArray.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -376,7 +376,7 @@ { case DbDataType.Char: { - string value = source != null ? (string)source : String.Empty; + string value = source != null ? (string)source : string.Empty; byte[] buffer = charset.GetBytes(value); writer.Write(buffer); @@ -393,7 +393,7 @@ case DbDataType.VarChar: { - string value = source != null ? (string)source : String.Empty; + string value = source != null ? (string)source : string.Empty; byte[] buffer = charset.GetBytes(value); writer.Write(buffer); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/ArrayBase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/ArrayBase.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/ArrayBase.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -80,7 +80,7 @@ { this.tableName = tableName; this.fieldName = fieldName; - this.rdbFieldName = String.Empty; + this.rdbFieldName = string.Empty; } #endregion Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbField.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbField.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbField.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -189,10 +189,10 @@ public DbField() { this.charCount = -1; - this.name = String.Empty; - this.relation = String.Empty; - this.owner = String.Empty; - this.alias = String.Empty; + this.name = string.Empty; + this.relation = string.Empty; + this.owner = string.Empty; + this.alias = string.Empty; this.dbValue = new DbValue(this, DBNull.Value); } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -63,7 +63,7 @@ return this.errorCode.ToString(CultureInfo.InvariantCulture); default: - return String.Empty; + return string.Empty; } } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/StatementBase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/StatementBase.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/StatementBase.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -195,7 +195,7 @@ public string GetExecutionPlan() { - string plan = String.Empty; + string plan = string.Empty; int count = 0; int bufferSize = IscCodes.MAX_BUFFER_SIZE; byte[] buffer = this.GetSqlInfo(DescribePlanInfoItems, bufferSize); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/DmlSqlGenerator.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/DmlSqlGenerator.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/DmlSqlGenerator.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -256,7 +256,7 @@ foreach (FbParameter param in translator.Parameters) { startBlock.Append(separator); - startBlock.Append(param.ParameterName.Replace("@", "")); + startBlock.Append(param.ParameterName.Replace("@", string.Empty)); startBlock.Append(" "); EdmMember member = translator.MemberValues.First(m => m.Value.Contains(param)).Key; startBlock.Append(SqlGenerator.GetSqlPrimitiveType(member.TypeUsage)); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlGenerator.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlGenerator.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlGenerator.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -736,7 +736,7 @@ default: Debug.Assert(false); // The constructor should have prevented this - throw new InvalidOperationException(String.Empty); + throw new InvalidOperationException(string.Empty); } return result; @@ -1151,7 +1151,7 @@ members.MoveNext(); Debug.Assert(result.Select.IsEmpty); - string separator = ""; + string separator = string.Empty; foreach (DbExpression key in e.Keys) { @@ -2017,7 +2017,7 @@ bool isScalarElement = MetadataHelpers.IsPrimitiveType(collectionType.TypeUsage); SqlBuilder resultSql = new SqlBuilder(); - string separator = ""; + string separator = string.Empty; // handle empty table if (e.Arguments.Count == 0) @@ -2114,14 +2114,14 @@ // but the Join postprocessing is messy and prevents this reuse. symbolTable.EnterScope(); - string separator = ""; + string separator = string.Empty; bool isLeftMostInput = true; int inputCount = inputs.Count; for (int idx = 0; idx < inputCount; idx++) { DbExpressionBinding input = inputs[idx]; - if (separator != "") + if (separator != string.Empty) { result.From.AppendLine(); } @@ -2330,7 +2330,7 @@ if (null != rowType) { ReadOnlyMetadataCollection<EdmProperty> members = rowType.Properties; - string separator = ""; + string separator = string.Empty; for (int i = 0; i < e.Arguments.Count; ++i) { DbExpression argument = e.Arguments[i]; @@ -2449,7 +2449,7 @@ if (!isNiladicFunction) { result.Append("("); - string separator = ""; + string separator = string.Empty; foreach (DbExpression arg in e.Arguments) { result.Append(separator); @@ -2979,7 +2979,7 @@ // collision detection. Dictionary<string, Symbol> columnDictionary = new Dictionary<string, Symbol>(StringComparer.OrdinalIgnoreCase); - string separator = ""; + string separator = string.Empty; // The Select should usually be empty before we are called, // but we do not mind if it is not. if (!selectStatement.Select.IsEmpty) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -362,7 +362,7 @@ this.designTimeVisible = true; this.commandTimeout = 30; this.fetchSize = 200; - this.commandText = ""; + this.commandText = string.Empty; if (connection != null) { @@ -1208,7 +1208,7 @@ private string BuildStoredProcedureSql(string spName, bool returnsSet) { - string sql = spName == null ? "" : spName.Trim(); + string sql = spName == null ? string.Empty : spName.Trim(); if (sql.Length > 0 && !sql.ToLower(CultureInfo.InvariantCulture).StartsWith("execute procedure ") && @@ -1236,7 +1236,7 @@ } paramsText.Append(")"); paramsText.Replace(",)", ")"); - paramsText.Replace("()", ""); + paramsText.Replace("()", string.Empty); } if (returnsSet) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommandBuilder.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommandBuilder.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommandBuilder.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -54,7 +54,7 @@ spName = spName.ToUpper(CultureInfo.CurrentUICulture); } - string paramsText = String.Empty; + string paramsText = string.Empty; command.Parameters.Clear(); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -196,7 +196,7 @@ { if (value == null) { - value = ""; + value = string.Empty; } this.options.Load(value); @@ -329,7 +329,7 @@ { this.options = new FbConnectionString(); this.state = ConnectionState.Closed; - this.connectionString = ""; + this.connectionString = string.Empty; if (!string.IsNullOrEmpty(connectionString)) { Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -267,7 +267,7 @@ DataRow schemaRow = null; int tableCount = 0; - string currentTable = ""; + string currentTable = string.Empty; this.schemaTable = this.GetSchemaTableStructure(); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbInfoMessageEventArgs.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbInfoMessageEventArgs.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbInfoMessageEventArgs.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -26,7 +26,7 @@ #region \xB7 Fields \xB7 private FbErrorCollection errors = new FbErrorCollection(); - private string message = String.Empty; + private string message = string.Empty; #endregion Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameter.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameter.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameter.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -250,8 +250,8 @@ this.fbDbType = FbDbType.VarChar; this.direction = ParameterDirection.Input; this.sourceVersion = DataRowVersion.Current; - this.sourceColumn = String.Empty; - this.parameterName = String.Empty; + this.sourceColumn = string.Empty; + this.parameterName = string.Empty; this.charset = FbCharset.Default; } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameterCollection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameterCollection.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameterCollection.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -339,7 +339,7 @@ private string GenerateParameterName() { int index = this.Count + 1; - string name = String.Empty; + string name = string.Empty; while (index > 0) { Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FirebirdClientPermission.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FirebirdClientPermission.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FirebirdClientPermission.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -51,7 +51,7 @@ internal FirebirdClientPermission(string connectionString) : base(PermissionState.None) { - this.Add(connectionString, "", KeyRestrictionBehavior.AllowOnly); + this.Add(connectionString, string.Empty, KeyRestrictionBehavior.AllowOnly); } internal FirebirdClientPermission(DBDataPermission permission) : base (permission) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Isql/FbBatchExecution.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Isql/FbBatchExecution.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Isql/FbBatchExecution.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -486,19 +486,19 @@ throw new Exception("Malformed isql CONNECT statement. Expected keyword CONNECT but something else was found."); } parser.ParseNext(); - this.connectionString.Database = parser.Result.Replace("'", ""); + this.connectionString.Database = parser.Result.Replace("'", string.Empty); while (parser.ParseNext() != -1) { switch (parser.Result.Trim().ToUpper(CultureInfo.CurrentUICulture)) { case "USER": parser.ParseNext(); - this.connectionString.UserID = parser.Result.Replace("'", ""); + this.connectionString.UserID = parser.Result.Replace("'", string.Empty); break; case "PASSWORD": parser.ParseNext(); - this.connectionString.Password = parser.Result.Replace("'", ""); + this.connectionString.Password = parser.Result.Replace("'", string.Empty); break; case "CACHE": @@ -507,7 +507,7 @@ case "ROLE": parser.ParseNext(); - this.connectionString.Role = parser.Result.Replace("'", ""); + this.connectionString.Role = parser.Result.Replace("'", string.Empty); break; default: @@ -541,19 +541,19 @@ } parser.ParseNext(); // {DATABASE | SCHEMA} parser.ParseNext(); - this.connectionString.Database = parser.Result.Replace("'", ""); + this.connectionString.Database = parser.Result.Replace("'", string.Empty); while (parser.ParseNext() != -1) { switch (parser.Result.Trim().ToUpper(CultureInfo.CurrentUICulture)) { case "USER": parser.ParseNext(); - this.connectionString.UserID = parser.Result.Replace("'", ""); + this.connectionString.UserID = parser.Result.Replace("'", string.Empty); break; case "PASSWORD": parser.ParseNext(); - this.connectionString.Password = parser.Result.Replace("'", ""); + this.connectionString.Password = parser.Result.Replace("'", string.Empty); break; case "PAGE_SIZE": @@ -675,7 +675,7 @@ } catch (Exception) { - sqlConnection.ConnectionString = ""; + sqlConnection.ConnectionString = string.Empty; } StringParser parser = new StringParser(sqlDialectStatement, false); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Isql/FbScript.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Isql/FbScript.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Isql/FbScript.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -63,7 +63,7 @@ /// <param name="sqlFilename">The filename for the SQL file.</param> public FbScript(string sqlFilename) { - string script = ""; + string script = string.Empty; using (StreamReader reader = File.OpenText(sqlFilename)) { @@ -210,7 +210,7 @@ { bool result = false; - newTerm = ""; + newTerm = string.Empty; if (StringParser.StartsWith(statement, "SET TERM", true)) { Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Services/FbService.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Services/FbService.cs 2009-08-30 14:04:21 UTC (rev 1007) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Services/FbService.cs 2009-09-05 12:01:14 UTC (rev 1008) @@ -78,7 +78,7 @@ if (value == null) { - this.connectionString = String.Empty; + this.connectionString = string.Empty; } else { @@ -109,7 +109,7 @@ protected FbService() { this.state = FbServiceState.Closed; - this.connectionString = String.Empty; + this.connectionString = string.Empty; this.serviceName = "service_mgr"; this.queryBufferSize = IscCodes.MAX_BUFFER_SIZE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2009-09-12 21:52:45
|
Revision: 1019 http://firebird.svn.sourceforge.net/firebird/?rev=1019&view=rev Author: cincura_net Date: 2009-09-12 21:00:45 +0000 (Sat, 12 Sep 2009) Log Message: ----------- * Re-fixed 271. * Proper version number. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Properties/AssemblyInfo.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs 2009-09-12 20:25:21 UTC (rev 1018) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs 2009-09-12 21:00:45 UTC (rev 1019) @@ -804,7 +804,7 @@ return ((behavior & this.commandBehavior) == behavior); } -#if (NET_20) +#if (!NET_35) delegate TResult Func<TResult>(); #endif private T CheckedGetValue<T>(Func<T> f) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Properties/AssemblyInfo.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Properties/AssemblyInfo.cs 2009-09-12 20:25:21 UTC (rev 1018) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Properties/AssemblyInfo.cs 2009-09-12 21:00:45 UTC (rev 1019) @@ -30,5 +30,5 @@ [assembly: AssemblyCompany("FirebirdSQL")] [assembly: AssemblyProduct("FirebirdClient")] [assembly: AssemblyCopyright("(c) 2002-2009")] -[assembly: AssemblyVersion("2.5.0.0")] +[assembly: AssemblyVersion("2.5.1.0")] [assembly: AssemblyDelaySign(false)] \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2009-09-18 14:48:49
|
Revision: 1023 http://firebird.svn.sourceforge.net/firebird/?rev=1023&view=rev Author: cincura_net Date: 2009-09-18 14:48:36 +0000 (Fri, 18 Sep 2009) Log Message: ----------- Fixed DNET-273. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/FirebirdSql.Data.UnitTests.csproj NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/TrackerIssuesTest.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2009-09-18 14:42:44 UTC (rev 1022) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2009-09-18 14:48:36 UTC (rev 1023) @@ -1036,7 +1036,10 @@ case DbDataType.Text: { BlobBase blob = this.statement.CreateBlob(); - blob.Write((string)this.Parameters[index].Value); + if (this.Parameters[index].Value.GetType() == typeof(byte[])) + blob.Write((byte[])this.Parameters[index].Value); + else + blob.Write((string)this.Parameters[index].Value); this.statement.Parameters[i].Value = blob.Id; } break; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/FirebirdSql.Data.UnitTests.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/FirebirdSql.Data.UnitTests.csproj 2009-09-18 14:42:44 UTC (rev 1022) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/FirebirdSql.Data.UnitTests.csproj 2009-09-18 14:48:36 UTC (rev 1023) @@ -33,10 +33,9 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="nunit.framework, Version=2.4.1.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> + <Reference Include="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\lib\nunit.framework.dll</HintPath> - <Private>True</Private> </Reference> <Reference Include="System" /> <Reference Include="System.configuration" /> Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/TrackerIssuesTest.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/TrackerIssuesTest.cs 2009-09-18 14:42:44 UTC (rev 1022) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/TrackerIssuesTest.cs 2009-09-18 14:48:36 UTC (rev 1023) @@ -103,6 +103,18 @@ } } + [Test] + public void DNET273() + { + using (FbCommand cmd = Connection.CreateCommand()) + { + cmd.CommandText = "insert into test (INT_FIELD, CLOB_FIELD) values (@INT_FIELD, @CLOB_FIELD)"; + cmd.Parameters.Add("@INT_FIELD", FbDbType.Integer).Value = 100; + cmd.Parameters.Add("@CLOB_FIELD", FbDbType.Binary).Value = new byte[] { 0x00, 0x001 }; + cmd.ExecuteNonQuery(); + } + } + #endregion } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2009-09-28 14:10:12
|
Revision: 1032 http://firebird.svn.sourceforge.net/firebird/?rev=1032&view=rev Author: cincura_net Date: 2009-09-28 13:55:05 +0000 (Mon, 28 Sep 2009) Log Message: ----------- DNET-274 Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/TrackerIssuesTest.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2009-09-28 07:53:12 UTC (rev 1031) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2009-09-28 13:55:05 UTC (rev 1032) @@ -51,7 +51,6 @@ private bool implicitTransaction; private int commandTimeout; private int fetchSize; - private bool addedToPrepared; #if (NET_35 && ENTITY_FRAMEWORK) // type coercions @@ -782,31 +781,27 @@ } } - internal void Release() - { - // Rollback implicit transaction - this.RollbackImplicitTransaction(); + internal void Release() + { + // Rollback implicit transaction + this.RollbackImplicitTransaction(); - // If there are an active reader close it - this.CloseReader(); + // If there are an active reader close it + this.CloseReader(); - if (this.addedToPrepared) - { - // Remove the command from the Prepared commands list - if (this.connection != null && this.connection.State == ConnectionState.Open) - { - this.connection.InnerConnection.RemovePreparedCommand(this); - } - this.addedToPrepared = false; - } + // Remove the command from the Prepared commands list + if (this.connection != null && this.connection.State == ConnectionState.Open) + { + this.connection.InnerConnection.RemovePreparedCommand(this); + } - // Dipose the inner statement - if (this.statement != null) - { - this.statement.Dispose(); - this.statement = null; - } - } + // Dipose the inner statement + if (this.statement != null) + { + this.statement.Dispose(); + this.statement = null; + } + } #endregion @@ -1157,7 +1152,6 @@ // Add this command to the active command list innerConn.AddPreparedCommand(this); - this.addedToPrepared = true; } else { Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs 2009-09-28 07:53:12 UTC (rev 1031) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs 2009-09-28 13:55:05 UTC (rev 1032) @@ -633,7 +633,7 @@ this.innerConnection.DisposeTransaction(); // Dispose all active statemenets - this.innerConnection.DisposePreparedCommands(); + this.innerConnection.ReleasePreparedCommands(); // Close connection or send it back to the pool if (this.innerConnection.Pooled) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs 2009-09-28 07:53:12 UTC (rev 1031) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs 2009-09-28 13:55:05 UTC (rev 1032) @@ -37,7 +37,7 @@ private IDatabase db; private FbTransaction activeTransaction; - private List<FbCommand> preparedCommands; + private List<WeakReference> preparedCommands; private FbConnectionString options; private FbConnection owningConnection; private long created; @@ -84,19 +84,6 @@ } } - public List<FbCommand> PreparedCommands - { - get - { - if (this.preparedCommands == null) - { - this.preparedCommands = new List<FbCommand>(); - } - - return this.preparedCommands; - } - } - public FbTransaction ActiveTransaction { get { return this.activeTransaction; } @@ -133,7 +120,9 @@ } public FbConnectionInternal(FbConnectionString options, FbConnection owningConnection) - { + { + this.preparedCommands = new List<WeakReference>(); + this.options = options; this.owningConnection = owningConnection; @@ -334,10 +323,13 @@ public void TransactionUpdated() { - for (int i = 0; i < this.PreparedCommands.Count; i++) + for (int i = 0; i < this.preparedCommands.Count; i++) { - FbCommand command = this.PreparedCommands[i]; + if (!this.preparedCommands[i].IsAlive) + continue; + FbCommand command = this.preparedCommands[i].Target as FbCommand; + if (command.Transaction != null) { command.CloseReader(); @@ -418,54 +410,66 @@ public void AddPreparedCommand(FbCommand command) { - if (!this.PreparedCommands.Contains(command)) - { - this.PreparedCommands.Add(command); - } + int position = this.preparedCommands.Count; + for (int i = 0; i < this.preparedCommands.Count; i++) + { + if (!this.preparedCommands[i].IsAlive) + { + position = i; + break; + } + if (this.preparedCommands[i].Target == command) + { + return; + } + } + this.preparedCommands.Insert(position, new WeakReference(command)); } public void RemovePreparedCommand(FbCommand command) { - this.PreparedCommands.Remove(command); + for (int i = 0; i < this.preparedCommands.Count; i++) + { + if (this.preparedCommands[i].Target == command) + { + this.preparedCommands[i].Target = null; + this.preparedCommands.RemoveAt(i); + return; + } + } } - public void DisposePreparedCommands() - { - if (this.preparedCommands != null) - { - if (this.PreparedCommands.Count > 0) - { - FbCommand[] commands = this.PreparedCommands.ToArray(); + public void ReleasePreparedCommands() + { + for (int i = 0; i < this.preparedCommands.Count; i++) + { + if (!this.preparedCommands[i].IsAlive) + continue; - for (int i = 0; i < commands.Length; i++) - { - try - { - // Release statement handle - commands[i].Release(); - } - catch (System.IO.IOException) - { - // If an IO error occurs weh trying to release the command - // avoid it. ( It maybe the connection to the server was down - // for unknown reasons. ) - } - catch (IscException iex) - { - if (iex.ErrorCode != IscCodes.isc_net_read_err && - iex.ErrorCode != IscCodes.isc_net_write_err && - iex.ErrorCode != IscCodes.isc_network_error) - { - throw; - } - } - } - } + try + { + // Release statement handle + (this.preparedCommands[i].Target as FbCommand).Release(); + } + catch (System.IO.IOException) + { + // If an IO error occurs weh trying to release the command + // avoid it. ( It maybe the connection to the server was down + // for unknown reasons. ) + } + catch (IscException iex) + { + if (iex.ErrorCode != IscCodes.isc_net_read_err && + iex.ErrorCode != IscCodes.isc_net_write_err && + iex.ErrorCode != IscCodes.isc_network_error) + { + throw; + } + } + } - this.PreparedCommands.Clear(); - this.preparedCommands = null; - } - } + this.preparedCommands.Clear(); + } #endregion Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/TrackerIssuesTest.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/TrackerIssuesTest.cs 2009-09-28 07:53:12 UTC (rev 1031) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/TrackerIssuesTest.cs 2009-09-28 13:55:05 UTC (rev 1032) @@ -31,80 +31,80 @@ namespace FirebirdSql.Data.UnitTests { - [TestFixture] - public class TrackerIssuesTest : BaseTest - { - #region \xB7 Constructors \xB7 + [TestFixture] + public class TrackerIssuesTest : BaseTest + { + #region \xB7 Constructors \xB7 - public TrackerIssuesTest() - { - } + public TrackerIssuesTest() + { + } - #endregion + #endregion - #region \xB7 Unit Tests \xB7 + #region \xB7 Unit Tests \xB7 - [Test] - public void DNET60() - { - using (FbCommand command = Connection.CreateCommand()) - { - command.CommandText = "select ' ' AS EmptyColumn from rdb$database"; + [Test] + public void DNET60() + { + using (FbCommand command = Connection.CreateCommand()) + { + command.CommandText = "select ' ' AS EmptyColumn from rdb$database"; - using (FbDataReader r = command.ExecuteReader()) - { - while (r.Read()) - { - } - } - } + using (FbDataReader r = command.ExecuteReader()) + { + while (r.Read()) + { + } + } + } } - [Test] - public void DNET183() - { - const string value = "foo "; + [Test] + public void DNET183() + { + const string value = "foo "; - using (FbCommand cmd = Connection.CreateCommand()) - { - cmd.CommandText = "select cast(@foo as varchar(5)) from rdb$database"; - cmd.Parameters.Add(new FbParameter() { ParameterName = "@foo", FbDbType = FbDbType.VarChar, Size = 5, Value = value }); - using (FbDataReader reader = cmd.ExecuteReader()) - { - while (reader.Read()) - { - Assert.AreEqual(value, (string)reader[0]); - } - } - } - } + using (FbCommand cmd = Connection.CreateCommand()) + { + cmd.CommandText = "select cast(@foo as varchar(5)) from rdb$database"; + cmd.Parameters.Add(new FbParameter() { ParameterName = "@foo", FbDbType = FbDbType.VarChar, Size = 5, Value = value }); + using (FbDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + Assert.AreEqual(value, (string)reader[0]); + } + } + } + } - [Test] - public void DNET217() - { - StringBuilder cols = new StringBuilder(); - string separator = string.Empty; - for (int i = 0; i < 1235; i++) - { - if (i % 2 == 0) - cols.AppendFormat("{0}'r' as col{1}", separator, i); - else - cols.AppendFormat("{0}24 as col{1}", separator, i); + [Test] + public void DNET217() + { + StringBuilder cols = new StringBuilder(); + string separator = string.Empty; + for (int i = 0; i < 1235; i++) + { + if (i % 2 == 0) + cols.AppendFormat("{0}'r' as col{1}", separator, i); + else + cols.AppendFormat("{0}24 as col{1}", separator, i); - separator = ","; - } - using (FbCommand cmd = Connection.CreateCommand()) - { - cmd.CommandText = "select " + cols.ToString() + " from rdb$database where 'x' = @x or 'x' = @x and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y"; - cmd.Parameters.Add(new FbParameter() { ParameterName = "@x", Value = "-1" }); - cmd.Parameters.Add(new FbParameter() { ParameterName = "@y", Value = DateTime.Now }); - using (FbDataReader reader = cmd.ExecuteReader()) - { - while (reader.Read()) - { } - } - } - } + separator = ","; + } + using (FbCommand cmd = Connection.CreateCommand()) + { + cmd.CommandText = "select " + cols.ToString() + " from rdb$database where 'x' = @x or 'x' = @x and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y and current_timestamp = @y"; + cmd.Parameters.Add(new FbParameter() { ParameterName = "@x", Value = "-1" }); + cmd.Parameters.Add(new FbParameter() { ParameterName = "@y", Value = DateTime.Now }); + using (FbDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { } + } + } + } [Test] public void DNET260() @@ -255,6 +255,15 @@ } } - #endregion - } + [Test] + public void DNET274() + { + for (int i = 1000; i < 21000; i++) + { + new FbCommand() { CommandText = string.Format("insert into test (INT_FIELD) values ({0})", i), Connection = Connection }.ExecuteNonQuery(); + } + } + + #endregion + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2009-10-03 15:58:40
|
Revision: 1038 http://firebird.svn.sourceforge.net/firebird/?rev=1038&view=rev Author: cincura_net Date: 2009-10-03 15:56:54 +0000 (Sat, 03 Oct 2009) Log Message: ----------- * Conditional for protocol12. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsBlob.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsBlob.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsBlob.cs 2009-10-03 15:56:21 UTC (rev 1037) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsBlob.cs 2009-10-03 15:56:54 UTC (rev 1038) @@ -104,7 +104,7 @@ this.database.Write(IscCodes.op_get_segment); this.database.Write(this.blobHandle); this.database.Write((requested + 2 < short.MaxValue) ? requested + 2 : short.MaxValue); - this.database.Write((int)0); // Data segment + this.database.Write(0); // Data segment this.database.Flush(); GenericResponse response = this.database.ReadGenericResponse(); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs 2009-10-03 15:56:21 UTC (rev 1037) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs 2009-10-03 15:56:54 UTC (rev 1038) @@ -168,6 +168,9 @@ outputStream.Write(1); // Architecture of client - Generic outputStream.Write(database); // Database path +#if (PROTOCOL_VERSION12) + outputStream.Write(3); // Protocol versions understood +#endif outputStream.Write(2); // Protocol versions understood outputStream.WriteBuffer(user_id.ToArray()); // User identification Stuff @@ -183,14 +186,14 @@ outputStream.Write(5); // Maximum type (ptype_lazy_send) outputStream.Write(1); // Preference weight -#if false +#if (PROTOCOL_VERSION12) outputStream.Write(IscCodes.PROTOCOL_VERSION12);// Protocol version outputStream.Write(1); // Architecture of client - Generic outputStream.Write(2); // Minumum type (ptype_rpc) outputStream.Write(5); // Maximum type (ptype_lazy_send) outputStream.Write(2); // Preference weight #endif - } + } outputStream.Flush(); if (inputStream.ReadOperation() == IscCodes.op_accept) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs 2009-10-03 15:56:21 UTC (rev 1037) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs 2009-10-03 15:56:54 UTC (rev 1038) @@ -17,6 +17,8 @@ * All Rights Reserved. */ +#if (PROTOCOL_VERSION12) + using System; using System.Collections; using System.Data; @@ -40,7 +42,7 @@ { // Attach to the database this.Write(IscCodes.op_attach); - this.Write((int)0); // Database object ID + this.Write(0); // Database object ID dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); this.WriteBuffer(Encoding.UTF8.GetBytes(database)); // Database PATH this.WriteBuffer(dpb.ToArray()); // DPB Parameter buffer @@ -49,10 +51,12 @@ protected override void SendCreateToBuffer(DatabaseParameterBuffer dpb, string database) { this.Write(IscCodes.op_create); - this.Write((int)0); + this.Write(0); dpb.Append(IscCodes.isc_dpb_utf8_filename, 0); this.WriteBuffer(Encoding.UTF8.GetBytes(database)); this.WriteBuffer(dpb.ToArray()); } } -} \ No newline at end of file +} + +#endif \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs 2009-10-03 15:56:21 UTC (rev 1037) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs 2009-10-03 15:56:54 UTC (rev 1038) @@ -82,8 +82,10 @@ switch (connection.ProtocolVersion) { +#if (PROTOCOL_VERSION12) case IscCodes.PROTOCOL_VERSION12: return new FirebirdSql.Data.Client.Managed.Version12.GdsDatabase(connection); +#endif case IscCodes.PROTOCOL_VERSION11: return new FirebirdSql.Data.Client.Managed.Version11.GdsDatabase(connection); case IscCodes.PROTOCOL_VERSION10: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2009-10-24 13:48:32
|
Revision: 1056 http://firebird.svn.sourceforge.net/firebird/?rev=1056&view=rev Author: cincura_net Date: 2009-10-24 13:46:48 +0000 (Sat, 24 Oct 2009) Log Message: ----------- Added isc_arith_except. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbValue.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs 2009-10-23 16:23:27 UTC (rev 1055) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs 2009-10-24 13:46:48 UTC (rev 1056) @@ -680,7 +680,7 @@ if ((param.Length % param.Charset.BytesPerCharacter) == 0 && svalue.Length > param.CharCount) { - //throw new IscException(335544321); + //throw new IscException(IscCodes.isc_arith_except); svalue = svalue.Substring(0, param.CharCount); } @@ -700,7 +700,7 @@ if ((param.Length % param.Charset.BytesPerCharacter) == 0 && svalue.Length > param.CharCount) { - //throw new IscException(335544321); + //throw new IscException(IscCodes.isc_arith_except); svalue = svalue.Substring(0, param.CharCount); } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbValue.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbValue.cs 2009-10-23 16:23:27 UTC (rev 1055) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbValue.cs 2009-10-24 13:46:48 UTC (rev 1056) @@ -224,7 +224,7 @@ if ((this.Field.Length % this.Field.Charset.BytesPerCharacter) == 0 && svalue.Length > this.Field.CharCount) { - throw new IscException(335544321); + throw new IscException(IscCodes.isc_arith_except); } byte[] buffer = new byte[this.Field.Length]; @@ -252,7 +252,7 @@ if ((this.Field.Length % this.Field.Charset.BytesPerCharacter) == 0 && svalue.Length > this.Field.CharCount) { - throw new IscException(335544321); + throw new IscException(IscCodes.isc_arith_except); } byte[] sbuffer = this.Field.Charset.GetBytes(svalue); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2009-10-23 16:23:27 UTC (rev 1055) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2009-10-24 13:46:48 UTC (rev 1056) @@ -813,6 +813,7 @@ public const int isc_net_write_err = 335544727; public const int isc_stack_trace = 335544842; public const int isc_except2 = 335544848; + public const int isc_arith_except = 335544321; #endregion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2009-10-24 13:55:41
|
Revision: 1057 http://firebird.svn.sourceforge.net/firebird/?rev=1057&view=rev Author: cincura_net Date: 2009-10-24 13:55:32 +0000 (Sat, 24 Oct 2009) Log Message: ----------- Fixed condition and Debug with PROTOCOL_VERSION12. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs 2009-10-24 13:46:48 UTC (rev 1056) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs 2009-10-24 13:55:32 UTC (rev 1057) @@ -170,8 +170,9 @@ outputStream.Write(database); // Database path #if (PROTOCOL_VERSION12) outputStream.Write(3); // Protocol versions understood +#else + outputStream.Write(2); // Protocol versions understood #endif - outputStream.Write(2); // Protocol versions understood outputStream.WriteBuffer(user_id.ToArray()); // User identification Stuff outputStream.Write(IscCodes.PROTOCOL_VERSION10);// Protocol version Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2009-10-24 13:46:48 UTC (rev 1056) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2009-10-24 13:55:32 UTC (rev 1057) @@ -25,7 +25,7 @@ <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>TRACE;DEBUG;NET_35;ENTITY_FRAMEWORK;</DefineConstants> + <DefineConstants>TRACE;DEBUG;NET_35;ENTITY_FRAMEWORK;PROTOCOL_VERSION12</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-06-05 15:30:44
|
Revision: 51215 http://firebird.svn.sourceforge.net/firebird/?rev=51215&view=rev Author: cincura_net Date: 2010-06-05 15:30:38 +0000 (Sat, 05 Jun 2010) Log Message: ----------- * Removed dependency on System.Web, now using reflection. * Client Profile ready. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs 2010-06-05 15:28:23 UTC (rev 51214) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs 2010-06-05 15:30:38 UTC (rev 51215) @@ -24,6 +24,7 @@ using System.Data; using System.Text; using System.Diagnostics; +using System.IO; using FirebirdSql.Data.Common; using FirebirdSql.Data.Schema; @@ -543,28 +544,56 @@ private string GetProcessName() { #if (NET_CF) - // for CF we can implement GetModuleFileName from coredll - return "fbnetcf"; + // for CF we can implement GetModuleFileName from coredll + return "fbnetcf"; #else - // showing ApplicationPhysicalPath may be wrong because of connection pooling; better idea? - if (System.Web.Hosting.HostingEnvironment.IsHosted) + // showing ApplicationPhysicalPath may be wrong because of connection pooling; better idea? + return GetHostingPath() ?? GetRealProcessName(); +#endif + } + + + private string GetHostingPath() + { +#if (NET_20) + const string assemblyName = "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; +#else + const string assemblyName = "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; +#endif + System.Reflection.Assembly assembly; + try { - return System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath; + assembly = System.Reflection.Assembly.Load(assemblyName); } - else + catch (FileNotFoundException) { - System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly(); - if (assembly != null) - { - return assembly.Location; - } - else // if we're not loaded from managed code - { - return Process.GetCurrentProcess().MainModule.FileName; - } + return null; } -#endif - } + catch (FileLoadException) + { + return null; + } + catch (BadImageFormatException) + { + return null; + } + return (string)assembly + .GetType("System.Web.Hosting.HostingEnvironment") + .GetProperty("ApplicationPhysicalPath") + .GetValue(null, null); + } + private string GetRealProcessName() + { + System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly(); + if (assembly != null) + { + return assembly.Location; + } + else // if we're not loaded from managed code + { + return Process.GetCurrentProcess().MainModule.FileName; + } + } #endregion Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-06-05 15:28:23 UTC (rev 51214) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-06-05 15:30:38 UTC (rev 51215) @@ -33,8 +33,7 @@ <IsWebBootstrapper>false</IsWebBootstrapper> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> - <TargetFrameworkProfile> - </TargetFrameworkProfile> + <TargetFrameworkProfile>Client</TargetFrameworkProfile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -107,7 +106,6 @@ </Reference> <Reference Include="System.Security" /> <Reference Include="System.Transactions" /> - <Reference Include="System.Web" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2009-10-25 15:10:44
|
Revision: 1060 http://firebird.svn.sourceforge.net/firebird/?rev=1060&view=rev Author: cincura_net Date: 2009-10-25 15:10:34 +0000 (Sun, 25 Oct 2009) Log Message: ----------- Initial work on SQLSTATE. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbException.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj Added Paths: ----------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Resources/sqlstate_mapping.resx Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtConnection.cs 2009-10-25 15:07:29 UTC (rev 1059) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtConnection.cs 2009-10-25 15:10:34 UTC (rev 1060) @@ -60,7 +60,7 @@ case IscCodes.isc_arg_end: if (exception != null && exception.Errors.Count != 0) { - exception.BuildExceptionMessage(); + exception.BuildExceptionData(); } eof = true; break; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2009-10-25 15:07:29 UTC (rev 1059) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2009-10-25 15:10:34 UTC (rev 1060) @@ -697,7 +697,7 @@ case IscCodes.isc_arg_end: if (exception != null && exception.Errors.Count != 0) { - exception.BuildExceptionMessage(); + exception.BuildExceptionData(); } eof = true; break; @@ -711,6 +711,10 @@ exception.Errors.Add(new IscError(arg, this.ReadInt32())); break; + case IscCodes.isc_arg_sql_state: + exception.Errors.Add(new IscError(arg, this.ReadString())); + break; + default: { int e = this.ReadInt32(); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesConnection.cs 2009-10-25 15:07:29 UTC (rev 1059) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesConnection.cs 2009-10-25 15:10:34 UTC (rev 1060) @@ -59,7 +59,7 @@ case IscCodes.isc_arg_end: if (exception != null && exception.Errors.Count != 0) { - exception.BuildExceptionMessage(); + exception.BuildExceptionData(); } eof = true; break; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2009-10-25 15:07:29 UTC (rev 1059) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2009-10-25 15:10:34 UTC (rev 1060) @@ -799,6 +799,7 @@ public const int isc_arg_netware = 16; // NetWare error code public const int isc_arg_win32 = 17; // Win32 error code public const int isc_arg_warning = 18; // warning argument + public const int isc_arg_sql_state = 19; // SQLSTATE public const int isc_open_trans = 335544357; public const int isc_segment = 335544366; @@ -823,7 +824,7 @@ public const int blr_begin = 2; public const int blr_message = 4; public const int blr_eoc = 76; - public const int blr_end = 255; /* note: defined as -1 in gds.h */ + public const int blr_end = 255; public const int blr_text = 14; public const int blr_text2 = 15; @@ -844,6 +845,8 @@ public const int blr_sql_date = 12; public const int blr_sql_time = 13; + public const int blr_null = 45; + #endregion #region \xB7 DataType Definitions \xB7 @@ -862,6 +865,7 @@ public const int SQL_TYPE_TIME = 560; public const int SQL_TYPE_DATE = 570; public const int SQL_INT64 = 580; + public const int SQL_NULL = 32766; // Historical alias for pre V6 applications public const int SQL_DATE = SQL_TIMESTAMP; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs 2009-10-25 15:07:29 UTC (rev 1059) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs 2009-10-25 15:10:34 UTC (rev 1060) @@ -57,6 +57,7 @@ case IscCodes.isc_arg_interpreted: case IscCodes.isc_arg_string: case IscCodes.isc_arg_cstring: + case IscCodes.isc_arg_sql_state: return this.strParam; case IscCodes.isc_arg_number: Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs 2009-10-25 15:07:29 UTC (rev 1059) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs 2009-10-25 15:10:34 UTC (rev 1060) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Contributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -31,240 +34,255 @@ namespace FirebirdSql.Data.Common { #if (!NET_CF) - [Serializable] + [Serializable] #endif - internal sealed class IscException : Exception - { - #region \xB7 Fields \xB7 + internal sealed class IscException : Exception + { + #region \xB7 Fields \xB7 + private string _message; + #endregion - private List<IscError> errors; - private int errorCode; - private string message; + #region \xB7 Properties \xB7 - #endregion + public List<IscError> Errors { get; private set; } - #region \xB7 Properties \xB7 + public override string Message + { + get { return _message; } + } - public List<IscError> Errors - { - get - { - if (this.errors == null) - { - this.errors = new List<IscError>(); - } + public int ErrorCode { get; private set; } - return this.errors; - } - } + public string SQLSTATE { get; private set; } - public override string Message - { - get { return this.message; } - } + public bool IsWarning + { + get + { + if (this.Errors.Count > 0) + { + return this.Errors[0].IsWarning; + } + else + { + return false; + } + } + } - public int ErrorCode - { - get { return this.errorCode; } - } + #endregion - public bool IsWarning - { - get - { - if (this.Errors.Count > 0) - { - return this.Errors[0].IsWarning; - } - else - { - return false; - } - } - } + #region \xB7 Constructors \xB7 - #endregion + public IscException() + : base() + { + this.Errors = new List<IscError>(); + } - #region \xB7 Constructors \xB7 + public IscException(int errorCode) + : base() + { + this.Errors.Add(new IscError(IscCodes.isc_arg_gds, errorCode)); - public IscException() - : base() - { - } + this.BuildExceptionData(); + } - public IscException(int errorCode) - : base() - { - this.Errors.Add(new IscError(IscCodes.isc_arg_gds, errorCode)); + public IscException(string strParam) + : base() + { + this.Errors.Add(new IscError(IscCodes.isc_arg_string, strParam)); - this.BuildExceptionMessage(); - } + this.BuildExceptionData(); + } - public IscException(string strParam) - : base() - { - this.Errors.Add(new IscError(IscCodes.isc_arg_string, strParam)); + public IscException(int errorCode, int intparam) + : base() + { + this.Errors.Add(new IscError(IscCodes.isc_arg_gds, errorCode)); + this.Errors.Add(new IscError(IscCodes.isc_arg_number, intparam)); - this.BuildExceptionMessage(); - } + this.BuildExceptionData(); + } - public IscException(int errorCode, int intparam) - : base() - { - this.Errors.Add(new IscError(IscCodes.isc_arg_gds, errorCode)); - this.Errors.Add(new IscError(IscCodes.isc_arg_number, intparam)); + public IscException(int type, int errorCode, string strParam) + : base() + { + this.Errors.Add(new IscError(type, errorCode)); + this.Errors.Add(new IscError(IscCodes.isc_arg_string, strParam)); - this.BuildExceptionMessage(); - } + this.BuildExceptionData(); + } - public IscException(int type, int errorCode, string strParam) - : base() - { - this.Errors.Add(new IscError(type, errorCode)); - this.Errors.Add(new IscError(IscCodes.isc_arg_string, strParam)); + public IscException(int type, int errorCode, int intParam, string strParam) + : base() + { + this.Errors.Add(new IscError(type, errorCode)); + this.Errors.Add(new IscError(IscCodes.isc_arg_number, intParam)); + this.Errors.Add(new IscError(IscCodes.isc_arg_string, strParam)); - this.BuildExceptionMessage(); - } + this.BuildExceptionData(); + } - public IscException(int type, int errorCode, int intParam, string strParam) - : base() - { - this.Errors.Add(new IscError(type, errorCode)); - this.Errors.Add(new IscError(IscCodes.isc_arg_number, intParam)); - this.Errors.Add(new IscError(IscCodes.isc_arg_string, strParam)); +#warning Create ctor with SQLSTATE - this.BuildExceptionMessage(); - } +#if (!NET_CF) + internal IscException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + this.Errors = (List<IscError>)info.GetValue("errors", typeof(List<IscError>)); + this.ErrorCode = info.GetInt32("errorCode"); + } + +#endif + + #endregion + + #region \xB7 Public Methods \xB7 + + public void BuildExceptionData() + { + this.BuildErrorCode(); + this.BuildSqlState(); + this.BuildExceptionMessage(); + } + #if (!NET_CF) - internal IscException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - this.errors = (List<IscError>)info.GetValue("errors", typeof(List<IscError>)); - this.errorCode = info.GetInt32("errorCode"); - } + [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + info.AddValue("errors", this.Errors); + info.AddValue("errorCode", this.ErrorCode); + base.GetObjectData(info, context); + } + #endif - #endregion + public override string ToString() + { + return _message; + } - #region \xB7 Methods \xB7 + #endregion - public void BuildExceptionMessage() - { - string resources = "FirebirdSql.Resources.isc_error_msg"; + #region \xB7 Private Methods \xB7 - StringBuilder builder = new StringBuilder(); - ResourceManager rm = new ResourceManager(resources, Assembly.GetExecutingAssembly()); + private void BuildErrorCode() + { + this.ErrorCode = (this.Errors.Count != 0 ? this.Errors[0].ErrorCode : 0); + } - this.errorCode = (this.Errors.Count != 0) ? this.Errors[0].ErrorCode : 0; + private void BuildSqlState() + { + IscError error = this.Errors.Find(e => e.Type == IscCodes.isc_arg_sql_state); + // step #1, maybe we already have a SQLSTATE stuffed in the status vector + if (error != null) + { + this.SQLSTATE = error.StrParam; + } + // step #2, see if we can find a mapping. + else + { + ResourceManager rm = new ResourceManager("FirebirdSql.Resources.sqlstate_mapping", Assembly.GetExecutingAssembly()); + this.SQLSTATE = rm.GetString(this.ErrorCode.ToString()); + } + } - for (int i = 0; i < this.Errors.Count; i++) - { - if (this.Errors[i].Type == IscCodes.isc_arg_gds || - this.Errors[i].Type == IscCodes.isc_arg_warning) - { - int code = this.Errors[i].ErrorCode; - string message = null; + private void BuildExceptionMessage() + { + StringBuilder builder = new StringBuilder(); + ResourceManager rm = new ResourceManager("FirebirdSql.Resources.isc_error_msg", Assembly.GetExecutingAssembly()); - try - { - message = rm.GetString(code.ToString()); - } - catch - { - message = string.Format(CultureInfo.CurrentCulture, "No message for error code {0} found.", code); - } + for (int i = 0; i < this.Errors.Count; i++) + { + if (this.Errors[i].Type == IscCodes.isc_arg_gds || + this.Errors[i].Type == IscCodes.isc_arg_warning) + { + int code = this.Errors[i].ErrorCode; + string message = null; - ArrayList param = new ArrayList(); + try + { + message = rm.GetString(code.ToString()); + } + catch + { + message = string.Format(CultureInfo.CurrentCulture, "No message for error code {0} found.", code); + } - int index = i + 1; + ArrayList param = new ArrayList(); - while (index < this.Errors.Count && this.Errors[index].IsArgument) - { - param.Add(this.Errors[index++].StrParam); - i++; - } + int index = i + 1; - object[] args = (object[])param.ToArray(typeof(object)); + while (index < this.Errors.Count && this.Errors[index].IsArgument) + { + param.Add(this.Errors[index++].StrParam); + i++; + } - try - { - if (code == IscCodes.isc_except) - { - // Custom exception add the first argument as error code - this.errorCode = Convert.ToInt32(args[0], CultureInfo.InvariantCulture); - } - else if (code == IscCodes.isc_except2) - { - // Custom exception. Next Error should be the exception name. - // And the next one the Exception message - } - else if (code == IscCodes.isc_stack_trace) - { - // The next error contains the PSQL Stack Trace - if (builder.Length > 0) - { + object[] args = (object[])param.ToArray(typeof(object)); + + try + { + if (code == IscCodes.isc_except) + { + // Custom exception add the first argument as error code + this.ErrorCode = Convert.ToInt32(args[0], CultureInfo.InvariantCulture); + } + else if (code == IscCodes.isc_except2) + { + // Custom exception. Next Error should be the exception name. + // And the next one the Exception message + } + else if (code == IscCodes.isc_stack_trace) + { + // The next error contains the PSQL Stack Trace + if (builder.Length > 0) + { #if (NET_CF) builder.Append("\r\n"); #else - builder.Append(Environment.NewLine); + builder.Append(Environment.NewLine); #endif - } - builder.AppendFormat(CultureInfo.CurrentCulture, "{0}", args); - } - else - { - if (builder.Length > 0) - { + } + builder.AppendFormat(CultureInfo.CurrentCulture, "{0}", args); + } + else + { + if (builder.Length > 0) + { #if (NET_CF) builder.Append("\r\n"); #else - builder.Append(Environment.NewLine); + builder.Append(Environment.NewLine); #endif - } + } - builder.AppendFormat(CultureInfo.CurrentCulture, message, args); - } - } - catch - { - message = string.Format(CultureInfo.CurrentCulture, "No message for error code {0} found.", code); + builder.AppendFormat(CultureInfo.CurrentCulture, message, args); + } + } + catch + { + message = string.Format(CultureInfo.CurrentCulture, "No message for error code {0} found.", code); - builder.AppendFormat(CultureInfo.CurrentCulture, message, args); - } - } - } + builder.AppendFormat(CultureInfo.CurrentCulture, message, args); + } + } + } - // Update error collection only with the main error - IscError mainError = new IscError(this.errorCode); - mainError.Message = builder.ToString(); + // Update error collection only with the main error + IscError mainError = new IscError(this.ErrorCode); + mainError.Message = builder.ToString(); - this.Errors.Add(mainError); + this.Errors.Add(mainError); - // Update exception message - this.message = builder.ToString(); - } + // Update exception message + _message = builder.ToString(); + } -#if (!NET_CF) - - [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - info.AddValue("errors", this.Errors); - info.AddValue("errorCode", this.ErrorCode); - - base.GetObjectData(info, context); - } - -#endif - - public override string ToString() - { - return this.message; - } - - #endregion - } + #endregion + } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbException.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbException.cs 2009-10-25 15:07:29 UTC (rev 1059) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbException.cs 2009-10-25 15:10:34 UTC (rev 1060) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Contributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -27,107 +30,120 @@ namespace FirebirdSql.Data.FirebirdClient { - [Serializable] - public sealed class FbException : DbException - { - #region \xB7 Fields \xB7 + [Serializable] + public sealed class FbException : DbException + { + #region \xB7 Fields \xB7 - private FbErrorCollection errors; + private FbErrorCollection errors; - #endregion + #endregion - #region \xB7 Properties \xB7 + #region \xB7 Properties \xB7 #if (!NET_CF) - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] #endif - public FbErrorCollection Errors - { - get - { - if (this.errors == null) - { - this.errors = new FbErrorCollection(); - } + public FbErrorCollection Errors + { + get + { + if (this.errors == null) + { + this.errors = new FbErrorCollection(); + } - return this.errors; - } - } + return this.errors; + } + } - public override int ErrorCode - { - get - { - if ((this.InnerException != null) && (this.InnerException is IscException)) - { - return ((IscException)this.InnerException).ErrorCode; - } + public override int ErrorCode + { + get + { + if ((this.InnerException != null) && (this.InnerException is IscException)) + { + return ((IscException)this.InnerException).ErrorCode; + } - return base.ErrorCode; - } - } + return base.ErrorCode; + } + } - #endregion + public string SQLSTATE + { + get + { + if ((this.InnerException != null) && (this.InnerException is IscException)) + { + return ((IscException)this.InnerException).SQLSTATE; + } - #region \xB7 Constructors \xB7 + return null; + } + } - internal FbException() - : base() - { - } + #endregion - internal FbException(string message) - : base(message) - { - } + #region \xB7 Constructors \xB7 - internal FbException(string message, Exception innerException) - : base(message, innerException) - { - if (innerException is IscException) - { - this.ProcessIscExceptionErrors((IscException)innerException); - } - } + internal FbException() + : base() + { + } + internal FbException(string message) + : base(message) + { + } + + internal FbException(string message, Exception innerException) + : base(message, innerException) + { + if (innerException is IscException) + { + this.ProcessIscExceptionErrors((IscException)innerException); + } + } + #if (!NET_CF) - internal FbException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - this.errors = (FbErrorCollection)info.GetValue("errors", typeof(FbErrorCollection)); - } + internal FbException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + this.errors = (FbErrorCollection)info.GetValue("errors", typeof(FbErrorCollection)); + } #endif - #endregion + #endregion - #region \xB7 Methods \xB7 + #region \xB7 Methods \xB7 #if (!NET_CF) - [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - info.AddValue("errors", this.errors); + [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + info.AddValue("errors", this.errors); - base.GetObjectData(info, context); - } + base.GetObjectData(info, context); + } #endif - #endregion + #endregion - #region \xB7 Internal Methods \xB7 + #region \xB7 Internal Methods \xB7 - internal void ProcessIscExceptionErrors(IscException innerException) - { - foreach (IscError error in innerException.Errors) - { - this.Errors.Add(error.Message, error.ErrorCode); - } - } + internal void ProcessIscExceptionErrors(IscException innerException) + { + foreach (IscError error in innerException.Errors) + { + this.Errors.Add(error.Message, error.ErrorCode); + } + } - #endregion - } + #endregion + } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2009-10-25 15:07:29 UTC (rev 1059) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2009-10-25 15:10:34 UTC (rev 1060) @@ -304,6 +304,9 @@ <EmbeddedResource Include="Resources\isc_error_msg.resx"> <SubType>Designer</SubType> </EmbeddedResource> + <EmbeddedResource Include="Resources\sqlstate_mapping.resx"> + <SubType>Designer</SubType> + </EmbeddedResource> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <PropertyGroup> Added: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Resources/sqlstate_mapping.resx =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Resources/sqlstate_mapping.resx (rev 0) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Resources/sqlstate_mapping.resx 2009-10-25 15:10:34 UTC (rev 1060) @@ -0,0 +1,2982 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="335544321" xml:space="preserve"> + <value>22000</value> + </data> + <data name="335544322" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544323" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544324" xml:space="preserve"> + <value>08003</value> + </data> + <data name="335544325" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544326" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544327" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544328" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544329" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544330" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544331" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544332" xml:space="preserve"> + <value>08003</value> + </data> + <data name="335544333" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544334" xml:space="preserve"> + <value>22018</value> + </data> + <data name="335544335" xml:space="preserve"> + <value>XX001</value> + </data> + <data name="335544336" xml:space="preserve"> + <value>40001</value> + </data> + <data name="335544337" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544338" xml:space="preserve"> + <value>01000</value> + </data> + <data name="335544339" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544340" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544341" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544342" xml:space="preserve"> + <value>27000</value> + </data> + <data name="335544343" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544344" xml:space="preserve"> + <value>08001</value> + </data> + <data name="335544345" xml:space="preserve"> + <value>40001</value> + </data> + <data name="335544346" xml:space="preserve"> + <value>XX001</value> + </data> + <data name="335544347" xml:space="preserve"> + <value>23000</value> + </data> + <data name="335544348" xml:space="preserve"> + <value>22000</value> + </data> + <data name="335544349" xml:space="preserve"> + <value>23000</value> + </data> + <data name="335544350" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544351" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544352" xml:space="preserve"> + <value>28000</value> + </data> + <data name="335544353" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544354" xml:space="preserve"> + <value>01000</value> + </data> + <data name="335544355" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544356" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544357" xml:space="preserve"> + <value>01002</value> + </data> + <data name="335544358" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544359" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544360" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544361" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544362" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544363" xml:space="preserve"> + <value>25000</value> + </data> + <data name="335544364" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544365" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544366" xml:space="preserve"> + <value>01000</value> + </data> + <data name="335544367" xml:space="preserve"> + <value>01000</value> + </data> + <data name="335544368" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544369" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544370" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544371" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544372" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544373" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544374" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544375" xml:space="preserve"> + <value>08001</value> + </data> + <data name="335544376" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544377" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544378" xml:space="preserve"> + <value>0A000</value> + </data> + <data name="335544379" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544380" xml:space="preserve"> + <value>07002</value> + </data> + <data name="335544381" xml:space="preserve"> + <value>54000</value> + </data> + <data name="335544382" xml:space="preserve"> + <value>00000</value> + </data> + <data name="335544383" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544384" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544385" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544386" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544387" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544388" xml:space="preserve"> + <value>54000</value> + </data> + <data name="335544389" xml:space="preserve"> + <value>HY001</value> + </data> + <data name="335544390" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544391" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544392" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544393" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544394" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544395" xml:space="preserve"> + <value>42S02</value> + </data> + <data name="335544396" xml:space="preserve"> + <value>42S22</value> + </data> + <data name="335544397" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544398" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544399" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544400" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544401" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544402" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544403" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544404" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544405" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544406" xml:space="preserve"> + <value>XX002</value> + </data> + <data name="335544407" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544408" xml:space="preserve"> + <value>25000</value> + </data> + <data name="335544409" xml:space="preserve"> + <value>25000</value> + </data> + <data name="335544410" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544411" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544412" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544413" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544414" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544415" xml:space="preserve"> + <value>XX001</value> + </data> + <data name="335544416" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544417" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544418" xml:space="preserve"> + <value>25000</value> + </data> + <data name="335544419" xml:space="preserve"> + <value>25000</value> + </data> + <data name="335544420" xml:space="preserve"> + <value>25000</value> + </data> + <data name="335544421" xml:space="preserve"> + <value>08004</value> + </data> + <data name="335544422" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544423" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544424" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544425" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544426" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544427" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544428" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544429" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544430" xml:space="preserve"> + <value>HY001</value> + </data> + <data name="335544431" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544432" xml:space="preserve"> + <value>40001</value> + </data> + <data name="335544433" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544434" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544435" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544436" xml:space="preserve"> + <value>00000</value> + </data> + <data name="335544437" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544438" xml:space="preserve"> + <value>39000</value> + </data> + <data name="335544439" xml:space="preserve"> + <value>39000</value> + </data> + <data name="335544440" xml:space="preserve"> + <value>22001</value> + </data> + <data name="335544441" xml:space="preserve"> + <value>08007</value> + </data> + <data name="335544442" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544443" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544444" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544445" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544446" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544447" xml:space="preserve"> + <value>25S02</value> + </data> + <data name="335544448" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544449" xml:space="preserve"> + <value>28000</value> + </data> + <data name="335544450" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544451" xml:space="preserve"> + <value>40001</value> + </data> + <data name="335544452" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544453" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544454" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544455" xml:space="preserve"> + <value>00000</value> + </data> + <data name="335544456" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544457" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544458" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544459" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544460" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544461" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544462" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544463" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544464" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544465" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544466" xml:space="preserve"> + <value>23000</value> + </data> + <data name="335544467" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544468" xml:space="preserve"> + <value>00000</value> + </data> + <data name="335544469" xml:space="preserve"> + <value>25000</value> + </data> + <data name="335544470" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544471" xml:space="preserve"> + <value>42S12</value> + </data> + <data name="335544472" xml:space="preserve"> + <value>28000</value> + </data> + <data name="335544473" xml:space="preserve"> + <value>HY111</value> + </data> + <data name="335544474" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544475" xml:space="preserve"> + <value>40001</value> + </data> + <data name="335544476" xml:space="preserve"> + <value>40001</value> + </data> + <data name="335544477" xml:space="preserve"> + <value>54000</value> + </data> + <data name="335544478" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544479" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544480" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544481" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544482" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544483" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544484" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544485" xml:space="preserve"> + <value>26000</value> + </data> + <data name="335544486" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544487" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544488" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544489" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544490" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544491" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544492" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544493" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544494" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544495" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544496" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544497" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544498" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544499" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544500" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544501" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544502" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544503" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544504" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544505" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544506" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544507" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544508" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544509" xml:space="preserve"> + <value>2C000</value> + </data> + <data name="335544510" xml:space="preserve"> + <value>40001</value> + </data> + <data name="335544511" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544512" xml:space="preserve"> + <value>07001</value> + </data> + <data name="335544513" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544514" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544515" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544516" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544517" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544518" xml:space="preserve"> + <value>HY013</value> + </data> + <data name="335544519" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544520" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544521" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544522" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544523" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544524" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544525" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544526" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544527" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544528" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544529" xml:space="preserve"> + <value>28000</value> + </data> + <data name="335544530" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544531" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544532" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544533" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544534" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544535" xml:space="preserve"> + <value>44000</value> + </data> + <data name="335544536" xml:space="preserve"> + <value>44000</value> + </data> + <data name="335544537" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544538" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544539" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544540" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544541" xml:space="preserve"> + <value>44000</value> + </data> + <data name="335544542" xml:space="preserve"> + <value>44000</value> + </data> + <data name="335544543" xml:space="preserve"> + <value>23000</value> + </data> + <data name="335544544" xml:space="preserve"> + <value>23000</value> + </data> + <data name="335544545" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544546" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544547" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544548" xml:space="preserve"> + <value>42S11</value> + </data> + <data name="335544549" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544550" xml:space="preserve"> + <value>28000</value> + </data> + <data name="335544551" xml:space="preserve"> + <value>01007</value> + </data> + <data name="335544552" xml:space="preserve"> + <value>01007</value> + </data> + <data name="335544553" xml:space="preserve"> + <value>01007</value> + </data> + <data name="335544554" xml:space="preserve"> + <value>28000</value> + </data> + <data name="335544555" xml:space="preserve"> + <value>28000</value> + </data> + <data name="335544556" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544557" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544558" xml:space="preserve"> + <value>23000</value> + </data> + <data name="335544559" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544560" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544561" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544562" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544563" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544564" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544565" xml:space="preserve"> + <value>22018</value> + </data> + <data name="335544566" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544567" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544568" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544569" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544570" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544571" xml:space="preserve"> + <value>HY004</value> + </data> + <data name="335544572" xml:space="preserve"> + <value>HY015</value> + </data> + <data name="335544573" xml:space="preserve"> + <value>HY004</value> + </data> + <data name="335544574" xml:space="preserve"> + <value>34000</value> + </data> + <data name="335544575" xml:space="preserve"> + <value>24000</value> + </data> + <data name="335544576" xml:space="preserve"> + <value>24000</value> + </data> + <data name="335544577" xml:space="preserve"> + <value>24000</value> + </data> + <data name="335544578" xml:space="preserve"> + <value>42S22</value> + </data> + <data name="335544579" xml:space="preserve"> + <value>XX000</value> + </data> + <data name="335544580" xml:space="preserve"> + <value>42S02</value> + </data> + <data name="335544581" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544582" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544583" xml:space="preserve"> + <value>07002</value> + </data> + <data name="335544584" xml:space="preserve"> + <value>21S01</value> + </data> + <data name="335544585" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544586" xml:space="preserve"> + <value>39000</value> + </data> + <data name="335544587" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544588" xml:space="preserve"> + <value>22021</value> + </data> + <data name="335544589" xml:space="preserve"> + <value>22021</value> + </data> + <data name="335544590" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544591" xml:space="preserve"> + <value>25000</value> + </data> + <data name="335544592" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544593" xml:space="preserve"> + <value>54000</value> + </data> + <data name="335544594" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544595" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544596" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544597" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544598" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544599" xml:space="preserve"> + <value>07002</value> + </data> + <data name="335544600" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544601" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544602" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544603" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544604" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544605" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544606" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544607" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544608" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544609" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544610" xml:space="preserve"> + <value>22000</value> + </data> + <data name="335544611" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544612" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544613" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544614" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544615" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544616" xml:space="preserve"> + <value>42S22</value> + </data> + <data name="335544617" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544618" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544619" xml:space="preserve"> + <value>38000</value> + </data> + <data name="335544620" xml:space="preserve"> + <value>08001</value> + </data> + <data name="335544621" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544622" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544623" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544624" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544625" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544626" xml:space="preserve"> + <value>00000</value> + </data> + <data name="335544627" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544628" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544629" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544630" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544631" xml:space="preserve"> + <value>54011</value> + </data> + <data name="335544632" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544633" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544634" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544635" xml:space="preserve"> + <value>42S02</value> + </data> + <data name="335544636" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544637" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544638" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544639" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544640" xml:space="preserve"> + <value>22021</value> + </data> + <data name="335544641" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544642" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544643" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544644" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544645" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544646" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544647" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544648" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544649" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544650" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="335544651" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544652" xml:space="preserve"> + <value>21000</value> + </data> + <data name="335544653" xml:space="preserve"> + <value>28000</value> + </data> + <data name="335544654" xml:space="preserve"> + <value>28000</value> + </data> + <data name="335544655" xml:space="preserve"> + <value>42000</value> + </data> + <data name="335544656" xml:space="preserve"> + <value>HY000</value> + </data> + <data name="33554... [truncated message content] |
From: <cin...@us...> - 2009-10-25 15:20:34
|
Revision: 1061 http://firebird.svn.sourceforge.net/firebird/?rev=1061&view=rev Author: cincura_net Date: 2009-10-25 15:20:27 +0000 (Sun, 25 Oct 2009) Log Message: ----------- Code formatting and contrib. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtConnection.cs 2009-10-25 15:10:34 UTC (rev 1060) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/ExternalEngine/ExtConnection.cs 2009-10-25 15:20:27 UTC (rev 1061) @@ -14,6 +14,9 @@ * * Copyright (c) 2005 Carlos Guzman Alvarez * All Rights Reserved. + * + * Contributors: + * Jiri Cincura (ji...@ci...) */ #if (!NET_CF) @@ -92,18 +95,16 @@ break; default: - { - int e = statusVector[i++]; - if (e != 0) - { - if (exception == null) - { - exception = new IscException(); - } - exception.Errors.Add(new IscError(arg, e)); - } - } - break; + int e = statusVector[i++]; + if (e != 0) + { + if (exception == null) + { + exception = new IscException(); + } + exception.Errors.Add(new IscError(arg, e)); + } + break; } if (eof) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2009-10-25 15:10:34 UTC (rev 1060) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2009-10-25 15:20:27 UTC (rev 1061) @@ -715,19 +715,17 @@ exception.Errors.Add(new IscError(arg, this.ReadString())); break; - default: - { - int e = this.ReadInt32(); - if (e != 0) - { - if (exception == null) - { - exception = new IscException(); - } - exception.Errors.Add(new IscError(arg, e)); - } - } - break; + default: + int e = this.ReadInt32(); + if (e != 0) + { + if (exception == null) + { + exception = new IscException(); + } + exception.Errors.Add(new IscError(arg, e)); + } + break; } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesConnection.cs 2009-10-25 15:10:34 UTC (rev 1060) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Native/FesConnection.cs 2009-10-25 15:20:27 UTC (rev 1061) @@ -95,17 +95,15 @@ break; default: - { - IntPtr e = statusVector[i++]; - if (e != IntPtr.Zero) - { - if (exception == null) - { - exception = new IscException(); - } - exception.Errors.Add(new IscError(arg.ToInt32(), e.ToInt32())); - } - } + IntPtr e = statusVector[i++]; + if (e != IntPtr.Zero) + { + if (exception == null) + { + exception = new IscException(); + } + exception.Errors.Add(new IscError(arg.ToInt32(), e.ToInt32())); + } break; } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs 2009-10-25 15:10:34 UTC (rev 1060) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscError.cs 2009-10-25 15:20:27 UTC (rev 1061) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Contributors: + * Jiri Cincura (ji...@ci...) */ using System; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2009-11-02 09:43:31
|
Revision: 1067 http://firebird.svn.sourceforge.net/firebird/?rev=1067&view=rev Author: cincura_net Date: 2009-11-02 09:41:47 +0000 (Mon, 02 Nov 2009) Log Message: ----------- Work on DNET-222. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbDataType.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/Descriptor.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs 2009-10-31 18:20:00 UTC (rev 1066) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs 2009-11-02 09:41:47 UTC (rev 1067) @@ -662,108 +662,111 @@ public void Write(DbField param) { - param.FixNull(); - try { - switch (param.DbDataType) + if (param.DbDataType != DbDataType.Null) { - case DbDataType.Char: - if (param.Charset.IsOctetsCharset) - { - this.WriteOpaque(param.DbValue.GetBinary(), param.Length); - } - else - { - string svalue = param.DbValue.GetString(); + param.FixNull(); - if ((param.Length % param.Charset.BytesPerCharacter) == 0 && - svalue.Length > param.CharCount) - { - //throw new IscException(IscCodes.isc_arith_except); - svalue = svalue.Substring(0, param.CharCount); - } + switch (param.DbDataType) + { + case DbDataType.Char: + if (param.Charset.IsOctetsCharset) + { + this.WriteOpaque(param.DbValue.GetBinary(), param.Length); + } + else + { + string svalue = param.DbValue.GetString(); - this.WriteOpaque(param.Charset.GetBytes(svalue), param.Length); - } - break; + if ((param.Length % param.Charset.BytesPerCharacter) == 0 && + svalue.Length > param.CharCount) + { + //throw new IscException(IscCodes.isc_arith_except); + svalue = svalue.Substring(0, param.CharCount); + } - case DbDataType.VarChar: - if (param.Charset.IsOctetsCharset) - { - this.WriteOpaque(param.DbValue.GetBinary(), param.Length); - } - else - { - string svalue = param.DbValue.GetString(); + this.WriteOpaque(param.Charset.GetBytes(svalue), param.Length); + } + break; - if ((param.Length % param.Charset.BytesPerCharacter) == 0 && - svalue.Length > param.CharCount) - { - //throw new IscException(IscCodes.isc_arith_except); - svalue = svalue.Substring(0, param.CharCount); - } + case DbDataType.VarChar: + if (param.Charset.IsOctetsCharset) + { + this.WriteOpaque(param.DbValue.GetBinary(), param.Length); + } + else + { + string svalue = param.DbValue.GetString(); - byte[] data = param.Charset.GetBytes(svalue); + if ((param.Length % param.Charset.BytesPerCharacter) == 0 && + svalue.Length > param.CharCount) + { + //throw new IscException(IscCodes.isc_arith_except); + svalue = svalue.Substring(0, param.CharCount); + } - this.WriteBuffer(data, data.Length); - } - break; + byte[] data = param.Charset.GetBytes(svalue); - case DbDataType.SmallInt: - this.Write(param.DbValue.GetInt16()); - break; + this.WriteBuffer(data, data.Length); + } + break; - case DbDataType.Integer: - this.Write(param.DbValue.GetInt32()); - break; + case DbDataType.SmallInt: + this.Write(param.DbValue.GetInt16()); + break; - case DbDataType.BigInt: - case DbDataType.Array: - case DbDataType.Binary: - case DbDataType.Text: - this.Write(param.DbValue.GetInt64()); - break; + case DbDataType.Integer: + this.Write(param.DbValue.GetInt32()); + break; - case DbDataType.Decimal: - case DbDataType.Numeric: - this.Write( - param.DbValue.GetDecimal(), - param.DataType, - param.NumericScale); - break; + case DbDataType.BigInt: + case DbDataType.Array: + case DbDataType.Binary: + case DbDataType.Text: + this.Write(param.DbValue.GetInt64()); + break; - case DbDataType.Float: - this.Write(param.DbValue.GetFloat()); - break; + case DbDataType.Decimal: + case DbDataType.Numeric: + this.Write( + param.DbValue.GetDecimal(), + param.DataType, + param.NumericScale); + break; - case DbDataType.Guid: - this.WriteOpaque(param.DbValue.GetGuid().ToByteArray()); - break; + case DbDataType.Float: + this.Write(param.DbValue.GetFloat()); + break; - case DbDataType.Double: - this.Write(param.DbValue.GetDouble()); - break; + case DbDataType.Guid: + this.WriteOpaque(param.DbValue.GetGuid().ToByteArray()); + break; - case DbDataType.Date: - this.Write(param.DbValue.GetDate()); - break; + case DbDataType.Double: + this.Write(param.DbValue.GetDouble()); + break; - case DbDataType.Time: - this.Write(param.DbValue.GetTime()); - break; + case DbDataType.Date: + this.Write(param.DbValue.GetDate()); + break; - case DbDataType.TimeStamp: - this.Write(param.DbValue.GetDate()); - this.Write(param.DbValue.GetTime()); - break; + case DbDataType.Time: + this.Write(param.DbValue.GetTime()); + break; - case DbDataType.Boolean: - this.Write(Convert.ToBoolean(param.Value)); - break; + case DbDataType.TimeStamp: + this.Write(param.DbValue.GetDate()); + this.Write(param.DbValue.GetTime()); + break; - default: - throw new IscException("Unknown sql data type: " + param.DataType); + case DbDataType.Boolean: + this.Write(Convert.ToBoolean(param.Value)); + break; + + default: + throw new IscException("Unknown sql data type: " + param.DataType); + } } this.Write(param.NullFlag); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbDataType.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbDataType.cs 2009-10-31 18:20:00 UTC (rev 1066) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbDataType.cs 2009-11-02 09:41:47 UTC (rev 1067) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Contributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -38,6 +41,7 @@ Text, Time, TimeStamp, - VarChar + VarChar, + Null } } \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/Descriptor.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/Descriptor.cs 2009-10-31 18:20:00 UTC (rev 1066) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/Descriptor.cs 2009-11-02 09:41:47 UTC (rev 1067) @@ -215,10 +215,16 @@ case IscCodes.SQL_QUAD: blr.WriteByte(IscCodes.blr_quad); blr.WriteByte((byte)this.fields[i].NumericScale); - break; + break; + + case IscCodes.SQL_NULL: + blr.WriteByte(IscCodes.blr_text); + blr.WriteByte((byte)(len & 255)); + blr.WriteByte((byte)(len >> 8)); + break; } - - blr.WriteByte(IscCodes.blr_short); + + blr.WriteByte(IscCodes.blr_short); blr.WriteByte(0); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-02-07 15:49:54
|
Revision: 1081 http://firebird.svn.sourceforge.net/firebird/?rev=1081&view=rev Author: cincura_net Date: 2010-02-07 15:49:47 +0000 (Sun, 07 Feb 2010) Log Message: ----------- * Work on op_cancel packet (work-in-progress). * Small code cleanup. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsStatement.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsStatement.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj Added Paths: ----------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -353,7 +353,7 @@ this.WriteBuffer(dpb.ToArray()); } - protected virtual void ProcessCreateResponse(GenericResponse response) + protected void ProcessCreateResponse(GenericResponse response) { this.handle = response.ObjectHandle; } @@ -561,6 +561,15 @@ #endregion + #region \xB7 Cancel Methods \xB7 + + public virtual void CancelOperation(int kind) + { + throw new NotSupportedException("Cancel Operation isn't supported on protocol 10."); + } + + #endregion + #region \xB7 Statement Creation Methods \xB7 public virtual StatementBase CreateStatement() @@ -834,10 +843,8 @@ } protected void ProcessReleaseObjectResponse(IResponse response) - { + { } - } - #endregion #region \xB7 Read Members \xB7 Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsStatement.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsStatement.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsStatement.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -40,7 +40,6 @@ protected bool allRowsFetched; private Queue<DbValue[]> rows; private Queue<DbValue[]> outputParams; - private int recordsAffected; private int fetchSize; private bool returnRecordsAffected; @@ -91,11 +90,7 @@ get { return this.fields; } } - public override int RecordsAffected - { - get { return this.recordsAffected; } - protected set { this.recordsAffected = value; } - } + public override int RecordsAffected { get; protected set; } public override bool IsPrepared { @@ -157,7 +152,7 @@ } this.handle = IscCodes.INVALID_OBJECT; - this.recordsAffected = -1; + this.RecordsAffected = -1; this.fetchSize = 200; this.rows = new Queue<DbValue[]>(); this.outputParams = new Queue<DbValue[]>(); @@ -208,7 +203,7 @@ this.statementType = DbStatementType.None; this.handle = 0; this.fetchSize = 0; - this.recordsAffected = 0; + this.RecordsAffected = 0; } base.Dispose(disposing); @@ -307,7 +302,7 @@ { try { - this.recordsAffected = -1; + this.RecordsAffected = -1; this.SendExecuteToBuffer(); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -111,7 +111,7 @@ dpb.Append(IscCodes.isc_dpb_trusted_auth, authData); } - protected virtual void ProcessTrustedAuthResponse(SSPIHelper sspiHelper, ref IResponse response) + protected void ProcessTrustedAuthResponse(SSPIHelper sspiHelper, ref IResponse response) { while (response is AuthResponse) { Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsStatement.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsStatement.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsStatement.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -24,7 +24,6 @@ using System.IO; using FirebirdSql.Data.Common; -using FirebirdSql.Data.Client.Managed.Version10; namespace FirebirdSql.Data.Client.Managed.Version11 { @@ -146,8 +145,8 @@ if (this.StatementType == DbStatementType.StoredProcedure) { numberOfResponses--; - sqlStoredProcedureResponse = this.database.ReadSqlResponse(); - this.ProcessStoredProcedureExecuteResponse(sqlStoredProcedureResponse); + sqlStoredProcedureResponse = this.database.ReadSqlResponse(); + this.ProcessStoredProcedureExecuteResponse(sqlStoredProcedureResponse); } numberOfResponses--; @@ -161,7 +160,7 @@ } this.ProcessExecuteResponse(executeResponse); - if (rowsAffectedResponse != null) + if (readRowsAffectedResponse) this.RecordsAffected = this.ProcessRecordsAffectedBuffer(this.ProcessInfoSqlResponse(rowsAffectedResponse)); } finally @@ -181,25 +180,21 @@ #endregion - #region \xB7 Private Methods \xB7 + #region Protected methods + protected void SafeFinishFetching(ref int numberOfResponses) + { + while (numberOfResponses > 0) + { + numberOfResponses--; + try + { + this.database.ReadResponse(); + } + catch (IscException) + { } + } + } - private void SafeFinishFetching(ref int numberOfResponses) - { - while (numberOfResponses > 0) - { - numberOfResponses--; - try - { - this.database.ReadResponse(); - } - catch (IscException) - { } - } - } - - #endregion - - #region Protected methods protected override void Free(int option) { if (FreeNotNeeded(option)) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -56,6 +56,44 @@ this.WriteBuffer(Encoding.UTF8.GetBytes(database)); this.WriteBuffer(dpb.ToArray()); } + + #region \xB7 Override Statement Creation Methods \xB7 + + public override StatementBase CreateStatement() + { + return new GdsStatement(this); + } + + public override StatementBase CreateStatement(ITransaction transaction) + { + return new GdsStatement(this, transaction); + } + + #endregion + + #region \xB7 Cancel Methods \xB7 + + public override void CancelOperation(int kind) + { + try + { + SendCancelOperationToBuffer(kind); + this.Flush(); + // no response, this is async + } + catch (IOException) + { + throw new IscException(IscCodes.isc_network_error); + } + } + + protected void SendCancelOperationToBuffer(int kind) + { + this.Write(IscCodes.op_cancel); + this.Write(kind); + } + + #endregion } } Added: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs (rev 0) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -0,0 +1,43 @@ +/* + * 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) 2010 Jiri Cincura (ji...@ci...) + * All Rights Reserved. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; + +using FirebirdSql.Data.Common; + +namespace FirebirdSql.Data.Client.Managed.Version12 +{ + internal class GdsStatement : Version11.GdsStatement + { + #region \xB7 Constructors \xB7 + + public GdsStatement(IDatabase db) + : base(db) + { } + + public GdsStatement(IDatabase db, ITransaction transaction) + : base(db, transaction) + { } + + #endregion + } +} Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -247,6 +247,7 @@ public const int op_partial = 89; // packet is not complete - delay processing public const int op_trusted_auth = 90; + public const int op_cancel = 91; #endregion @@ -895,5 +896,12 @@ public const int DTYPE_TYPE_MAX = 20; #endregion - } + + #region Cancel types + public const int fb_cancel_disable = 1; + public const int fb_cancel_enable = 2; + public const int fb_cancel_raise = 3; + public const int fb_cancel_abort = 4; + #endregion + } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-02-07 15:49:47 UTC (rev 1081) @@ -81,6 +81,7 @@ <Compile Include="Client\Managed\Version11\AuthResponse.cs" /> <Compile Include="Client\Managed\Version11\SSPIHelper.cs" /> <Compile Include="Client\Managed\Version12\GdsDatabase.cs" /> + <Compile Include="Client\Managed\Version12\GdsStatement.cs" /> <Compile Include="Entity\DmlSqlGenerator.cs" /> <Compile Include="Entity\ExpressionTranslator.cs" /> <Compile Include="Entity\FirstClause.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-03-27 16:12:45
|
Revision: 1089 http://firebird.svn.sourceforge.net/firebird/?rev=1089&view=rev Author: cincura_net Date: 2010-03-27 16:12:35 +0000 (Sat, 27 Mar 2010) Log Message: ----------- * Fixed DNET-300. * Added unit tests. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/FbCommandTests.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs 2010-02-20 12:07:27 UTC (rev 1088) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs 2010-03-27 16:12:35 UTC (rev 1089) @@ -418,7 +418,7 @@ case DbDataType.VarChar: if (field.Charset.IsOctetsCharset) { - fieldValue = this.ReadOpaque(field.Length); + fieldValue = this.ReadBuffer(); } else { Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/FbCommandTests.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/FbCommandTests.cs 2010-02-20 12:07:27 UTC (rev 1088) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/UnitTests/FbCommandTests.cs 2010-03-27 16:12:35 UTC (rev 1089) @@ -25,6 +25,7 @@ using FirebirdSql.Data.FirebirdClient; using NUnit.Framework; +using System.Text; namespace FirebirdSql.Data.UnitTests { @@ -654,6 +655,51 @@ } } + [Test] + public void ReadingVarcharOctets() + { + using (FbCommand cmd = Connection.CreateCommand()) + { + const string data = "1234"; + byte[] read = null; + + cmd.CommandText = string.Format("select cast('{0}' as varchar(10) character set octets) from rdb$database", data); + using (FbDataReader reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + read = (byte[])reader[0]; + } + } + + byte[] expected = Encoding.ASCII.GetBytes(data); + Assert.AreEqual(expected, read); + } + } + + [Test] + public void ReadingCharOctets() + { + using (FbCommand cmd = Connection.CreateCommand()) + { + const string data = "1234"; + byte[] read = null; + + cmd.CommandText = string.Format("select cast('{0}' as char(10) character set octets) from rdb$database", data); + using (FbDataReader reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + read = (byte[])reader[0]; + } + } + + byte[] expected = new byte[10]; + Encoding.ASCII.GetBytes(data).CopyTo(expected, 0); + Assert.AreEqual(expected, read); + } + } + #endregion } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-04-03 14:18:10
|
Revision: 1093 http://firebird.svn.sourceforge.net/firebird/?rev=1093&view=rev Author: cincura_net Date: 2010-04-03 14:18:03 +0000 (Sat, 03 Apr 2010) Log Message: ----------- Func in separate file. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj Added Paths: ----------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/Func.cs Added: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/Func.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/Func.cs (rev 0) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/Func.cs 2010-04-03 14:18:03 UTC (rev 1093) @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FirebirdSql.Data.Common +{ +#if (!NET_35) + delegate TResult Func<TResult>(); + delegate TResult Func<T, TResult>(); +#endif +} Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs 2010-04-03 14:16:21 UTC (rev 1092) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs 2010-04-03 14:18:03 UTC (rev 1093) @@ -804,9 +804,6 @@ return ((behavior & this.commandBehavior) == behavior); } -#if (!NET_35) - delegate TResult Func<TResult>(); -#endif private T CheckedGetValue<T>(Func<T> f) { try Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-04-03 14:16:21 UTC (rev 1092) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-04-03 14:18:03 UTC (rev 1093) @@ -82,6 +82,7 @@ <Compile Include="Client\Managed\Version11\SSPIHelper.cs" /> <Compile Include="Client\Managed\Version12\GdsDatabase.cs" /> <Compile Include="Client\Managed\Version12\GdsStatement.cs" /> + <Compile Include="Common\Func.cs" /> <Compile Include="Entity\DmlSqlGenerator.cs" /> <Compile Include="Entity\ExpressionTranslator.cs" /> <Compile Include="Entity\FirstClause.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-04-03 14:20:48
|
Revision: 1094 http://firebird.svn.sourceforge.net/firebird/?rev=1094&view=rev Author: cincura_net Date: 2010-04-03 14:20:42 +0000 (Sat, 03 Apr 2010) Log Message: ----------- Exposed cancellation to public (DNET-227). Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IDatabase.cs 2010-04-03 14:18:03 UTC (rev 1093) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IDatabase.cs 2010-04-03 14:20:42 UTC (rev 1094) @@ -109,6 +109,8 @@ ITriggerContext GetTriggerContext(); + void CancelOperation(int kind); + #endregion } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2010-04-03 14:18:03 UTC (rev 1093) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2010-04-03 14:20:42 UTC (rev 1094) @@ -28,6 +28,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Collections.Generic; +using System.Runtime.Remoting.Messaging; using FirebirdSql.Data.Common; @@ -455,7 +456,7 @@ public override void Cancel() { - throw new NotSupportedException(); + this.connection.CancelCommand(); } public new FbParameter CreateParameter() @@ -489,122 +490,156 @@ } public override int ExecuteNonQuery() - { - lock (this) - { - this.CheckCommand(); + { + lock (this) + { + this.CheckCommand(); - try - { - this.ExecuteCommand(CommandBehavior.Default); + try + { + this.ExecuteCommand(CommandBehavior.Default); - if (this.statement.StatementType == DbStatementType.StoredProcedure) - { - this.SetOutputParameters(); - } + if (this.statement.StatementType == DbStatementType.StoredProcedure) + { + this.SetOutputParameters(); + } - this.CommitImplicitTransaction(); - } - catch (IscException ex) - { - this.DiscardImplicitTransaction(); + this.CommitImplicitTransaction(); + } + catch (IscException ex) + { + this.DiscardImplicitTransaction(); - throw new FbException(ex.Message, ex); - } - catch (Exception) - { - this.DiscardImplicitTransaction(); + throw new FbException(ex.Message, ex); + } + catch (Exception) + { + this.DiscardImplicitTransaction(); - throw; - } - } + throw; + } + } - return this.RecordsAffected; + return this.RecordsAffected; } + public IAsyncResult BeginExecuteNonQuery(AsyncCallback callback, object objectState) + { + return ((Func<int>)this.ExecuteNonQuery).BeginInvoke(callback, objectState); + } + public int EndExecuteNonQuery(IAsyncResult asyncResult) + { + return ((Func<int>)(asyncResult as AsyncResult).AsyncDelegate).EndInvoke(asyncResult); + } public new FbDataReader ExecuteReader() { return this.ExecuteReader(CommandBehavior.Default); } - public new FbDataReader ExecuteReader(CommandBehavior behavior) { - lock (this) - { - this.CheckCommand(); + lock (this) + { + this.CheckCommand(); - try - { - this.ExecuteCommand(behavior, true); - } - catch (IscException ex) - { - this.DiscardImplicitTransaction(); + try + { + this.ExecuteCommand(behavior, true); + } + catch (IscException ex) + { + this.DiscardImplicitTransaction(); - throw new FbException(ex.Message, ex); - } - catch - { - this.DiscardImplicitTransaction(); + throw new FbException(ex.Message, ex); + } + catch + { + this.DiscardImplicitTransaction(); - throw; - } - } + throw; + } + } - this.activeReader = new FbDataReader(this, this.connection, behavior); + this.activeReader = new FbDataReader(this, this.connection, behavior); - return this.activeReader; + return this.activeReader; } + public IAsyncResult BeginExecuteReader(AsyncCallback callback, object objectState) + { + return ((Func<FbDataReader>)this.ExecuteReader).BeginInvoke(callback, objectState); + } + public IAsyncResult BeginExecuteReader(CommandBehavior behavior, AsyncCallback callback, object objectState) + { + return ((Func<CommandBehavior, FbDataReader>)this.ExecuteReader).BeginInvoke(behavior, callback, objectState); + } + public FbDataReader EndExecuteReader(IAsyncResult asyncResult) + { + if ((asyncResult as AsyncResult).AsyncDelegate is Func<FbDataReader>) + { + return ((Func<FbDataReader>)(asyncResult as AsyncResult).AsyncDelegate).EndInvoke(asyncResult); + } + else + { + return ((Func<CommandBehavior, FbDataReader>)(asyncResult as AsyncResult).AsyncDelegate).EndInvoke(asyncResult); + } + } public override object ExecuteScalar() { - DbValue[] values = null; - object val = null; + DbValue[] values = null; + object val = null; - lock (this) - { - this.CheckCommand(); + lock (this) + { + this.CheckCommand(); - try - { - this.ExecuteCommand(CommandBehavior.Default); + try + { + this.ExecuteCommand(CommandBehavior.Default); - // Gets only the values of the first row or - // the output parameters values if command is an Stored Procedure - if (this.statement.StatementType == DbStatementType.StoredProcedure) - { - values = this.statement.GetOutputParameters(); - this.SetOutputParameters(values); - } - else - { - values = this.statement.Fetch(); - } + // Gets only the values of the first row or + // the output parameters values if command is an Stored Procedure + if (this.statement.StatementType == DbStatementType.StoredProcedure) + { + values = this.statement.GetOutputParameters(); + this.SetOutputParameters(values); + } + else + { + values = this.statement.Fetch(); + } - // Get the return value - if (values != null && values.Length > 0) - { - val = values[0].Value; - } + // Get the return value + if (values != null && values.Length > 0) + { + val = values[0].Value; + } - this.CommitImplicitTransaction(); - } - catch (IscException ex) - { - this.DiscardImplicitTransaction(); + this.CommitImplicitTransaction(); + } + catch (IscException ex) + { + this.DiscardImplicitTransaction(); - throw new FbException(ex.Message, ex); - } - catch (Exception) - { - this.DiscardImplicitTransaction(); + throw new FbException(ex.Message, ex); + } + catch (Exception) + { + this.DiscardImplicitTransaction(); - throw; - } - } + throw; + } + } - return val; + return val; } + public IAsyncResult BeginExecuteScalar(AsyncCallback callback, object objectState) + { + return ((Func<object>)this.ExecuteScalar).BeginInvoke(callback, objectState); + } + public object EndExecuteScalar(IAsyncResult asyncResult) + { + return ((Func<object>)(asyncResult as AsyncResult).AsyncDelegate).EndInvoke(asyncResult); + } #endregion Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs 2010-04-03 14:18:03 UTC (rev 1093) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnection.cs 2010-04-03 14:20:42 UTC (rev 1094) @@ -403,10 +403,7 @@ public FbTransaction BeginTransaction(IsolationLevel level, string transactionName) { - if (this.IsClosed) - { - throw new InvalidOperationException("BeginTransaction requires an open and available Connection."); - } + this.CheckClosed(); return this.innerConnection.BeginTransaction(level, transactionName); } @@ -418,10 +415,7 @@ public FbTransaction BeginTransaction(FbTransactionOptions options, string transactionName) { - if (this.IsClosed) - { - throw new InvalidOperationException("BeginTransaction requires an open and available Connection."); - } + this.CheckClosed(); return this.innerConnection.BeginTransaction(options, transactionName); } @@ -433,10 +427,7 @@ #if (!NET_CF) public override void EnlistTransaction(System.Transactions.Transaction transaction) { - if (this.State != ConnectionState.Open) - { - throw new Exception(); - } + this.CheckClosed(); this.innerConnection.EnlistTransaction(transaction); } @@ -472,10 +463,7 @@ public override DataTable GetSchema(string collectionName, string[] restrictions) { - if (this.IsClosed) - { - throw new InvalidOperationException("The connection is closed."); - } + this.CheckClosed(); return this.innerConnection.GetSchema(collectionName, restrictions); } @@ -494,10 +482,7 @@ #if (!NET_CF) lock (this) { - if (this.IsClosed) - { - throw new InvalidOperationException("ChangeDatabase requires an open and available Connection."); - } + this.CheckClosed(); if (string.IsNullOrEmpty(db)) { @@ -638,6 +623,12 @@ // Close connection or send it back to the pool if (this.innerConnection.Pooled) { + if (this.innerConnection.CancelDisabled) + { + // Enable fb_cancel_operation if going into pool + this.innerConnection.EnableCancel(); + } + // Send connection to the Pool FbPoolManager.Instance.GetPool(this.connectionString).CheckIn(this.innerConnection); } @@ -675,6 +666,14 @@ #endif } + private void CheckClosed() + { + if (this.IsClosed) + { + throw new InvalidOperationException("Operation requires an open and available connection."); + } + } + #endregion #region \xB7 Event Handlers \xB7 @@ -697,5 +696,28 @@ } #endregion - } + + #region Cancelation + public void EnableCancel() + { + this.CheckClosed(); + + this.innerConnection.EnableCancel(); + } + + public void DisableCancel() + { + this.CheckClosed(); + + this.innerConnection.DisableCancel(); + } + + internal void CancelCommand() + { + this.CheckClosed(); + + this.innerConnection.CancelCommand(); + } + #endregion + } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs 2010-04-03 14:18:03 UTC (rev 1093) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs 2010-04-03 14:20:42 UTC (rev 1094) @@ -53,10 +53,10 @@ #region \xB7 Properties \xB7 - public IDatabase Database - { - get { return this.db; } - } + public IDatabase Database + { + get { return this.db; } + } public long Lifetime { @@ -109,6 +109,7 @@ #endif } + public bool CancelDisabled { get; set; } #endregion @@ -566,5 +567,24 @@ } #endregion - } + + #region Cancelation + public void EnableCancel() + { + this.db.CancelOperation(IscCodes.fb_cancel_enable); + this.CancelDisabled = false; + } + + public void DisableCancel() + { + this.db.CancelOperation(IscCodes.fb_cancel_disable); + this.CancelDisabled = true; + } + + public void CancelCommand() + { + this.db.CancelOperation(IscCodes.fb_cancel_raise); + } + #endregion + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-04-18 11:45:15
|
Revision: 1100 http://firebird.svn.sourceforge.net/firebird/?rev=1100&view=rev Author: cincura_net Date: 2010-04-18 11:45:07 +0000 (Sun, 18 Apr 2010) Log Message: ----------- * NET_40 update. * Initial work on EF4 support. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/DmlSqlGenerator.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ExpressionTranslator.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/FirstClause.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ISqlFragment.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/JoinSymbol.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/MetadataHelpers.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SkipClause.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlBuilder.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlGenerator.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlSelectStatement.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlWriter.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/Symbol.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SymbolPair.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SymbolTable.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderManifest.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FirebirdClientFactory.cs Added Paths: ----------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/TypeHelpers.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/DmlSqlGenerator.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/DmlSqlGenerator.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/DmlSqlGenerator.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ExpressionTranslator.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ExpressionTranslator.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ExpressionTranslator.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/FirstClause.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/FirstClause.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/FirstClause.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Globalization; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ISqlFragment.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ISqlFragment.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ISqlFragment.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/JoinSymbol.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/JoinSymbol.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/JoinSymbol.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/MetadataHelpers.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/MetadataHelpers.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/MetadataHelpers.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Data; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SkipClause.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SkipClause.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SkipClause.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Globalization; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlBuilder.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlBuilder.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlBuilder.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlGenerator.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlGenerator.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlGenerator.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; @@ -29,6 +27,7 @@ using System.Data.Metadata.Edm; using System.Data.Common.CommandTrees; using System.Data; +using System.Linq; using FirebirdSql.Data.FirebirdClient; @@ -305,16 +304,20 @@ { Dictionary<string, FunctionHandler> functionHandlers = new Dictionary<string, FunctionHandler>(16, StringComparer.Ordinal); - //Other Canonical Functions + #region Other Canonical Functions functionHandlers.Add("NewGuid", HandleCanonicalFunctionNewGuid); + #endregion - //Math Canonical Functions + #region Math Canonical Functions functionHandlers.Add("Abs", HandleCanonicalFunctionAbs); functionHandlers.Add("Ceiling", HandleCanonicalFunctionCeiling); - functionHandlers.Add("Floor", HandleCanonicalFunctionFloor); + functionHandlers.Add("Floor", HandleCanonicalFunctionFloor); + functionHandlers.Add("Power", HandleCanonicalFunctionPower); functionHandlers.Add("Round", HandleCanonicalFunctionRound); + functionHandlers.Add("Truncate", HandleCanonicalFunctionTruncate); + #endregion - //String Canonical Functions + #region String Canonical Functions functionHandlers.Add("Concat", HandleConcatFunction); functionHandlers.Add("IndexOf", HandleCanonicalFunctionIndexOf); functionHandlers.Add("Length", HandleCanonicalFunctionLength); @@ -328,8 +331,12 @@ functionHandlers.Add("Reverse", HandleCanonicalFunctionReverse); functionHandlers.Add("Replace", HandleCanonicalFunctionReplace); functionHandlers.Add("Substring", HandleCanonicalFunctionSubstring); + //Contains (string, target) + //EndsWith (string, target) + //StartsWith (string, target) + #endregion - //Date and Time Canonical Functions + #region Date and Time Canonical Functions functionHandlers.Add("Year", HandleCanonicalFunctionExtract); functionHandlers.Add("Month", HandleCanonicalFunctionExtract); functionHandlers.Add("Day", HandleCanonicalFunctionExtract); @@ -343,12 +350,38 @@ functionHandlers.Add("CurrentUtcDateTime", HandleCanonicalFunctionCurrentUtcDateTime); // not supported functionHandlers.Add("CurrentDateTimeOffset", HandleCanonicalFunctionCurrentDateTimeOffset); // not supported functionHandlers.Add("GetTotalOffsetMinutes", HandleCanonicalFunctionGetTotalOffsetMinutes); // not supported + //AddNanoseconds(expression, number) + //AddMicroseconds(expression, number) + //AddMilliseconds(expression, number) + //AddSeconds(expression, number) + //AddMinutes(expression, number) + //AddHours(expression, number) + //AddDays(expression, number) + //AddMonths(expression, number) + //AddYears(expression, number) + //CreateDateTime(year, month, day, hour, minute, second) + //CreateDateTimeOffset(year, month, day, hour, minute, second, tzoffset) + //CreateTime(hour, minute, second) + //GetTotalOffsetMinutes (datetimeoffset) + //DayOfYear(expression) + //DiffNanoseconds(startExpression, endExpression) + //DiffMilliseconds(startExpression, endExpression) + //DiffMicroseconds(startExpression, endExpression) + //DiffSeconds(startExpression, endExpression) + //DiffMinutes(startExpression, endExpression) + //DiffHours(startExpression, endExpression) + //DiffDays(startExpression, endExpression) + //DiffMonths(startExpression, endExpression) + //DiffYears(startExpression, endExpression) + //TruncateTime(expressio + #endregion - //Bitwise Canonical Functions - functionHandlers.Add("BitwiseAnd", HandleCanonicalFunctionBitwiseAnd); + #region Bitwise Canonical Functions + functionHandlers.Add("BitwiseAnd", HandleCanonicalFunctionBitwiseAnd); functionHandlers.Add("BitwiseNot", HandleCanonicalFunctionBitwiseNot); // not supported functionHandlers.Add("BitwiseOr", HandleCanonicalFunctionBitwiseOr); functionHandlers.Add("BitwiseXor", HandleCanonicalFunctionBitwiseXor); + #endregion return functionHandlers; } @@ -2764,7 +2797,12 @@ } #endregion - #region Math Canonical Functions + #region Math Canonical Functions + private static ISqlFragment HandleCanonicalFunctionAbs(SqlGenerator sqlgen, DbFunctionExpression e) + { + return sqlgen.HandleFunctionDefaultGivenName(e, "ABS"); + } + private static ISqlFragment HandleCanonicalFunctionCeiling(SqlGenerator sqlgen, DbFunctionExpression e) { return sqlgen.HandleFunctionDefaultGivenName(e, "CEILING"); @@ -2775,27 +2813,20 @@ return sqlgen.HandleFunctionDefaultGivenName(e, "FLOOR"); } - private static ISqlFragment HandleCanonicalFunctionAbs(SqlGenerator sqlgen, DbFunctionExpression e) - { - return sqlgen.HandleFunctionDefaultGivenName(e, "ABS"); - } + private static ISqlFragment HandleCanonicalFunctionPower(SqlGenerator sqlgen, DbFunctionExpression e) + { + return sqlgen.HandleFunctionDefaultGivenName(e, "POWER"); + } - /// <summary> - /// Round(numericExpression) -> ROUND(numericExpression, 0); - /// </summary> - private static ISqlFragment HandleCanonicalFunctionRound(SqlGenerator sqlgen, DbFunctionExpression e) - { - SqlBuilder result = new SqlBuilder(); + private static ISqlFragment HandleCanonicalFunctionRound(SqlGenerator sqlgen, DbFunctionExpression e) + { + return sqlgen.HandleFunctionDefaultGivenName(e, "ROUND"); + } - result.Append("ROUND("); - - Debug.Assert(e.Arguments.Count == 1, "Round should have one argument"); - result.Append(e.Arguments[0].Accept(sqlgen)); - - result.Append(", 0)"); - - return result; - } + private static ISqlFragment HandleCanonicalFunctionTruncate(SqlGenerator sqlgen, DbFunctionExpression e) + { + return sqlgen.HandleFunctionDefaultGivenName(e, "TRUNC"); + } #endregion #endregion @@ -3256,9 +3287,9 @@ { // try to get maximum length, if not enough, server will return error if (isUnicode) - length = FbProviderManifest.nvarcharMaxSize.ToString(CultureInfo.InvariantCulture); + length = FbProviderManifest.NVarcharMaxSize.ToString(CultureInfo.InvariantCulture); else - length = FbProviderManifest.varcharMaxSize.ToString(CultureInfo.InvariantCulture); + length = FbProviderManifest.VarcharMaxSize.ToString(CultureInfo.InvariantCulture); } else { @@ -3272,7 +3303,7 @@ } else { - if (int.Parse(length) > (isUnicode ? FbProviderManifest.nvarcharMaxSize : FbProviderManifest.varcharMaxSize)) + if (int.Parse(length) > (isUnicode ? FbProviderManifest.NVarcharMaxSize : FbProviderManifest.VarcharMaxSize)) { typeName = "BLOB SUB_TYPE TEXT"; } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlSelectStatement.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlSelectStatement.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlSelectStatement.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlWriter.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlWriter.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlWriter.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/Symbol.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/Symbol.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/Symbol.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SymbolPair.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SymbolPair.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SymbolPair.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SymbolTable.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SymbolTable.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SymbolTable.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; Added: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/TypeHelpers.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/TypeHelpers.cs (rev 0) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/TypeHelpers.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -0,0 +1,77 @@ +/* + * 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) 2008-2010 Jiri Cincura (ji...@ci...) + * All Rights Reserved. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Data.Metadata.Edm; + +namespace FirebirdSql.Data.Entity +{ + class TypeHelpers + { + public static bool TryGetPrecision(TypeUsage tu, out byte precision) + { + Facet f; + + precision = 0; + if (tu.Facets.TryGetValue("Precision", false, out f)) + { + if (!f.IsUnbounded && f.Value != null) + { + precision = (byte)f.Value; + return true; + } + } + return false; + } + + public static bool TryGetMaxLength(TypeUsage tu, out int maxLength) + { + Facet f; + + maxLength = 0; + if (tu.Facets.TryGetValue("MaxLength", false, out f)) + { + if (!f.IsUnbounded && f.Value != null) + { + maxLength = (int)f.Value; + return true; + } + } + return false; + } + + public static bool TryGetScale(TypeUsage tu, out byte scale) + { + Facet f; + + scale = 0; + if (tu.Facets.TryGetValue("Scale", false, out f)) + { + if (!f.IsUnbounded && f.Value != null) + { + scale = (byte)f.Value; + return true; + } + } + return false; + } + } +} Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -53,7 +53,7 @@ private int commandTimeout; private int fetchSize; -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) // type coercions internal System.Data.Metadata.Edm.PrimitiveType[] ExpectedColumnTypes { get; set; } #endif @@ -437,7 +437,7 @@ command.FetchSize = this.FetchSize; command.UpdatedRowSource = this.UpdatedRowSource; -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) if (this.ExpectedColumnTypes != default(System.Data.Metadata.Edm.PrimitiveType[])) command.ExpectedColumnTypes = (System.Data.Metadata.Edm.PrimitiveType[])this.ExpectedColumnTypes.Clone(); #endif Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbDataReader.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -436,7 +436,7 @@ public override object GetValue(int i) { -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) // type coercions for EF // I think only bool datatype needs to be done explicitly if (this.command.ExpectedColumnTypes != default(System.Data.Metadata.Edm.PrimitiveType[])) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderManifest.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderManifest.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderManifest.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; @@ -40,9 +38,10 @@ { #region Private Fields - internal const int binaryMaxSize = Int32.MaxValue; - internal const int varcharMaxSize = 32765; - internal const int nvarcharMaxSize = varcharMaxSize; + internal const int BinaryMaxSize = Int32.MaxValue; + internal const int VarcharMaxSize = 32765; + internal const int NVarcharMaxSize = VarcharMaxSize; + internal const char LikeEscapeCharacter = '\\'; private System.Collections.ObjectModel.ReadOnlyCollection<PrimitiveType> _primitiveTypes = null; private System.Collections.ObjectModel.ReadOnlyCollection<EdmFunction> _functions = null; @@ -309,7 +308,7 @@ bool isFixedLength = null != facets[MetadataHelpers.FixedLengthFacetName].Value && (bool)facets[MetadataHelpers.FixedLengthFacetName].Value; Facet f = facets[MetadataHelpers.MaxLengthFacetName]; - bool isMaxLength = f.IsUnbounded || null == f.Value || (int)f.Value > binaryMaxSize; + bool isMaxLength = f.IsUnbounded || null == f.Value || (int)f.Value > BinaryMaxSize; int maxLength = !isMaxLength ? (int)f.Value : Int32.MinValue; TypeUsage tu; @@ -339,7 +338,7 @@ Facet f = facets[MetadataHelpers.MaxLengthFacetName]; // maxlen is true if facet value is unbounded, the value is bigger than the limited string sizes *or* the facet // value is null. this is needed since functions still have maxlength facet value as null - bool isMaxLength = f.IsUnbounded || null == f.Value || (int)f.Value > (isUnicode ? nvarcharMaxSize : varcharMaxSize); + bool isMaxLength = f.IsUnbounded || null == f.Value || (int)f.Value > (isUnicode ? NVarcharMaxSize : VarcharMaxSize); int maxLength = !isMaxLength ? (int)f.Value : Int32.MinValue; TypeUsage tu; @@ -427,56 +426,22 @@ return XmlReader.Create(stream); } - class TypeHelpers - { - public static bool TryGetPrecision(TypeUsage tu, out byte precision) - { - Facet f; +#if (NET_40) + public override bool SupportsEscapingLikeArgument(out char escapeCharacter) + { + escapeCharacter = LikeEscapeCharacter; + return true; + } - precision = 0; - if (tu.Facets.TryGetValue("Precision", false, out f)) - { - if (!f.IsUnbounded && f.Value != null) - { - precision = (byte)f.Value; - return true; - } - } - return false; - } - - public static bool TryGetMaxLength(TypeUsage tu, out int maxLength) - { - Facet f; - - maxLength = 0; - if (tu.Facets.TryGetValue("MaxLength", false, out f)) - { - if (!f.IsUnbounded && f.Value != null) - { - maxLength = (int)f.Value; - return true; - } - } - return false; - } - - public static bool TryGetScale(TypeUsage tu, out byte scale) - { - Facet f; - - scale = 0; - if (tu.Facets.TryGetValue("Scale", false, out f)) - { - if (!f.IsUnbounded && f.Value != null) - { - scale = (byte)f.Value; - return true; - } - } - return false; - } - } + public override string EscapeLikeArgument(string argument) + { + StringBuilder sb = new StringBuilder(argument); + sb.Replace(LikeEscapeCharacter.ToString(), LikeEscapeCharacter.ToString() + LikeEscapeCharacter.ToString()); + sb.Replace("%", LikeEscapeCharacter + "%"); + sb.Replace("_", LikeEscapeCharacter + "_"); + return sb.ToString(); + } +#endif } } #endif \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2008-2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. - * - * Based on the Microsoft Entity Framework Provider Sample SP1 Beta 1 */ -#if (NET_35 && ENTITY_FRAMEWORK) +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) using System; using System.Collections.Generic; @@ -377,9 +375,9 @@ int? maxLength; if (!MetadataHelpers.TryGetMaxLength(type, out maxLength)) { - maxLength = (unicode ? FbProviderManifest.nvarcharMaxSize : FbProviderManifest.varcharMaxSize); + maxLength = (unicode ? FbProviderManifest.NVarcharMaxSize : FbProviderManifest.VarcharMaxSize); } - if (maxLength == default(int?) || maxLength > (unicode ? FbProviderManifest.nvarcharMaxSize : FbProviderManifest.varcharMaxSize)) + if (maxLength == default(int?) || maxLength > (unicode ? FbProviderManifest.NVarcharMaxSize : FbProviderManifest.VarcharMaxSize)) { dbType = FbDbType.Text; } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FirebirdClientFactory.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FirebirdClientFactory.cs 2010-04-18 11:37:16 UTC (rev 1099) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FirebirdClientFactory.cs 2010-04-18 11:45:07 UTC (rev 1100) @@ -23,10 +23,7 @@ namespace FirebirdSql.Data.FirebirdClient { - public class FirebirdClientFactory : DbProviderFactory -#if (NET_35) - , IServiceProvider -#endif + public class FirebirdClientFactory : DbProviderFactory, IServiceProvider { #region · Static Properties · @@ -92,12 +89,10 @@ #region · IServiceProvider Members · -#if (NET_35) object IServiceProvider.GetService(Type serviceType) - { - #if (ENTITY_FRAMEWORK) - - if (serviceType == typeof(DbProviderServices)) + { +#if ((NET_35 && ENTITY_FRAMEWORK) || (NET_40)) + if (serviceType == typeof(DbProviderServices)) { return new FbProviderServices(); } @@ -105,12 +100,10 @@ { return null; } - - #else - return null; - #endif - } +#else + return null; #endif + } #endregion } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-06-05 14:30:44
|
Revision: 51213 http://firebird.svn.sourceforge.net/firebird/?rev=51213&view=rev Author: cincura_net Date: 2010-06-05 14:30:36 +0000 (Sat, 05 Jun 2010) Log Message: ----------- Added T4 template for Model First. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj Added Paths: ----------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.tt Added: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.cs (rev 0) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.cs 2010-06-05 14:30:36 UTC (rev 51213) @@ -0,0 +1,529 @@ +// ------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version: 10.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +// ------------------------------------------------------------------------------ +namespace FirebirdSql.Data.Entity +{ + using System.Data.Metadata.Edm; + using System.Linq; + using System.Text; + using System.Runtime.Remoting.Messaging; + using System.IO; + using System.Xml; + using System; + + + #line 1 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "10.0.0.0")] + public partial class SSDLToFB : SSDLToFBBase + { + #region ToString Helpers + /// <summary> + /// Utility class to produce culture-oriented representation of an object as a string. + /// </summary> + public class ToStringInstanceHelper + { + private System.IFormatProvider formatProviderField = global::System.Globalization.CultureInfo.InvariantCulture; + /// <summary> + /// Gets or sets format provider to be used by ToStringWithCulture method. + /// </summary> + public System.IFormatProvider FormatProvider + { + get + { + return this.formatProviderField ; + } + set + { + if ((value != null)) + { + this.formatProviderField = value; + } + } + } + /// <summary> + /// This is called from the compile/run appdomain to convert objects within an expression block to a string + /// </summary> + public string ToStringWithCulture(object objectToConvert) + { + if ((objectToConvert == null)) + { + throw new global::System.ArgumentNullException("objectToConvert"); + } + System.Type t = objectToConvert.GetType(); + System.Reflection.MethodInfo method = t.GetMethod("ToString", new System.Type[] { + typeof(System.IFormatProvider)}); + if ((method == null)) + { + return objectToConvert.ToString(); + } + else + { + return ((string)(method.Invoke(objectToConvert, new object[] { + this.formatProviderField }))); + } + } + } + private ToStringInstanceHelper toStringHelperField = new ToStringInstanceHelper(); + public ToStringInstanceHelper ToStringHelper + { + get + { + return this.toStringHelperField; + } + } + #endregion + public virtual string TransformText() + { + this.GenerationEnvironment = null; + this.Write("-- Created: "); + + #line 11 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(DateTime.Now.ToString("R"))); + + #line default + #line hidden + this.Write("\r\n\r\n-- Tables\r\n"); + + #line 14 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + + foreach (var entitySet in StoreItems.GetItems<EntityContainer>()[0].BaseEntitySets.OfType<EntitySet>()) + { + + + #line default + #line hidden + this.Write("RECREATE TABLE "); + + #line 18 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(Quote(entitySet.Name))); + + #line default + #line hidden + this.Write(" (\r\n"); + + #line 19 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + + PushIndent("\t"); + foreach (EdmProperty property in entitySet.ElementType.Properties) + { + + + #line default + #line hidden + + #line 24 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(GenerateColumn(property))); + + #line default + #line hidden + this.Write(",\r\n"); + + #line 25 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + + } + PopIndent(); + + + #line default + #line hidden + this.Write("CONSTRAINT "); + + #line 29 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(Quote("PK_" + entitySet.Name))); + + #line default + #line hidden + this.Write(" PRIMARY KEY ("); + + #line 29 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(", ", entitySet.ElementType.KeyMembers.Select(pk => Quote(pk.Name)).ToArray()))); + + #line default + #line hidden + this.Write(")\r\n);\r\n\r\n"); + + #line 32 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + + } + + + #line default + #line hidden + this.Write("-- Foreign Key Constraints\r\n"); + + #line 36 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + + foreach (var associationSet in StoreItems.GetItems<EntityContainer>()[0].BaseEntitySets.OfType<AssociationSet>()) + { + ReferentialConstraint constraint = associationSet.ElementType.ReferentialConstraints.Single<ReferentialConstraint>(); + AssociationSetEnd end = associationSet.AssociationSetEnds[constraint.FromRole.Name]; + AssociationSetEnd end2 = associationSet.AssociationSetEnds[constraint.ToRole.Name]; + + + + #line default + #line hidden + this.Write("ALTER TABLE "); + + #line 44 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(Quote(end2.EntitySet.Name))); + + #line default + #line hidden + this.Write(" ADD CONSTRAINT "); + + #line 44 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(Quote("FK_" + associationSet.Name))); + + #line default + #line hidden + this.Write(" FOREIGN KEY ("); + + #line 44 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(", ", constraint.ToProperties.Select(fk => Quote(fk.Name)).ToArray()))); + + #line default + #line hidden + this.Write(")\r\nREFERENCES "); + + #line 45 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(Quote(end.EntitySet.Name))); + + #line default + #line hidden + this.Write("("); + + #line 45 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(", ", constraint.FromProperties.Select(pk => Quote(pk.Name)).ToArray()))); + + #line default + #line hidden + this.Write(")\r\nON DELETE "); + + #line 46 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture((end.CorrespondingAssociationEndMember.DeleteBehavior == OperationAction.Cascade ? "CASCADE" : "NO ACTION"))); + + #line default + #line hidden + this.Write("\r\n;\r\n\r\n"); + + #line 49 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + + } + + + #line default + #line hidden + this.Write("-- EOF\r\n"); + return this.GenerationEnvironment.ToString(); + } + + #line 53 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + +public StoreItemCollection StoreItemCollection { get; set; } + +private StoreItemCollection _storeItems; +private StoreItemCollection StoreItems +{ + get + { + if (_storeItems == null) + { + if (StoreItemCollection != null) + { + _storeItems = StoreItemCollection; + } + else + { + using (TextReader text = new StringReader(this.GetInput<string>("Ssdl"))) + { + using (XmlReader xml = XmlReader.Create(text)) + { + _storeItems = new StoreItemCollection(new[] { xml }); + } + } + } + } + return _storeItems; + } +} + +private string Quote(string s) +{ + return "\"" + s + "\""; +} + +private string GenerateColumn(EdmProperty property) +{ + StringBuilder result = new StringBuilder(); + result.Append(Quote(property.Name)); + result.Append(" "); + switch (property.TypeUsage.EdmType.Name) + { + case "varchar": + case "char": + result.Append(property.TypeUsage.EdmType.Name.ToUpperInvariant()); + result.AppendFormat("({0})", property.TypeUsage.Facets["MaxLength"].Value); + break; + case "decimal": + case "numeric": + result.Append(property.TypeUsage.EdmType.Name.ToUpperInvariant()); + result.AppendFormat("({0},{1})", property.TypeUsage.Facets["Precision"].Value, property.TypeUsage.Facets["Scale"].Value); + break; + case "clob": + result.Append("BLOB SUB_TYPE TEXT"); + break; + case "blob": + result.Append("BLOB SUB_TYPE BINARY"); + break; + case "smallint_bool": + result.AppendFormat("SMALLINT CHECK {0} IN (1,0)", Quote(property.Name)); + break; + default: + result.Append(property.TypeUsage.EdmType.Name.ToUpperInvariant()); + break; + } + if (!property.Nullable) + { + result.Append(" NOT NULL"); + } + return result.ToString(); +} + +/// <summary> +/// Retrieve data of type T from CallContext given a string-based identity. +/// This is used to pass data from a workflow into the template since the workflow +/// utilizes the VS TextTemplatingService which runs the template in a separate AppDomain. +/// </summary> +private T GetInput<T>(string identity) where T : class +{ + return CallContext.GetData(identity) as T; +} + + + #line default + #line hidden + } + + #line default + #line hidden + #region Base class + /// <summary> + /// Base class for this transformation + /// </summary> + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "10.0.0.0")] + public class SSDLToFBBase + { + #region Fields + private global::System.Text.StringBuilder generationEnvironmentField; + private global::System.CodeDom.Compiler.CompilerErrorCollection errorsField; + private global::System.Collections.Generic.List<int> indentLengthsField; + private string currentIndentField = ""; + private bool endsWithNewline; + private global::System.Collections.Generic.IDictionary<string, object> sessionField; + #endregion + #region Properties + /// <summary> + /// The string builder that generation-time code is using to assemble generated output + /// </summary> + protected System.Text.StringBuilder GenerationEnvironment + { + get + { + if ((this.generationEnvironmentField == null)) + { + this.generationEnvironmentField = new global::System.Text.StringBuilder(); + } + return this.generationEnvironmentField; + } + set + { + this.generationEnvironmentField = value; + } + } + /// <summary> + /// The error collection for the generation process + /// </summary> + public System.CodeDom.Compiler.CompilerErrorCollection Errors + { + get + { + if ((this.errorsField == null)) + { + this.errorsField = new global::System.CodeDom.Compiler.CompilerErrorCollection(); + } + return this.errorsField; + } + } + /// <summary> + /// A list of the lengths of each indent that was added with PushIndent + /// </summary> + private System.Collections.Generic.List<int> indentLengths + { + get + { + if ((this.indentLengthsField == null)) + { + this.indentLengthsField = new global::System.Collections.Generic.List<int>(); + } + return this.indentLengthsField; + } + } + /// <summary> + /// Gets the current indent we use when adding lines to the output + /// </summary> + public string CurrentIndent + { + get + { + return this.currentIndentField; + } + } + /// <summary> + /// Current transformation session + /// </summary> + public virtual global::System.Collections.Generic.IDictionary<string, object> Session + { + get + { + return this.sessionField; + } + set + { + this.sessionField = value; + } + } + #endregion + #region Transform-time helpers + /// <summary> + /// Write text directly into the generated output + /// </summary> + public void Write(string textToAppend) + { + if (string.IsNullOrEmpty(textToAppend)) + { + return; + } + // If we're starting off, or if the previous text ended with a newline, + // we have to append the current indent first. + if (((this.GenerationEnvironment.Length == 0) + || this.endsWithNewline)) + { + this.GenerationEnvironment.Append(this.currentIndentField); + this.endsWithNewline = false; + } + // Check if the current text ends with a newline + if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture)) + { + this.endsWithNewline = true; + } + // This is an optimization. If the current indent is "", then we don't have to do any + // of the more complex stuff further down. + if ((this.currentIndentField.Length == 0)) + { + this.GenerationEnvironment.Append(textToAppend); + return; + } + // Everywhere there is a newline in the text, add an indent after it + textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField)); + // If the text ends with a newline, then we should strip off the indent added at the very end + // because the appropriate indent will be added when the next time Write() is called + if (this.endsWithNewline) + { + this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); + } + else + { + this.GenerationEnvironment.Append(textToAppend); + } + } + /// <summary> + /// Write text directly into the generated output + /// </summary> + public void WriteLine(string textToAppend) + { + this.Write(textToAppend); + this.GenerationEnvironment.AppendLine(); + this.endsWithNewline = true; + } + /// <summary> + /// Write formatted text directly into the generated output + /// </summary> + public void Write(string format, params object[] args) + { + this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + } + /// <summary> + /// Write formatted text directly into the generated output + /// </summary> + public void WriteLine(string format, params object[] args) + { + this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture, format, args)); + } + /// <summary> + /// Raise an error + /// </summary> + public void Error(string message) + { + System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); + error.ErrorText = message; + this.Errors.Add(error); + } + /// <summary> + /// Raise a warning + /// </summary> + public void Warning(string message) + { + System.CodeDom.Compiler.CompilerError error = new global::System.CodeDom.Compiler.CompilerError(); + error.ErrorText = message; + error.IsWarning = true; + this.Errors.Add(error); + } + /// <summary> + /// Increase the indent + /// </summary> + public void PushIndent(string indent) + { + if ((indent == null)) + { + throw new global::System.ArgumentNullException("indent"); + } + this.currentIndentField = (this.currentIndentField + indent); + this.indentLengths.Add(indent.Length); + } + /// <summary> + /// Remove the last indent that was added with PushIndent + /// </summary> + public string PopIndent() + { + string returnValue = ""; + if ((this.indentLengths.Count > 0)) + { + int indentLength = this.indentLengths[(this.indentLengths.Count - 1)]; + this.indentLengths.RemoveAt((this.indentLengths.Count - 1)); + if ((indentLength > 0)) + { + returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); + this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength)); + } + } + return returnValue; + } + /// <summary> + /// Remove any indentation + /// </summary> + public void ClearIndent() + { + this.indentLengths.Clear(); + this.currentIndentField = ""; + } + #endregion + } + #endregion +} Property changes on: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.cs ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.tt =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.tt (rev 0) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.tt 2010-06-05 14:30:36 UTC (rev 51213) @@ -0,0 +1,133 @@ +<#@ template language="C#" #> +<#@ assembly name="System.Core" #> +<#@ assembly name="System.Data.Entity" #> +<#@ assembly name="System.Xml" #> +<#@ import namespace="System.Data.Metadata.Edm" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="System.Runtime.Remoting.Messaging" #> +<#@ import namespace="System.IO" #> +<#@ import namespace="System.Xml" #> +-- Created: <#=DateTime.Now.ToString("R")#> + +-- Tables +<# + foreach (var entitySet in StoreItems.GetItems<EntityContainer>()[0].BaseEntitySets.OfType<EntitySet>()) + { +#> +RECREATE TABLE <#=Quote(entitySet.Name)#> ( +<# + PushIndent("\t"); + foreach (EdmProperty property in entitySet.ElementType.Properties) + { +#> +<#=GenerateColumn(property)#>, +<# + } + PopIndent(); +#> +CONSTRAINT <#=Quote("PK_" + entitySet.Name)#> PRIMARY KEY (<#=string.Join(", ", entitySet.ElementType.KeyMembers.Select(pk => Quote(pk.Name)).ToArray())#>) +); + +<# + } +#> +-- Foreign Key Constraints +<# + foreach (var associationSet in StoreItems.GetItems<EntityContainer>()[0].BaseEntitySets.OfType<AssociationSet>()) + { + ReferentialConstraint constraint = associationSet.ElementType.ReferentialConstraints.Single<ReferentialConstraint>(); + AssociationSetEnd end = associationSet.AssociationSetEnds[constraint.FromRole.Name]; + AssociationSetEnd end2 = associationSet.AssociationSetEnds[constraint.ToRole.Name]; + +#> +ALTER TABLE <#=Quote(end2.EntitySet.Name)#> ADD CONSTRAINT <#=Quote("FK_" + associationSet.Name)#> FOREIGN KEY (<#=string.Join(", ", constraint.ToProperties.Select(fk => Quote(fk.Name)).ToArray())#>) +REFERENCES <#=Quote(end.EntitySet.Name)#>(<#=string.Join(", ", constraint.FromProperties.Select(pk => Quote(pk.Name)).ToArray())#>) +ON DELETE <#=(end.CorrespondingAssociationEndMember.DeleteBehavior == OperationAction.Cascade ? "CASCADE" : "NO ACTION")#> +; + +<# + } +#> +-- EOF +<#+ +public StoreItemCollection StoreItemCollection { private get; set; } + +private StoreItemCollection _storeItems; +private StoreItemCollection StoreItems +{ + private get + { + if (_storeItems == null) + { + if (StoreItemCollection != null) + { + _storeItems = StoreItemCollection; + } + else + { + using (TextReader text = new StringReader(this.GetInput<string>("Ssdl"))) + { + using (XmlReader xml = XmlReader.Create(text)) + { + _storeItems = new StoreItemCollection(new[] { xml }); + } + } + } + } + return _storeItems; + } +} + +private string Quote(string s) +{ + return "\"" + s + "\""; +} + +private string GenerateColumn(EdmProperty property) +{ + StringBuilder result = new StringBuilder(); + result.Append(Quote(property.Name)); + result.Append(" "); + switch (property.TypeUsage.EdmType.Name) + { + case "varchar": + case "char": + result.Append(property.TypeUsage.EdmType.Name.ToUpperInvariant()); + result.AppendFormat("({0})", property.TypeUsage.Facets["MaxLength"].Value); + break; + case "decimal": + case "numeric": + result.Append(property.TypeUsage.EdmType.Name.ToUpperInvariant()); + result.AppendFormat("({0},{1})", property.TypeUsage.Facets["Precision"].Value, property.TypeUsage.Facets["Scale"].Value); + break; + case "clob": + result.Append("BLOB SUB_TYPE TEXT"); + break; + case "blob": + result.Append("BLOB SUB_TYPE BINARY"); + break; + case "smallint_bool": + result.AppendFormat("SMALLINT CHECK {0} IN (1,0)", Quote(property.Name)); + break; + default: + result.Append(property.TypeUsage.EdmType.Name.ToUpperInvariant()); + break; + } + if (!property.Nullable) + { + result.Append(" NOT NULL"); + } + return result.ToString(); +} + +/// <summary> +/// Retrieve data of type T from CallContext given a string-based identity. +/// This is used to pass data from a workflow into the template since the workflow +/// utilizes the VS TextTemplatingService which runs the template in a separate AppDomain. +/// </summary> +private T GetInput<T>(string identity) where T : class +{ + return CallContext.GetData(identity) as T; +} +#> \ No newline at end of file Property changes on: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.tt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs 2010-06-05 13:07:44 UTC (rev 51212) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs 2010-06-05 14:30:36 UTC (rev 51213) @@ -31,6 +31,7 @@ using System.Diagnostics; using FirebirdSql.Data.Entity; +using FirebirdSql.Data.Isql; namespace FirebirdSql.Data.FirebirdClient { @@ -45,6 +46,15 @@ return result; } + protected FbConnection CheckAndCastToFbConnection(DbConnection connection) + { + if (!(connection is FbConnection)) + { + throw new ArgumentException("The connection is not of type 'FbConnection'."); + } + return (FbConnection)connection; + } + /// <summary> /// Create a SampleCommand object, given the provider manifest and command tree /// </summary> @@ -177,11 +187,7 @@ if (connection == null) throw new ArgumentException("connection"); - FbConnection fbConnection = connection as FbConnection; - if (fbConnection == null) - { - throw new ArgumentException("The connection is not of type 'FbConnection'."); - } + FbConnection fbConnection = CheckAndCastToFbConnection(connection); if (string.IsNullOrEmpty(fbConnection.ConnectionString)) { @@ -262,7 +268,6 @@ return result; } - /// <summary> /// Determines SqlDbType for the given primitive type. Extracts facet /// information as well. @@ -407,6 +412,32 @@ return FbDbType.Binary; } + + protected override void DbCreateDatabase(DbConnection connection, int? commandTimeout, StoreItemCollection storeItemCollection) + { + FbConnection fbConnection = CheckAndCastToFbConnection(connection); + string script = DbCreateDatabaseScript(GetDbProviderManifestToken(fbConnection), storeItemCollection); + FbScript fbScript = new FbScript(script); + fbScript.Parse(); + FbConnection.CreateDatabase(fbConnection.ConnectionString); + new FbBatchExecution(fbConnection, fbScript).Execute(); + } + + protected override string DbCreateDatabaseScript(string providerManifestToken, StoreItemCollection storeItemCollection) + { + return new SSDLToFB() { StoreItemCollection = storeItemCollection }.TransformText(); + } + + protected override bool DbDatabaseExists(DbConnection connection, int? commandTimeout, StoreItemCollection storeItemCollection) + { + throw new NotSupportedException(); + } + + protected override void DbDeleteDatabase(DbConnection connection, int? commandTimeout, StoreItemCollection storeItemCollection) + { + FbConnection fbConnection = CheckAndCastToFbConnection(connection); + FbConnection.DropDatabase(connection.ConnectionString); + } } } #endif \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-06-05 13:07:44 UTC (rev 51212) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-06-05 14:30:36 UTC (rev 51213) @@ -122,6 +122,11 @@ <Compile Include="Entity\ISqlFragment.cs" /> <Compile Include="Entity\JoinSymbol.cs" /> <Compile Include="Entity\MetadataHelpers.cs" /> + <Compile Include="Entity\SSDLToFB.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>SSDLToFB.tt</DependentUpon> + </Compile> <Compile Include="Entity\SkipClause.cs" /> <Compile Include="Entity\SqlBuilder.cs" /> <Compile Include="Entity\SqlGenerator.cs" /> @@ -326,6 +331,11 @@ <EmbeddedResource Include="Schema\FbMetaData.xml" /> </ItemGroup> <ItemGroup> + <None Include="Entity\SSDLToFB.tt"> + <Generator>TextTemplatingFilePreprocessor</Generator> + <LastGenOutput>SSDLToFB.cs</LastGenOutput> + <CustomToolNamespace>FirebirdSql.Data.Entity</CustomToolNamespace> + </None> <None Include="Entity\ProviderManifest.xsd" /> <EmbeddedResource Include="Entity\StoreSchemaDefinition.ssdl" /> <EmbeddedResource Include="Entity\StoreSchemaMapping.msl" /> @@ -333,6 +343,7 @@ <None Include="Properties\FirebirdSql.Data.FirebirdClient.snk" /> </ItemGroup> <ItemGroup> + <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" /> </ItemGroup> <ItemGroup> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-06-30 19:54:40
|
Revision: 51304 http://firebird.svn.sourceforge.net/firebird/?rev=51304&view=rev Author: cincura_net Date: 2010-06-30 19:54:34 +0000 (Wed, 30 Jun 2010) Log Message: ----------- DNET-124, DNET-328 Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbValue.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameter.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs 2010-06-30 08:55:16 UTC (rev 51303) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/XdrStream.cs 2010-06-30 19:54:34 UTC (rev 51304) @@ -673,8 +673,7 @@ if ((param.Length % param.Charset.BytesPerCharacter) == 0 && svalue.Length > param.CharCount) { - //throw new IscException(IscCodes.isc_arith_except); - svalue = svalue.Substring(0, param.CharCount); + throw new IscException(new[] { IscCodes.isc_arith_except, IscCodes.isc_string_truncation }); } this.WriteOpaque(param.Charset.GetBytes(svalue), param.Length); @@ -693,8 +692,7 @@ if ((param.Length % param.Charset.BytesPerCharacter) == 0 && svalue.Length > param.CharCount) { - //throw new IscException(IscCodes.isc_arith_except); - svalue = svalue.Substring(0, param.CharCount); + throw new IscException(new[] { IscCodes.isc_arith_except, IscCodes.isc_string_truncation }); } byte[] data = param.Charset.GetBytes(svalue); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbValue.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbValue.cs 2010-06-30 08:55:16 UTC (rev 51303) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/DbValue.cs 2010-06-30 19:54:34 UTC (rev 51304) @@ -223,8 +223,8 @@ if ((this.Field.Length % this.Field.Charset.BytesPerCharacter) == 0 && svalue.Length > this.Field.CharCount) - { - throw new IscException(IscCodes.isc_arith_except); + { + throw new IscException(new[] { IscCodes.isc_arith_except, IscCodes.isc_string_truncation }); } byte[] buffer = new byte[this.Field.Length]; @@ -251,8 +251,8 @@ if ((this.Field.Length % this.Field.Charset.BytesPerCharacter) == 0 && svalue.Length > this.Field.CharCount) - { - throw new IscException(IscCodes.isc_arith_except); + { + throw new IscException(new[] { IscCodes.isc_arith_except, IscCodes.isc_string_truncation }); } byte[] sbuffer = this.Field.Charset.GetBytes(svalue); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2010-06-30 08:55:16 UTC (rev 51303) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbCommand.cs 2010-06-30 19:54:34 UTC (rev 51304) @@ -942,7 +942,7 @@ Charset charset = this.connection.InnerConnection.Database.Charset; // Check the parameter character set - if (parameter.Charset == FbCharset.Octets && !(parameter.Value is byte[])) + if (parameter.Charset == FbCharset.Octets && !(parameter.InternalValue is byte[])) { throw new InvalidOperationException("Value for char octets fields should be a byte array"); } @@ -1047,7 +1047,7 @@ if (index != -1) { - if (this.Parameters[index].Value == DBNull.Value || this.Parameters[index].Value == null) + if (this.Parameters[index].InternalValue == DBNull.Value || this.Parameters[index].InternalValue == null) { this.statement.Parameters[i].NullFlag = -1; this.statement.Parameters[i].Value = DBNull.Value; @@ -1067,7 +1067,7 @@ case DbDataType.Binary: { BlobBase blob = this.statement.CreateBlob(); - blob.Write((byte[])this.Parameters[index].Value); + blob.Write((byte[])this.Parameters[index].InternalValue); this.statement.Parameters[i].Value = blob.Id; } break; @@ -1075,10 +1075,10 @@ case DbDataType.Text: { BlobBase blob = this.statement.CreateBlob(); - if (this.Parameters[index].Value.GetType() == typeof(byte[])) - blob.Write((byte[])this.Parameters[index].Value); + if (this.Parameters[index].InternalValue.GetType() == typeof(byte[])) + blob.Write((byte[])this.Parameters[index].InternalValue); else - blob.Write((string)this.Parameters[index].Value); + blob.Write((string)this.Parameters[index].InternalValue); this.statement.Parameters[i].Value = blob.Id; } break; @@ -1099,22 +1099,22 @@ } this.statement.Parameters[i].ArrayHandle.Handle = 0; - this.statement.Parameters[i].ArrayHandle.Write((System.Array)this.Parameters[index].Value); + this.statement.Parameters[i].ArrayHandle.Write((System.Array)this.Parameters[index].InternalValue); this.statement.Parameters[i].Value = this.statement.Parameters[i].ArrayHandle.Handle; } break; case DbDataType.Guid: - if (!(this.Parameters[index].Value is Guid) && - !(this.Parameters[index].Value is byte[])) + if (!(this.Parameters[index].InternalValue is Guid) && + !(this.Parameters[index].InternalValue is byte[])) { throw new InvalidOperationException("Incorrect Guid value."); } - this.statement.Parameters[i].Value = this.Parameters[index].Value; + this.statement.Parameters[i].Value = this.Parameters[index].InternalValue; break; default: - this.statement.Parameters[i].Value = this.Parameters[index].Value; + this.statement.Parameters[i].Value = this.Parameters[index].InternalValue; break; } } @@ -1133,7 +1133,7 @@ if (this.parameters != null) foreach (FbParameter item in this.parameters) { - System.Diagnostics.Debug.WriteLine(string.Format("Name:{0} \t Type:{1} \t Value:{2}", item.InternalParameterName, item.FbDbType, item.Value)); + System.Diagnostics.Debug.WriteLine(string.Format("Name:{0} \t Type:{1} \t Value:{2}", item.InternalParameterName, item.FbDbType, item.InternalValue)); } #endif Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameter.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameter.cs 2010-06-30 08:55:16 UTC (rev 51303) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbParameter.cs 2010-06-30 19:54:34 UTC (rev 51304) @@ -48,7 +48,6 @@ private object value; private string parameterName; private string sourceColumn; - private bool isTypeSet; #endregion @@ -73,6 +72,7 @@ set { this.size = value; + this.IsSizeSet = true; // Hack for Clob parameters if (value == 2147483647 && @@ -148,7 +148,7 @@ set { this.fbDbType = value; - this.isTypeSet = true; + this.IsTypeSet = true; } } @@ -174,7 +174,7 @@ this.value = value; - if (!this.isTypeSet) + if (!this.IsTypeSet) { this.SetFbDbType(value); } @@ -235,18 +235,34 @@ { get { - if (!String.IsNullOrEmpty(this.parameterName) && !this.parameterName.StartsWith("@")) + if (!string.IsNullOrEmpty(this.parameterName) && !this.parameterName.StartsWith("@")) { - return String.Format("@{0}", this.ParameterName); + return string.Format("@{0}", this.ParameterName); } return this.ParameterName; } } - internal bool IsTypeSet + internal bool IsTypeSet { get; private set; } + + internal bool IsSizeSet { get; private set; } + + internal object InternalValue { - get { return this.isTypeSet; } + get + { + if (this.IsSizeSet) + { + string svalue = (this.value as string); + if (svalue != null) + return svalue.Substring(0, Math.Min(this.size, svalue.Length)); + else + return this.value; + } + + return this.value; + } } #endregion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-07-17 14:06:36
|
Revision: 51348 http://firebird.svn.sourceforge.net/firebird/?rev=51348&view=rev Author: cincura_net Date: 2010-07-17 14:06:28 +0000 (Sat, 17 Jul 2010) Log Message: ----------- DNET-323 Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2010-07-17 12:47:22 UTC (rev 51347) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2010-07-17 14:06:28 UTC (rev 51348) @@ -316,6 +316,7 @@ public const int isc_dpb_gfix_attach = 66; public const int isc_dpb_gstat_attach = 67; public const int isc_dpb_set_db_charset = 68; + public const int isc_dpb_process_id = 71; public const int isc_dpb_trusted_auth = 73; public const int isc_dpb_process_name = 74; public const int isc_dpb_utf8_filename = 77; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs 2010-07-17 12:47:22 UTC (rev 51347) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionInternal.cs 2010-07-17 14:06:28 UTC (rev 51348) @@ -536,7 +536,8 @@ dpb.Append(IscCodes.isc_dpb_password, options.Password); } - dpb.Append(IscCodes.isc_dpb_process_name, GetProcessName()); + dpb.Append(IscCodes.isc_dpb_process_id, GetProcessID()); + dpb.Append(IscCodes.isc_dpb_process_name, GetProcessName()); return dpb; } @@ -595,6 +596,25 @@ } } + private int GetProcessID() + { +#if (NET_CF) + return -1; +#else + System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly(); + if (assembly != null) + { + if (assembly.IsFullyTrusted) + return Process.GetCurrentProcess().Id; + else + return -1; + } + else // if we're not loaded from managed code + { + return Process.GetCurrentProcess().Id; + } +#endif + } #endregion #region Cancelation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-07-17 15:32:30
|
Revision: 51351 http://firebird.svn.sourceforge.net/firebird/?rev=51351&view=rev Author: cincura_net Date: 2010-07-17 15:32:23 +0000 (Sat, 17 Jul 2010) Log Message: ----------- Removed hardcoded "\r\n" (it's available in CF). Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlWriter.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionString.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs 2010-07-17 15:29:31 UTC (rev 51350) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs 2010-07-17 15:32:23 UTC (rev 51351) @@ -260,11 +260,7 @@ // The next error contains the PSQL Stack Trace if (builder.Length > 0) { -#if (NET_CF) - builder.Append("\r\n"); -#else builder.Append(Environment.NewLine); -#endif } builder.AppendFormat(CultureInfo.CurrentCulture, "{0}", args); } @@ -272,11 +268,7 @@ { if (builder.Length > 0) { -#if (NET_CF) - builder.Append("\r\n"); -#else builder.Append(Environment.NewLine); -#endif } builder.AppendFormat(CultureInfo.CurrentCulture, message, args); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlWriter.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlWriter.cs 2010-07-17 15:29:31 UTC (rev 51350) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SqlWriter.cs 2010-07-17 15:32:23 UTC (rev 51351) @@ -80,7 +80,7 @@ /// <param name="value"></param> public override void Write(string value) { - if (value == "\r\n") + if (value == Environment.NewLine) { base.WriteLine(); this.atBeginningOfLine = true; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionString.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionString.cs 2010-07-17 15:29:31 UTC (rev 51350) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionString.cs 2010-07-17 15:32:23 UTC (rev 51351) @@ -342,11 +342,7 @@ } if (this.PacketSize < 512 || this.PacketSize > 32767) { -#if (!NET_CF) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "'Packet Size' value of {0} is not valid.{1}The value should be an integer >= 512 and <= 32767.", this.PacketSize, Environment.NewLine)); -#else - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "'Packet Size' value of {0} is not valid.{1}The value should be an integer >= 512 and <= 32767.", this.PacketSize, "\r\n")); -#endif } if (this.DbCachePages < 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-08-08 17:07:59
|
Revision: 51414 http://firebird.svn.sourceforge.net/firebird/?rev=51414&view=rev Author: cincura_net Date: 2010-08-08 17:07:53 +0000 (Sun, 08 Aug 2010) Log Message: ----------- DNET-338 Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/TransactionParameterBuffer.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbTransaction.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbTransactionOptions.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/TransactionParameterBuffer.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/TransactionParameterBuffer.cs 2010-08-08 03:11:56 UTC (rev 51413) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/TransactionParameterBuffer.cs 2010-08-08 17:07:53 UTC (rev 51414) @@ -20,6 +20,7 @@ */ using System; +using System.Text; namespace FirebirdSql.Data.Common { @@ -42,6 +43,18 @@ this.Write(value); } + public void Append(int type, string content) + { + this.Append(type, Encoding.Default.GetBytes(content)); + } + + public void Append(int type, byte[] buffer) + { + this.WriteByte(type); + this.WriteByte(buffer.Length); + this.Write(buffer); + } + #endregion } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbTransaction.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbTransaction.cs 2010-08-08 03:11:56 UTC (rev 51413) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbTransaction.cs 2010-08-08 17:07:53 UTC (rev 51414) @@ -451,18 +451,6 @@ { tpb.Append(IscCodes.isc_tpb_concurrency); } - if ((options.TransactionBehavior & FbTransactionBehavior.Shared) == FbTransactionBehavior.Shared) - { - tpb.Append(IscCodes.isc_tpb_shared); - } - if ((options.TransactionBehavior & FbTransactionBehavior.Protected) == FbTransactionBehavior.Protected) - { - tpb.Append(IscCodes.isc_tpb_protected); - } - if ((options.TransactionBehavior & FbTransactionBehavior.Exclusive) == FbTransactionBehavior.Exclusive) - { - tpb.Append(IscCodes.isc_tpb_exclusive); - } if ((options.TransactionBehavior & FbTransactionBehavior.Wait) == FbTransactionBehavior.Wait) { tpb.Append(IscCodes.isc_tpb_wait); @@ -483,14 +471,39 @@ { tpb.Append(IscCodes.isc_tpb_write); } - if ((options.TransactionBehavior & FbTransactionBehavior.LockRead) == FbTransactionBehavior.LockRead) - { - tpb.Append(IscCodes.isc_tpb_lock_read); - } - if ((options.TransactionBehavior & FbTransactionBehavior.LockWrite) == FbTransactionBehavior.LockWrite) - { - tpb.Append(IscCodes.isc_tpb_lock_write); - } + foreach (var table in options.LockTables) + { + int lockType; + if ((table.Value & FbTransactionBehavior.LockRead) == FbTransactionBehavior.LockRead) + { + lockType = IscCodes.isc_tpb_lock_read; + } + else if ((table.Value & FbTransactionBehavior.LockWrite) == FbTransactionBehavior.LockWrite) + { + lockType = IscCodes.isc_tpb_lock_write; + } + else + { + throw new ArgumentException("Must specify either LockRead or LockWrite."); + } + tpb.Append(lockType, table.Key); + + int? lockBehavior = null; + if ((table.Value & FbTransactionBehavior.Exclusive) == FbTransactionBehavior.Exclusive) + { + lockBehavior = IscCodes.isc_tpb_exclusive; + } + else if ((table.Value & FbTransactionBehavior.Protected) == FbTransactionBehavior.Protected) + { + lockBehavior = IscCodes.isc_tpb_protected; + } + else if ((table.Value & FbTransactionBehavior.Shared) == FbTransactionBehavior.Shared) + { + lockBehavior = IscCodes.isc_tpb_shared; + } + if (lockBehavior.HasValue) + tpb.Append((int)lockBehavior); + } if ((options.TransactionBehavior & FbTransactionBehavior.ReadCommitted) == FbTransactionBehavior.ReadCommitted) { tpb.Append(IscCodes.isc_tpb_read_committed); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbTransactionOptions.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbTransactionOptions.cs 2010-08-08 03:11:56 UTC (rev 51413) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbTransactionOptions.cs 2010-08-08 17:07:53 UTC (rev 51414) @@ -17,6 +17,7 @@ */ using System; +using System.Collections.Generic; namespace FirebirdSql.Data.FirebirdClient { @@ -36,5 +37,7 @@ } public FbTransactionBehavior TransactionBehavior { get; set; } + + public IDictionary<string, FbTransactionBehavior> LockTables { get; set; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-09-06 12:40:52
|
Revision: 51525 http://firebird.svn.sourceforge.net/firebird/?rev=51525&view=rev Author: cincura_net Date: 2010-09-06 12:40:39 +0000 (Mon, 06 Sep 2010) Log Message: ----------- * #PK_GEN# generation for StoreGeneratedPattern=Identity in T4 template. * Support for #BOOL# and #GUID# (DNET-301, DNET-302). Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ProviderManifest.xml NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.tt NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/StoreSchemaDefinition.ssdl NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderManifest.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ProviderManifest.xml =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ProviderManifest.xml 2010-09-05 03:12:59 UTC (rev 51524) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/ProviderManifest.xml 2010-09-06 12:40:39 UTC (rev 51525) @@ -75,7 +75,8 @@ <FixedLength DefaultValue="false" Constant="true" /> </FacetDescriptions> </Type> - + <Type Name="guid" PrimitiveTypeKind="Guid"> + </Type> </Types> <Functions> <!-- BEGIN SYSTEM FUNCTIONS ##################################### --> Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.cs 2010-09-05 03:12:59 UTC (rev 51524) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.cs 2010-09-06 12:40:39 UTC (rev 51525) @@ -15,6 +15,7 @@ using System.Runtime.Remoting.Messaging; using System.IO; using System.Xml; + using System.Collections.Generic; using System; @@ -83,14 +84,14 @@ this.GenerationEnvironment = null; this.Write("-- Created: "); - #line 12 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 13 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DateTime.Now.ToString("R"))); #line default #line hidden this.Write("\r\n"); - #line 13 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 14 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" if (StoreItems == null) { @@ -100,7 +101,7 @@ #line hidden this.Write("-- No input.\r\n"); - #line 18 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 19 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" } else @@ -111,24 +112,27 @@ #line hidden this.Write("-- Tables\r\n"); - #line 24 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 25 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + + IDictionary<string, string> additionalColumnComments = new Dictionary<string, string>(); foreach (var entitySet in StoreItems.GetItems<EntityContainer>()[0].BaseEntitySets.OfType<EntitySet>()) { + additionalColumnComments.Clear(); #line default #line hidden this.Write("RECREATE TABLE "); - #line 28 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 32 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Quote(entitySet.Name))); #line default #line hidden this.Write(" (\r\n"); - #line 29 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 33 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" PushIndent("\t"); foreach (EdmProperty property in entitySet.ElementType.Properties) @@ -138,14 +142,14 @@ #line default #line hidden - #line 34 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" - this.Write(this.ToStringHelper.ToStringWithCulture(GenerateColumn(property))); + #line 38 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(GenerateColumn(property, ref additionalColumnComments))); #line default #line hidden this.Write(",\r\n"); - #line 35 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 39 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" } PopIndent(); @@ -155,22 +159,58 @@ #line hidden this.Write("CONSTRAINT "); - #line 39 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 43 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Quote("PK_" + entitySet.Name))); #line default #line hidden this.Write(" PRIMARY KEY ("); - #line 39 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 43 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(", ", entitySet.ElementType.KeyMembers.Select(pk => Quote(pk.Name)).ToArray()))); #line default #line hidden - this.Write(")\r\n);\r\n\r\n"); + this.Write(")\r\n);\r\n"); - #line 42 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 45 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + foreach(string identity in entitySet.ElementType.KeyMembers.Where(pk => pk.TypeUsage.Facets.Contains("StoreGeneratedPattern") && (StoreGeneratedPattern)pk.TypeUsage.Facets["StoreGeneratedPattern"].Value == StoreGeneratedPattern.Identity).Select(i => i.Name)) + { + additionalColumnComments.Add(identity, "#PK_GEN#"); + } + foreach (KeyValuePair<string, string> comment in additionalColumnComments) + { + + + #line default + #line hidden + this.Write("COMMENT ON COLUMN "); + + #line 53 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(Quote(entitySet.Name))); + + #line default + #line hidden + this.Write("."); + + #line 53 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(Quote(comment.Key))); + + #line default + #line hidden + this.Write(" IS \'"); + + #line 53 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + this.Write(this.ToStringHelper.ToStringWithCulture(comment.Value)); + + #line default + #line hidden + this.Write("\';\r\n"); + + #line 54 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + + } } @@ -178,7 +218,7 @@ #line hidden this.Write("-- Foreign Key Constraints\r\n"); - #line 46 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 59 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" foreach (var associationSet in StoreItems.GetItems<EntityContainer>()[0].BaseEntitySets.OfType<AssociationSet>()) { @@ -192,49 +232,49 @@ #line hidden this.Write("ALTER TABLE "); - #line 54 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 67 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Quote(end2.EntitySet.Name))); #line default #line hidden this.Write(" ADD CONSTRAINT "); - #line 54 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 67 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Quote("FK_" + associationSet.Name))); #line default #line hidden this.Write(" FOREIGN KEY ("); - #line 54 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 67 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(", ", constraint.ToProperties.Select(fk => Quote(fk.Name)).ToArray()))); #line default #line hidden this.Write(")\r\nREFERENCES "); - #line 55 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 68 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Quote(end.EntitySet.Name))); #line default #line hidden this.Write("("); - #line 55 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 68 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(", ", constraint.FromProperties.Select(pk => Quote(pk.Name)).ToArray()))); #line default #line hidden this.Write(")\r\nON DELETE "); - #line 56 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 69 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" this.Write(this.ToStringHelper.ToStringWithCulture((end.CorrespondingAssociationEndMember.DeleteBehavior == OperationAction.Cascade ? "CASCADE" : "NO ACTION"))); #line default #line hidden this.Write("\r\n;\r\n\r\n"); - #line 59 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 72 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" } @@ -242,7 +282,7 @@ #line default #line hidden - #line 62 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 75 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" } @@ -253,7 +293,7 @@ return this.GenerationEnvironment.ToString(); } - #line 66 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" + #line 79 "C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Entity\SSDLToFB.tt" public StoreItemCollection StoreItemCollection { private get; set; } @@ -290,7 +330,7 @@ return "\"" + s + "\""; } -private string GenerateColumn(EdmProperty property) +private string GenerateColumn(EdmProperty property, ref IDictionary<string, string> columnComments) { StringBuilder result = new StringBuilder(); result.Append(Quote(property.Name)); @@ -315,7 +355,12 @@ break; case "smallint_bool": result.AppendFormat("SMALLINT CHECK ({0} IN (1,0))", Quote(property.Name)); + columnComments.Add(property.Name, "#BOOL#"); break; + case "guid": + result.Append("CHAR(16) CHARACTER SET OCTETS"); + columnComments.Add(property.Name, "#GUID#"); + break; default: result.Append(property.TypeUsage.EdmType.Name.ToUpperInvariant()); break; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.tt =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.tt 2010-09-05 03:12:59 UTC (rev 51524) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/SSDLToFB.tt 2010-09-06 12:40:39 UTC (rev 51525) @@ -9,6 +9,7 @@ <#@ import namespace="System.Runtime.Remoting.Messaging" #> <#@ import namespace="System.IO" #> <#@ import namespace="System.Xml" #> +<#@ import namespace="System.Collections.Generic" #> -- Created: <#=DateTime.Now.ToString("R")#> <# if (StoreItems == null) @@ -22,8 +23,11 @@ #> -- Tables <# + + IDictionary<string, string> additionalColumnComments = new Dictionary<string, string>(); foreach (var entitySet in StoreItems.GetItems<EntityContainer>()[0].BaseEntitySets.OfType<EntitySet>()) { + additionalColumnComments.Clear(); #> RECREATE TABLE <#=Quote(entitySet.Name)#> ( <# @@ -31,15 +35,24 @@ foreach (EdmProperty property in entitySet.ElementType.Properties) { #> -<#=GenerateColumn(property)#>, +<#=GenerateColumn(property, ref additionalColumnComments)#>, <# } PopIndent(); #> CONSTRAINT <#=Quote("PK_" + entitySet.Name)#> PRIMARY KEY (<#=string.Join(", ", entitySet.ElementType.KeyMembers.Select(pk => Quote(pk.Name)).ToArray())#>) ); - <# + foreach(string identity in entitySet.ElementType.KeyMembers.Where(pk => pk.TypeUsage.Facets.Contains("StoreGeneratedPattern") && (StoreGeneratedPattern)pk.TypeUsage.Facets["StoreGeneratedPattern"].Value == StoreGeneratedPattern.Identity).Select(i => i.Name)) + { + additionalColumnComments.Add(identity, "#PK_GEN#"); + } + foreach (KeyValuePair<string, string> comment in additionalColumnComments) + { +#> +COMMENT ON COLUMN <#=Quote(entitySet.Name)#>.<#=Quote(comment.Key)#> IS '<#=comment.Value#>'; +<# + } } #> -- Foreign Key Constraints @@ -99,7 +112,7 @@ return "\"" + s + "\""; } -private string GenerateColumn(EdmProperty property) +private string GenerateColumn(EdmProperty property, ref IDictionary<string, string> columnComments) { StringBuilder result = new StringBuilder(); result.Append(Quote(property.Name)); @@ -124,7 +137,12 @@ break; case "smallint_bool": result.AppendFormat("SMALLINT CHECK ({0} IN (1,0))", Quote(property.Name)); + columnComments.Add(property.Name, "#BOOL#"); break; + case "guid": + result.Append("CHAR(16) CHARACTER SET OCTETS"); + columnComments.Add(property.Name, "#GUID#"); + break; default: result.Append(property.TypeUsage.EdmType.Name.ToUpperInvariant()); break; Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/StoreSchemaDefinition.ssdl =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/StoreSchemaDefinition.ssdl 2010-09-05 03:12:59 UTC (rev 51524) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Entity/StoreSchemaDefinition.ssdl 2010-09-06 12:40:39 UTC (rev 51525) @@ -24,35 +24,39 @@ , TRIM(rf.rdb$field_name) as "Name" , rf.rdb$field_position+1 as "Ordinal" , IIF(COALESCE(rf.rdb$null_flag, f.rdb$null_flag) IS NULL, 1, 0) as "IsNullable" - , TRIM(CASE f.rdb$field_type - WHEN 7 THEN CASE f.rdb$field_sub_type - WHEN 0 THEN 'smallint' - WHEN 1 THEN 'numeric' - WHEN 2 THEN 'decimal' - END - WHEN 8 THEN CASE f.rdb$field_sub_type - WHEN 0 THEN 'int' - WHEN 1 THEN 'numeric' - WHEN 2 THEN 'decimal' - END - WHEN 16 THEN CASE f.rdb$field_sub_type - WHEN 0 THEN 'bigint' - WHEN 1 THEN 'numeric' - WHEN 2 THEN 'decimal' - END - WHEN 10 THEN 'float' - WHEN 27 THEN 'double' - WHEN 12 THEN 'date' - WHEN 13 THEN 'time' - WHEN 35 THEN 'timestamp' - WHEN 261 THEN CASE f.rdb$field_sub_type - WHEN 1 THEN 'clob' - ELSE 'blob' - END - WHEN 37 THEN 'varchar' - WHEN 14 THEN 'char' - WHEN 40 THEN 'cstring' - END) as "TypeName" + , TRIM(CASE + WHEN POSITION('#BOOL#', UPPER(rf.rdb$description)) > 0 THEN 'smallint_bool' + WHEN POSITION('#GUID#', UPPER(rf.rdb$description)) > 0 THEN 'guid' + ELSE CASE f.rdb$field_type + WHEN 7 THEN CASE f.rdb$field_sub_type + WHEN 0 THEN 'smallint' + WHEN 1 THEN 'numeric' + WHEN 2 THEN 'decimal' + END + WHEN 8 THEN CASE f.rdb$field_sub_type + WHEN 0 THEN 'int' + WHEN 1 THEN 'numeric' + WHEN 2 THEN 'decimal' + END + WHEN 16 THEN CASE f.rdb$field_sub_type + WHEN 0 THEN 'bigint' + WHEN 1 THEN 'numeric' + WHEN 2 THEN 'decimal' + END + WHEN 10 THEN 'float' + WHEN 27 THEN 'double' + WHEN 12 THEN 'date' + WHEN 13 THEN 'time' + WHEN 35 THEN 'timestamp' + WHEN 261 THEN CASE f.rdb$field_sub_type + WHEN 1 THEN 'clob' + ELSE 'blob' + END + WHEN 37 THEN 'varchar' + WHEN 14 THEN 'char' + WHEN 40 THEN 'cstring' + END + END) as "TypeName" , IIF(f.rdb$character_length = 0, 32765, f.rdb$character_length) as "MaxLength" --hot fix for CORE-2228 , f.rdb$field_precision as "Precision" , 4 as "DateTimePrecision" @@ -100,35 +104,39 @@ , TRIM(rf.rdb$field_name) as "Name" , rf.rdb$field_position+1 as "Ordinal" , IIF(COALESCE(rf.rdb$null_flag, f.rdb$null_flag) IS NULL, 1, 0) as "IsNullable" - , TRIM(CASE f.rdb$field_type - WHEN 7 THEN CASE f.rdb$field_sub_type - WHEN 0 THEN 'smallint' - WHEN 1 THEN 'numeric' - WHEN 2 THEN 'decimal' - END - WHEN 8 THEN CASE f.rdb$field_sub_type - WHEN 0 THEN 'int' - WHEN 1 THEN 'numeric' - WHEN 2 THEN 'decimal' - END - WHEN 16 THEN CASE f.rdb$field_sub_type - WHEN 0 THEN 'bigint' - WHEN 1 THEN 'numeric' - WHEN 2 THEN 'decimal' - END - WHEN 10 THEN 'float' - WHEN 27 THEN 'double' - WHEN 12 THEN 'date' - WHEN 13 THEN 'time' - WHEN 35 THEN 'timestamp' - WHEN 261 THEN CASE f.rdb$field_sub_type - WHEN 1 THEN 'clob' - ELSE 'blob' - END - WHEN 37 THEN 'varchar' - WHEN 14 THEN 'char' - WHEN 40 THEN 'cstring' - END) as "TypeName" + , TRIM(CASE + WHEN POSITION('#BOOL#', UPPER(rf.rdb$description)) > 0 THEN 'smallint_bool' + WHEN POSITION('#GUID#', UPPER(rf.rdb$description)) > 0 THEN 'guid' + ELSE CASE f.rdb$field_type + WHEN 7 THEN CASE f.rdb$field_sub_type + WHEN 0 THEN 'smallint' + WHEN 1 THEN 'numeric' + WHEN 2 THEN 'decimal' + END + WHEN 8 THEN CASE f.rdb$field_sub_type + WHEN 0 THEN 'int' + WHEN 1 THEN 'numeric' + WHEN 2 THEN 'decimal' + END + WHEN 16 THEN CASE f.rdb$field_sub_type + WHEN 0 THEN 'bigint' + WHEN 1 THEN 'numeric' + WHEN 2 THEN 'decimal' + END + WHEN 10 THEN 'float' + WHEN 27 THEN 'double' + WHEN 12 THEN 'date' + WHEN 13 THEN 'time' + WHEN 35 THEN 'timestamp' + WHEN 261 THEN CASE f.rdb$field_sub_type + WHEN 1 THEN 'clob' + ELSE 'blob' + END + WHEN 37 THEN 'varchar' + WHEN 14 THEN 'char' + WHEN 40 THEN 'cstring' + END + END) as "TypeName" , IIF(f.rdb$character_length = 0, 32765, f.rdb$character_length) as "MaxLength" --hot fix for CORE-2228 , f.rdb$field_precision as "Precision" , 4 as "DateTimePrecision" Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderManifest.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderManifest.cs 2010-09-05 03:12:59 UTC (rev 51524) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderManifest.cs 2010-09-06 12:40:39 UTC (rev 51525) @@ -160,10 +160,9 @@ case "int": case "bigint": case "smallint_bool": - return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType); - case "float": case "double": + case "guid": return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType); case "decimal": @@ -214,7 +213,7 @@ break; default: - throw new NotSupportedException(String.Format("The underlying provider does not support the type '{0}'.", storeTypeName)); + throw new NotSupportedException(string.Format("The underlying provider does not support the type '{0}'.", storeTypeName)); } Debug.Assert(newPrimitiveTypeKind == PrimitiveTypeKind.String || newPrimitiveTypeKind == PrimitiveTypeKind.Binary, "at this point only string and binary types should be present"); @@ -404,6 +403,9 @@ case PrimitiveTypeKind.Time: return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["time"]); + case PrimitiveTypeKind.Guid: + return TypeUsage.CreateDefaultTypeUsage(StoreTypeNameToStorePrimitiveType["guid"]); + default: throw new NotSupportedException(string.Format("There is no store type corresponding to the EDM type '{0}' of primitive type '{1}'.", edmType, primitiveType.PrimitiveTypeKind)); } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs 2010-09-05 03:12:59 UTC (rev 51524) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbProviderServices.cs 2010-09-06 12:40:39 UTC (rev 51525) @@ -321,6 +321,9 @@ case PrimitiveTypeKind.Time: return FbDbType.Time; + case PrimitiveTypeKind.Guid: + return FbDbType.Guid; + default: Debug.Fail("unknown PrimitiveTypeKind " + primitiveTypeKind); throw new InvalidOperationException("unknown PrimitiveTypeKind " + primitiveTypeKind); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-10-12 13:00:53
|
Revision: 51661 http://firebird.svn.sourceforge.net/firebird/?rev=51661&view=rev Author: cincura_net Date: 2010-10-12 13:00:47 +0000 (Tue, 12 Oct 2010) Log Message: ----------- Order of calls. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbException.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs 2010-10-12 11:38:56 UTC (rev 51660) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscException.cs 2010-10-12 13:00:47 UTC (rev 51661) @@ -171,10 +171,10 @@ [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { + base.GetObjectData(info, context); + info.AddValue("errors", this.Errors); info.AddValue("errorCode", this.ErrorCode); - - base.GetObjectData(info, context); } #endif Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbException.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbException.cs 2010-10-12 11:38:56 UTC (rev 51660) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbException.cs 2010-10-12 13:00:47 UTC (rev 51661) @@ -125,9 +125,9 @@ [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { + base.GetObjectData(info, context); + info.AddValue("errors", this.errors); - - base.GetObjectData(info, context); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cin...@us...> - 2010-11-14 17:50:54
|
Revision: 51915 http://firebird.svn.sourceforge.net/firebird/?rev=51915&view=rev Author: cincura_net Date: 2010-11-14 17:50:45 +0000 (Sun, 14 Nov 2010) Log Message: ----------- Removed PROTOCOL_VERSION12 conditional symbol, now it's default. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs 2010-11-14 17:25:48 UTC (rev 51914) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsConnection.cs 2010-11-14 17:50:45 UTC (rev 51915) @@ -13,7 +13,7 @@ * language governing rights and limitations under the License. * * Copyright (c) 2002 - 2007 Carlos Guzman Alvarez - * Copyright (c) 2007 - 2008 Jiri Cincura (ji...@ci...) + * Copyright (c) 2007 - 2010 Jiri Cincura (ji...@ci...) * All Rights Reserved. */ @@ -168,11 +168,7 @@ outputStream.Write(1); // Architecture of client - Generic outputStream.Write(database); // Database path -#if (PROTOCOL_VERSION12) outputStream.Write(3); // Protocol versions understood -#else - outputStream.Write(2); // Protocol versions understood -#endif outputStream.WriteBuffer(user_id.ToArray()); // User identification Stuff outputStream.Write(IscCodes.PROTOCOL_VERSION10);// Protocol version @@ -187,13 +183,11 @@ outputStream.Write(5); // Maximum type (ptype_lazy_send) outputStream.Write(1); // Preference weight -#if (PROTOCOL_VERSION12) outputStream.Write(IscCodes.PROTOCOL_VERSION12);// Protocol version outputStream.Write(1); // Architecture of client - Generic outputStream.Write(2); // Minumum type (ptype_rpc) outputStream.Write(5); // Maximum type (ptype_lazy_send) outputStream.Write(2); // Preference weight -#endif } outputStream.Flush(); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs 2010-11-14 17:25:48 UTC (rev 51914) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs 2010-11-14 17:50:45 UTC (rev 51915) @@ -12,13 +12,11 @@ * express or implied. See the License for the specific * language governing rights and limitations under the License. * - * Copyright (c) 2009 Jiri Cincura (ji...@ci...) + * Copyright (c) 2009-2010 Jiri Cincura (ji...@ci...) * * All Rights Reserved. */ -#if (PROTOCOL_VERSION12) - using System; using System.Collections; using System.Data; @@ -95,6 +93,4 @@ #endregion } -} - -#endif \ No newline at end of file +} \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs 2010-11-14 17:25:48 UTC (rev 51914) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs 2010-11-14 17:50:45 UTC (rev 51915) @@ -16,8 +16,6 @@ * All Rights Reserved. */ -#if (PROTOCOL_VERSION12) - using System; using System.Collections; using System.Collections.Generic; @@ -127,6 +125,4 @@ #endregion } -} - -#endif \ No newline at end of file +} \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs 2010-11-14 17:25:48 UTC (rev 51914) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdClient/ClientFactory.cs 2010-11-14 17:50:45 UTC (rev 51915) @@ -82,10 +82,8 @@ switch (connection.ProtocolVersion) { -#if (PROTOCOL_VERSION12) case IscCodes.PROTOCOL_VERSION12: return new FirebirdSql.Data.Client.Managed.Version12.GdsDatabase(connection); -#endif case IscCodes.PROTOCOL_VERSION11: return new FirebirdSql.Data.Client.Managed.Version11.GdsDatabase(connection); case IscCodes.PROTOCOL_VERSION10: Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-11-14 17:25:48 UTC (rev 51914) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-11-14 17:50:45 UTC (rev 51915) @@ -40,7 +40,7 @@ <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>TRACE;DEBUG;NET_40;PROTOCOL_VERSION12</DefineConstants> + <DefineConstants>TRACE;DEBUG;NET_40;</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |