From: Carlos G. Á. <car...@us...> - 2005-09-09 21:35:09
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5092/Data/PostgreSqlClient Modified Files: PgCommand.cs PgCommandBuilder.cs PgConnection.cs PgConnectionInternal.cs PgDataAdapter.cs PgDataReader.cs PgErrorCollection.cs PgException.cs PgParameter.cs PgParameterCollection.cs PgTransaction.cs Log Message: Started the reorganization of the CVS module Index: PgConnectionInternal.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient/PgConnectionInternal.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgConnectionInternal.cs 8 Sep 2005 18:41:54 -0000 1.1 --- PgConnectionInternal.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 22,28 **** using System.Text; using System.Text.RegularExpressions; - - using Mono.Security.Protocol.Tls; - using PostgreSql.Data.Protocol; using PostgreSql.Data.DbSchema; --- 22,25 ---- *************** *** 124,129 **** this.pooled = true; this.database = new PgDbClient(); ! this.owningConnection = owningConnection; ! if (connectionString != null) { --- 121,125 ---- this.pooled = true; this.database = new PgDbClient(); ! if (connectionString != null) { *************** *** 140,145 **** try { - this.database.SslConnection = new SslConnectionCallback(OnSslConnection); - this.database.Settings = this.Options; this.database.Connect(); --- 136,139 ---- *************** *** 347,363 **** #endregion - - #region SSL Callbacks - - private void OnSslConnection() - { - // Server certificate validation - this.database.SslClientStream.ServerCertValidationDelegate = new CertificateValidationCallback(owningConnection.OnServerCertificateValidation); - - // Client certificate selection - this.database.SslClientStream.ClientCertSelectionDelegate = new CertificateSelectionCallback(owningConnection.OnClientCertificateSelection); - } - - #endregion } } \ No newline at end of file --- 341,344 ---- Index: PgDataReader.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient/PgDataReader.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgDataReader.cs 8 Sep 2005 18:41:54 -0000 1.1 --- PgDataReader.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 31,35 **** namespace PostgreSql.Data.PostgreSqlClient { ! public sealed class PgDataReader : MarshalByRefObject, IEnumerable, IDataReader, IDisposable, IDataRecord { #region · Fields · --- 31,35 ---- namespace PostgreSql.Data.PostgreSqlClient { ! public sealed class PgDataReader : DbDataReader { #region · Fields · *************** *** 49,52 **** --- 49,66 ---- #endregion + #region · Indexers · + + public override object this[int i] + { + get { return this.GetValue(i); } + } + + public override object this[string name] + { + get { return this.GetValue(this.GetOrdinal(name)); } + } + + #endregion + #region · Constructors · *************** *** 71,74 **** --- 85,89 ---- #region · Finalizer · + /// <include file='Doc/en_EN/FbDataReader.xml' path='doc/class[@name="FbDataReader"]/destructor[@name="Finalize"]/*'/> ~PgDataReader() { *************** *** 78,84 **** #endregion ! #region · IDisposable Methods · ! void IDisposable.Dispose() { this.Dispose(true); --- 93,99 ---- #endregion ! #region · IDisposable methods · ! public override void Dispose() { this.Dispose(true); *************** *** 96,104 **** // release any managed resources this.Close(); - - this.command = null; - this.connection = null; - this.row = null; - this.schemaTable= null; } --- 111,114 ---- *************** *** 108,112 **** { } ! this.disposed = true; } --- 118,122 ---- { } ! this.disposed = true; } *************** *** 115,141 **** #endregion ! #region IDataReader Properties & Methods ! public int Depth { get { return 0; } } ! public bool IsClosed { get { return !this.open; } } ! public int RecordsAffected { get { return this.IsClosed ? this.recordsAffected : -1; } } ! public bool HasRows { get { return this.command.Statement.HasRows; } } ! public void Close() { if (!this.open) --- 125,151 ---- #endregion ! #region · IDataReader Properties & Methods · ! public override int Depth { get { return 0; } } ! public override bool IsClosed { get { return !this.open; } } ! public override int RecordsAffected { get { return this.IsClosed ? this.recordsAffected : -1; } } ! public override bool HasRows { get { return this.command.Statement.HasRows; } } ! public override void Close() { if (!this.open) *************** *** 170,179 **** } ! public bool NextResult() { return false; } ! public bool Read() { bool read = false; --- 180,189 ---- } ! public override bool NextResult() { return false; } ! public override bool Read() { bool read = false; *************** *** 207,213 **** #endregion ! #region GetSchemaTable Method ! public DataTable GetSchemaTable() { if (schemaTable == null) --- 217,223 ---- #endregion ! #region · GetSchemaTable Method · ! public override DataTable GetSchemaTable() { if (schemaTable == null) *************** *** 355,380 **** #endregion ! #region Indexers ! ! public object this[int i] ! { ! get { return this.GetValue(i); } ! } ! ! public object this[string name] ! { ! get { return this.GetValue(this.GetOrdinal(name)); } ! } ! ! #endregion ! ! #region IDataRecord Properties & Methods ! public int FieldCount { get { return this.command.Statement.RowDescriptor.Fields.Length; } } ! public String GetName(int i) { this.CheckIndex(i); --- 365,376 ---- #endregion ! #region · IDataRecord Properties & Methods · ! public override int FieldCount { get { return this.command.Statement.RowDescriptor.Fields.Length; } } ! public override String GetName(int i) { this.CheckIndex(i); *************** *** 384,388 **** [EditorBrowsable(EditorBrowsableState.Never)] ! public String GetDataTypeName(int i) { this.CheckIndex(i); --- 380,384 ---- [EditorBrowsable(EditorBrowsableState.Never)] ! public override string GetDataTypeName(int i) { this.CheckIndex(i); *************** *** 391,395 **** } ! public Type GetFieldType(int i) { this.CheckIndex(i); --- 387,391 ---- } ! public override Type GetFieldType(int i) { this.CheckIndex(i); *************** *** 398,402 **** } ! public object GetValue(int i) { this.CheckPosition(); --- 394,398 ---- } ! public override object GetValue(int i) { this.CheckPosition(); *************** *** 406,414 **** } ! public int GetValues(object[] values) { this.CheckPosition(); ! for (int i = 0; i < FieldCount; i++) { values[i] = GetValue(i); --- 402,410 ---- } ! public override int GetValues(object[] values) { this.CheckPosition(); ! for (int i = 0; i < this.FieldCount; i++) { values[i] = GetValue(i); *************** *** 418,422 **** } ! public int GetOrdinal(string name) { if (this.IsClosed) --- 414,418 ---- } ! public override int GetOrdinal(string name) { if (this.IsClosed) *************** *** 425,429 **** } ! for (int i = 0; i < this.command.Statement.RowDescriptor.Fields.Length; i++) { if (this.CultureAwareCompare(command.Statement.RowDescriptor.Fields[i].FieldName, name)) --- 421,425 ---- } ! for (int i = 0; i < this.FieldCount; i++) { if (this.CultureAwareCompare(command.Statement.RowDescriptor.Fields[i].FieldName, name)) *************** *** 436,440 **** } ! public bool GetBoolean(int i) { this.CheckPosition(); --- 432,436 ---- } ! public override bool GetBoolean(int i) { this.CheckPosition(); *************** *** 444,448 **** } ! public byte GetByte(int i) { this.CheckPosition(); --- 440,444 ---- } ! public override byte GetByte(int i) { this.CheckPosition(); *************** *** 452,461 **** } ! public long GetBytes( ! int i, ! long dataIndex, ! byte[] buffer, ! int bufferIndex, ! int length) { int bytesRead = 0; --- 448,452 ---- } ! public override long GetBytes(int i, long dataIndex, byte[] buffer, int bufferIndex, int length) { int bytesRead = 0; *************** *** 498,502 **** [EditorBrowsable(EditorBrowsableState.Never)] ! public char GetChar(int i) { this.CheckPosition(); --- 489,493 ---- [EditorBrowsable(EditorBrowsableState.Never)] ! public override char GetChar(int i) { this.CheckPosition(); *************** *** 506,515 **** } ! public long GetChars( ! int i, ! long dataIndex, ! char[] buffer, ! int bufferIndex, ! int length) { this.CheckPosition(); --- 497,501 ---- } ! public override long GetChars(int i, long dataIndex, char[] buffer, int bufferIndex, int length) { this.CheckPosition(); *************** *** 555,564 **** } ! public Guid GetGuid(int i) { throw new NotSupportedException("Guid datatype is not supported"); } ! public Int16 GetInt16(int i) { this.CheckPosition(); --- 541,550 ---- } ! public override Guid GetGuid(int i) { throw new NotSupportedException("Guid datatype is not supported"); } ! public override Int16 GetInt16(int i) { this.CheckPosition(); *************** *** 568,572 **** } ! public Int32 GetInt32(int i) { this.CheckPosition(); --- 554,558 ---- } ! public override Int32 GetInt32(int i) { this.CheckPosition(); *************** *** 576,580 **** } ! public Int64 GetInt64(int i) { this.CheckPosition(); --- 562,566 ---- } ! public override Int64 GetInt64(int i) { this.CheckPosition(); *************** *** 584,588 **** } ! public float GetFloat(int i) { this.CheckPosition(); --- 570,574 ---- } ! public override float GetFloat(int i) { this.CheckPosition(); *************** *** 592,596 **** } ! public double GetDouble(int i) { this.CheckPosition(); --- 578,582 ---- } ! public override double GetDouble(int i) { this.CheckPosition(); *************** *** 600,604 **** } ! public String GetString(int i) { this.CheckPosition(); --- 586,590 ---- } ! public override string GetString(int i) { this.CheckPosition(); *************** *** 608,612 **** } ! public Decimal GetDecimal(int i) { this.CheckPosition(); --- 594,598 ---- } ! public override Decimal GetDecimal(int i) { this.CheckPosition(); *************** *** 616,620 **** } ! public DateTime GetDateTime(int i) { this.CheckPosition(); --- 602,606 ---- } ! public override DateTime GetDateTime(int i) { this.CheckPosition(); *************** *** 708,717 **** } ! public IDataReader GetData(int i) ! { ! throw new NotSupportedException(); ! } ! ! public bool IsDBNull(int i) { this.CheckPosition(); --- 694,698 ---- } ! public override bool IsDBNull(int i) { this.CheckPosition(); *************** *** 730,736 **** #endregion ! #region IEnumerable Methods ! IEnumerator IEnumerable.GetEnumerator() { return new DbEnumerator(this); --- 711,717 ---- #endregion ! #region · IEnumerable Methods · ! public override IEnumerator GetEnumerator() { return new DbEnumerator(this); Index: PgErrorCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient/PgErrorCollection.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgErrorCollection.cs 8 Sep 2005 18:41:54 -0000 1.1 --- PgErrorCollection.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 24,29 **** namespace PostgreSql.Data.PostgreSqlClient { ! [Serializable, ! ListBindable(false)] public sealed class PgErrorCollection : ICollection, IEnumerable { --- 24,28 ---- namespace PostgreSql.Data.PostgreSqlClient { ! [Serializable, ListBindable(false)] public sealed class PgErrorCollection : ICollection, IEnumerable { Index: PgParameterCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient/PgParameterCollection.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgParameterCollection.cs 8 Sep 2005 18:41:54 -0000 1.1 --- PgParameterCollection.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 19,22 **** --- 19,23 ---- using System; using System.Data; + using System.Data.Common; using System.ComponentModel; using System.Collections; *************** *** 25,68 **** namespace PostgreSql.Data.PostgreSqlClient { ! [ListBindable(false), ! Editor(typeof(Design.PgParameterCollectionEditor), typeof(System.Drawing.Design.UITypeEditor))] ! public sealed class PgParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable { #region · Fields · ! private ArrayList parameters = new ArrayList(); #endregion ! #region · Properties · ! object IDataParameterCollection.this[string parameterName] { ! get { return this[parameterName]; } ! set { this[parameterName] = (PgParameter)value; } } ! [Browsable(false), ! DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public PgParameter this[string parameterName] { ! get { return (PgParameter)this[IndexOf(parameterName)]; } ! set { this[IndexOf(parameterName)] = (PgParameter)value; } } ! object IList.this[int parameterIndex] { ! get { return (PgParameter)this.parameters[parameterIndex]; } ! set { this.parameters[parameterIndex] = (PgParameter)value; } } ! [Browsable(false), ! DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public PgParameter this[int parameterIndex] { ! get { return (PgParameter)this.parameters[parameterIndex]; } ! set { this.parameters[parameterIndex] = (PgParameter)value; } } ! #endregion --- 26,88 ---- namespace PostgreSql.Data.PostgreSqlClient { ! [ListBindable(false)] ! [Editor(typeof(Design.PgParameterCollectionEditor), typeof(System.Drawing.Design.UITypeEditor))] ! public sealed class PgParameterCollection : DbParameterCollection { #region · Fields · ! private ArrayList parameters; #endregion ! #region · Indexers · ! [Browsable(false)] ! [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public new PgParameter this[string parameterName] { ! get { return (PgParameter)this[this.IndexOf(parameterName)]; } ! set { this[this.IndexOf(parameterName)] = (PgParameter)value; } } ! [Browsable(false)] ! [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public new PgParameter this[int index] { ! get { return (PgParameter)this.parameters[index]; } ! set { this.parameters[index] = (PgParameter)value; } } ! #endregion ! ! #region · DbParameterCollection Properties · ! ! [Browsable(false)] ! [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public override int Count { ! get { return this.parameters.Count; } } ! public override bool IsFixedSize { ! get { return this.parameters.IsFixedSize; } } ! ! public override bool IsReadOnly ! { ! get { return this.parameters.IsReadOnly; } ! } ! ! public override bool IsSynchronized ! { ! get { return this.parameters.IsSynchronized; } ! } ! ! public override object SyncRoot ! { ! get { return this.parameters.SyncRoot; } ! } ! #endregion *************** *** 71,158 **** internal PgParameterCollection() { } #endregion ! #region · IList Properties · ! bool IList.IsFixedSize { ! get { return this.parameters.IsFixedSize; } } ! bool IList.IsReadOnly { ! get { return this.parameters.IsReadOnly; } } #endregion ! #region · ICollection Properties · ! [Browsable(false), ! DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public int Count { ! get { return this.parameters.Count; } } ! ! bool ICollection.IsSynchronized { ! get { return this.parameters.IsSynchronized; } } ! object ICollection.SyncRoot { ! get { return this.parameters.SyncRoot; } } ! #endregion ! ! #region · ICollection Methods · ! public void CopyTo(Array array, int index) { ! this.parameters.CopyTo(array, index); } ! #endregion ! #region · IList Methods · ! public void Clear() { ! this.parameters.Clear(); } ! #endregion ! #region · IEnumerable Methods · ! public IEnumerator GetEnumerator() ! { ! return this.parameters.GetEnumerator(); } ! #endregion ! #region · Methods · ! public bool Contains(object value) { return this.parameters.Contains(value); } ! public bool Contains(string parameterName) { return (-1 != this.IndexOf(parameterName)); } ! public int IndexOf(object value) { return this.parameters.IndexOf(value); } ! public int IndexOf(string parameterName) { int index = 0; --- 91,224 ---- internal PgParameterCollection() { + this.parameters = ArrayList.Synchronized(new ArrayList()); } #endregion ! #region · DbParameterCollection Protected methods · ! protected override DbParameter GetParameter(string parameterName) { ! return this[parameterName]; } ! protected override DbParameter GetParameter(int index) { ! return this[index]; ! } ! ! protected override void SetParameter(int index, DbParameter value) ! { ! this[index] = (PgParameter)value; ! } ! ! protected override void SetParameter(string parameterName, DbParameter value) ! { ! this[parameterName] = (PgParameter)value; } #endregion ! #region · DbParameterCollection overriden methods · ! public override void CopyTo(Array array, int index) { ! this.parameters.CopyTo(array, index); } ! ! public override void Clear() { ! this.parameters.Clear(); } ! public override IEnumerator GetEnumerator() { ! return this.parameters.GetEnumerator(); } ! public override void AddRange(Array values) ! { ! foreach (PgParameter parameter in values) ! { ! this.Add(parameter); ! } ! } ! public PgParameter Add(string parameterName, object value) { ! return this.Add(new PgParameter(parameterName, value)); } ! public PgParameter Add(string parameterName, PgDbType providerType) ! { ! return this.Add(new PgParameter(parameterName, providerType)); ! } ! public PgParameter Add(string parameterName, PgDbType providerType, int size) ! { ! return this.Add(new PgParameter(parameterName, providerType, size)); ! } ! public PgParameter Add(string parameterName, PgDbType providerType, int size, string sourceColumn) { ! return this.Add(new PgParameter(parameterName, providerType, size, sourceColumn)); } ! public PgParameter Add(PgParameter value) ! { ! lock (this.parameters.SyncRoot) ! { ! if (value == null) ! { ! throw new ArgumentException("The value parameter is null."); ! } ! if (value.Parent != null) ! { ! throw new ArgumentException("The PgParameter specified in the value parameter is already added to this or another FbParameterCollection."); ! } ! if (value.ParameterName == null || value.ParameterName.Length == 0) ! { ! //value.ParameterName = this.GenerateParameterName(); ! } ! else ! { ! if (this.IndexOf(value) != -1) ! { ! throw new ArgumentException("PgParameterCollection already contains PgParameter with ParameterName '" + value.ParameterName + "'."); ! } ! } ! this.parameters.Add(value); ! return value; ! } } ! public override int Add(object value) ! { ! if (!(value is PgParameter)) ! { ! throw new InvalidCastException("The parameter passed was not a PgParameter."); ! } ! return this.IndexOf(this.Add(value as PgParameter)); ! } ! public override bool Contains(object value) { return this.parameters.Contains(value); } ! public override bool Contains(string parameterName) { return (-1 != this.IndexOf(parameterName)); } ! public override int IndexOf(object value) { return this.parameters.IndexOf(value); } ! public override int IndexOf(string parameterName) { int index = 0; *************** *** 160,168 **** foreach (PgParameter item in this.parameters) { ! if (this.CultureAwareCompare(item.ParameterName, parameterName)) { return index; } - index++; } --- 226,233 ---- foreach (PgParameter item in this.parameters) { ! if (item.ParameterName == parameterName) { return index; } index++; } *************** *** 171,180 **** } ! public void Insert(int index, object value) { this.parameters.Insert(index, value); } ! public void Remove(object value) { if (!(value is PgParameter)) --- 236,245 ---- } ! public override void Insert(int index, object value) { this.parameters.Insert(index, value); } ! public override void Remove(object value) { if (!(value is PgParameter)) *************** *** 182,186 **** throw new InvalidCastException("The parameter passed was not a PgParameter."); } - if (!this.Contains(value)) { --- 247,250 ---- *************** *** 189,269 **** this.parameters.Remove(value); - } - - public void RemoveAt(int index) - { - this.parameters.RemoveAt(index); - } ! public void RemoveAt(string parameterName) ! { ! this.RemoveAt(IndexOf(parameterName)); } ! public int Add(object value) { ! if (!(value is PgParameter)) ! { ! throw new InvalidCastException("The parameter passed was not a PgParameter."); ! } ! ! return this.parameters.Add((PgParameter)value); } ! public PgParameter Add(PgParameter param) { ! if (param.ParameterName != null) ! { ! this.parameters.Add(param); ! ! return param; ! } ! else { ! throw new ArgumentException("parameter must be named"); } - } - - public PgParameter Add(string parameterName, PgDbType PgType) - { - PgParameter param = new PgParameter(parameterName, PgType); - - return Add(param); - } - - public PgParameter Add(string parameterName, object value) - { - PgParameter param = new PgParameter(parameterName, value); ! return Add(param); ! } ! ! public PgParameter Add(string parameterName, PgDbType PgType, int size) ! { ! PgParameter param = new PgParameter(parameterName, PgType, size); ! ! return Add(param); ! } ! ! public PgParameter Add(string parameterName, PgDbType PgType, int size, string sourceColumn) ! { ! PgParameter param = new PgParameter(parameterName, PgType, size, sourceColumn); ! ! return Add(param); ! } ! ! #endregion ! ! #region · Private Methods · ! ! private bool CultureAwareCompare(string strA, string strB) ! { ! return CultureInfo.CurrentCulture.CompareInfo.Compare( ! strA, ! strB, ! CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | ! CompareOptions.IgnoreCase) == 0 ? true : false; } ! #endregion } --- 253,276 ---- this.parameters.Remove(value); ! ((PgParameter)value).Parent = null; } ! public override void RemoveAt(string parameterName) { ! this.RemoveAt(this.IndexOf(parameterName)); } ! public override void RemoveAt(int index) { ! if (index < 0 || index > this.Count) { ! throw new IndexOutOfRangeException("The specified index does not exist."); } ! this[index].Parent = null; ! this.parameters.RemoveAt(index); } ! #endregion } Index: PgCommandBuilder.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient/PgCommandBuilder.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgCommandBuilder.cs 8 Sep 2005 18:41:54 -0000 1.1 --- PgCommandBuilder.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 27,831 **** namespace PostgreSql.Data.PostgreSqlClient { ! public sealed class PgCommandBuilder : Component ! { ! #region · Fields · ! ! private PgDataAdapter dataAdapter; ! private PgCommand insertCommand; ! private PgCommand updateCommand; ! private PgCommand deleteCommand; ! private DataTable schemaTable; ! private string sqlInsert; ! private string sqlUpdate; ! private string sqlDelete; ! private string separator; ! private string whereClausule1; ! private string whereClausule2; ! private string setClausule; ! private string tableName; ! private bool hasPrimaryKey; ! private bool hasUniqueKey; ! private string quotePrefix; ! private string quoteSuffix; ! private bool disposed; ! ! private PgRowUpdatingEventHandler adapterHandler; ! ! #endregion ! ! #region · Properties · ! ! [DefaultValue(null)] ! public PgDataAdapter DataAdapter ! { ! get { return this.dataAdapter; } ! set ! { ! this.dataAdapter = value; ! ! // Registers the CommandBuilder as a listener for RowUpdating events that are ! // generated by the PgDataAdapter specified in this property. ! if (this.dataAdapter != null) ! { ! this.adapterHandler = new PgRowUpdatingEventHandler(this.RowUpdatingHandler); ! this.dataAdapter.RowUpdating += this.adapterHandler; ! } ! } ! } ! ! [Browsable(false), ! DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public string QuotePrefix ! { ! get { return this.quotePrefix; } ! set ! { ! if (this.insertCommand != null || ! this.updateCommand != null || ! this.deleteCommand != null) ! { ! throw new InvalidOperationException("This property cannot be changed after an insert, update, or delete command has been generated."); ! } ! ! this.quotePrefix = value; ! } ! } ! ! [Browsable(false), ! DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public string QuoteSuffix ! { ! get { return this.quoteSuffix; } ! set ! { ! if (this.insertCommand != null || ! this.updateCommand != null || ! this.deleteCommand != null) ! { ! throw new InvalidOperationException("This property cannot be changed after an insert, update, or delete command has been generated."); ! } ! ! this.quoteSuffix = value; ! } ! } ! ! #endregion ! ! #region · Internal Properties · ! ! internal PgCommand SelectCommand ! { ! get ! { ! if (this.dataAdapter.SelectCommand != null) ! { ! return this.dataAdapter.SelectCommand; ! } ! ! return null; ! } ! } ! ! #endregion ! ! #region · Constructors · ! ! public PgCommandBuilder() : base() ! { ! this.sqlInsert = "INSERT INTO {0} ({1}) VALUES ({2})"; ! this.sqlUpdate = "UPDATE {0} SET {1} WHERE ( {2} )"; ! this.sqlDelete = "DELETE FROM {0} WHERE ( {1} )"; ! this.whereClausule1 = "(({0} IS NULL AND ${1} = NULL) OR ({0} = ${2}))"; ! // this.whereClausule2 = "({0} = ${1})"; ! // this.setClausule = "{0} = ${1}"; ! this.whereClausule2 = "({0} = {1})"; ! this.setClausule = "{0} = {1}"; ! this.separator = ", "; ! this.quotePrefix = String.Empty; ! this.quoteSuffix = String.Empty; ! ! GC.SuppressFinalize(this); ! } ! ! public PgCommandBuilder(PgDataAdapter adapter) : this() ! { ! this.DataAdapter = adapter; ! } ! ! #endregion ! ! #region · IDisposable Methods · ! ! protected override void Dispose(bool disposing) ! { ! if (!this.disposed) ! { ! try ! { ! if (disposing) ! { ! this.RefreshSchema(); ! ! if (this.adapterHandler != null) ! { ! this.dataAdapter.RowUpdating -= this.adapterHandler; ! } ! ! this.sqlInsert = null; ! this.sqlUpdate = null; ! this.sqlDelete = null; ! this.whereClausule1 = null; ! this.whereClausule2 = null; ! this.setClausule = null; ! this.separator = null; ! this.quotePrefix = null; ! this.quoteSuffix = null; ! } ! ! // release any unmanaged resources ! ! this.disposed = true; ! } ! finally ! { ! base.Dispose(disposing); ! } ! } ! } ! ! #endregion ! ! #region · Static Methods · ! ! public static void DeriveParameters(PgCommand command) ! { ! if (command.CommandType != CommandType.StoredProcedure) ! { ! throw new InvalidOperationException("The command text is not a valid stored procedure name."); ! } ! command.Parameters.Clear(); ! DataTable spSchema = command.Connection.GetSchema("Functions", new string[] { null, command.CommandText.ToLower() }); ! ! if (spSchema.Rows.Count != 0) ! { ! int[] parameterTypes = (int[])spSchema.Rows[0]["ARGUMENTS"]; ! int parameterCount = (short)spSchema.Rows[0]["ARGUMENT_NUMBER"]; ! for (int i = 0; i < parameterCount; i++) ! { ! PgParameter parameter = command.Parameters.Add( ! "@ip" + i.ToString(), ! (PgDbType)PgDbClient.Types[parameterTypes[i]].DataType); ! parameter.Direction = ParameterDirection.Input; ! } ! ! int returnType = (int)spSchema.Rows[0]["RETURN_TYPE"]; ! if (returnType != 0) ! { ! PgParameter parameter = command.Parameters.Add( ! "@op0", ! PgDbClient.Types[returnType]); ! parameter.Direction = ParameterDirection.Output; ! } ! } ! } ! #endregion ! #region · Methods · ! ! public PgCommand GetInsertCommand() ! { ! if (this.insertCommand == null) ! { ! this.BuildInsertCommand(null, null); ! } ! ! return this.insertCommand; ! } ! public PgCommand GetUpdateCommand() ! { ! if (this.updateCommand == null) ! { ! this.BuildUpdateCommand(null, null); ! } ! ! return this.updateCommand; ! } ! public PgCommand GetDeleteCommand() ! { ! if (this.deleteCommand == null) ! { ! this.BuildDeleteCommand(null, null); ! } ! ! return this.deleteCommand; ! } ! ! public void RefreshSchema() ! { ! if (this.dataAdapter != null) ! { ! if (this.dataAdapter.InsertCommand == this.insertCommand) ! { ! this.dataAdapter.InsertCommand = null; ! } ! if (this.dataAdapter.DeleteCommand == this.deleteCommand) ! { ! this.dataAdapter.DeleteCommand = null; ! } ! if (this.dataAdapter.UpdateCommand == this.updateCommand) ! { ! this.dataAdapter.UpdateCommand = null; ! } ! } ! if (this.insertCommand != null) ! { ! this.insertCommand.Dispose(); ! } ! if (this.updateCommand != null) ! { ! this.updateCommand.Dispose(); ! } ! if (this.deleteCommand != null) ! { ! this.deleteCommand.Dispose(); ! } ! if (this.schemaTable != null) ! { ! this.schemaTable.Dispose(); ! } ! this.schemaTable = null; ! this.insertCommand = null; ! this.updateCommand = null; ! this.deleteCommand = null; ! } #endregion ! #region Build Command Methods ! ! private PgCommand BuildInsertCommand(DataRow row, DataTableMapping tableMapping) ! { ! StringBuilder sql = new StringBuilder(); ! StringBuilder fields = new StringBuilder(); ! StringBuilder values = new StringBuilder(); ! ! this.BuildSchemaTable(); ! ! // Create a new command ! this.CreateCommand(ref this.insertCommand); ! ! int i = 1; ! foreach (DataRow schemaRow in schemaTable.Rows) ! { ! if (this.IsUpdatable(schemaRow, row, tableMapping)) ! { ! if (fields.Length > 0) ! { ! fields.Append(this.separator); ! } ! if (values.Length > 0) ! { ! values.Append(this.separator); ! } ! ! PgParameter parameter = this.CreateParameter( ! schemaRow, ! i, ! false); ! ! if (row != null && tableMapping != null) ! { ! DataColumn column = this.GetDataColumn( ! schemaRow["BaseColumnName"].ToString(), ! tableMapping, ! row); ! ! if (column != null) ! { ! parameter.Value = row[column]; ! } ! } ! ! i++; ! ! // Build Field name and append it to the string ! fields.Append(this.GetQuotedIdentifier(schemaRow["BaseColumnName"])); ! ! // Build value name and append it to the string ! values.Append(parameter.ParameterName); ! ! this.insertCommand.Parameters.Add(parameter); ! } ! } ! ! sql.AppendFormat( ! this.sqlInsert, ! this.GetQuotedIdentifier(tableName), ! fields.ToString(), ! values.ToString()); ! ! this.insertCommand.CommandText = sql.ToString(); ! ! return this.insertCommand; ! } ! ! private PgCommand BuildUpdateCommand(DataRow row, DataTableMapping tableMapping) ! { ! StringBuilder sql = new StringBuilder(); ! StringBuilder sets = new StringBuilder(); ! StringBuilder where = new StringBuilder(); ! ! this.BuildSchemaTable(); ! ! if (!this.hasPrimaryKey && !this.hasUniqueKey) ! { ! throw new InvalidOperationException("Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."); ! } ! ! // Create a new command ! this.CreateCommand(ref this.updateCommand); ! ! int i = 1; ! foreach (DataRow schemaRow in schemaTable.Rows) ! { ! if (this.IsUpdatable(schemaRow, row, tableMapping)) ! { ! if (sets.Length > 0) ! { ! sets.Append(separator); ! } ! ! PgParameter parameter = this.CreateParameter(schemaRow, i, false); ! ! // Build Field name and append it to the string ! sets.AppendFormat( ! this.setClausule, ! this.GetQuotedIdentifier(schemaRow["BaseColumnName"]), ! parameter.ParameterName); ! ! if (row != null && tableMapping != null) ! { ! DataColumn column = this.GetDataColumn( ! schemaRow["BaseColumnName"].ToString(), ! tableMapping, ! row); ! ! if (column != null) ! { ! parameter.Value = row[column]; ! } ! } ! ! this.updateCommand.Parameters.Add(parameter); ! ! i++; ! } ! } ! ! // Build where clausule ! foreach (DataRow schemaRow in schemaTable.Rows) ! { ! if (this.IncludedInWhereClause(schemaRow)) ! { ! if (where.Length > 0) ! { ! where.Append(" AND "); ! } ! ! string quotedId = this.GetQuotedIdentifier(schemaRow["BaseColumnName"]); ! ! PgParameter parameter = this.CreateParameter(schemaRow, i, true); ! ! where.AppendFormat( ! this.whereClausule2, ! quotedId, ! parameter.ParameterName); ! ! if (row != null && tableMapping != null) ! { ! DataColumn column = this.GetDataColumn( ! schemaRow["BaseColumnName"].ToString(), ! tableMapping, ! row); ! ! if (column != null) ! { ! parameter.Value = row[column, DataRowVersion.Original]; ! } ! } ! ! this.updateCommand.Parameters.Add(parameter); ! ! i++; ! } ! } ! ! sql.AppendFormat( ! this.sqlUpdate, ! this.GetQuotedIdentifier(tableName), ! sets.ToString(), ! where.ToString()); ! ! this.updateCommand.CommandText = sql.ToString(); ! ! return this.updateCommand; ! } ! ! private PgCommand BuildDeleteCommand(DataRow row, DataTableMapping tableMapping) ! { ! StringBuilder sql = new StringBuilder(); ! StringBuilder where = new StringBuilder(); ! string dsColumnName = String.Empty; ! ! this.BuildSchemaTable(); ! ! if (!this.hasPrimaryKey && !this.hasUniqueKey) ! { ! throw new InvalidOperationException("Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information."); ! } ! ! // Create a new command ! this.CreateCommand(ref this.deleteCommand); ! ! // Build where clausule ! int i = 1; ! foreach (DataRow schemaRow in schemaTable.Rows) ! { ! if (this.IncludedInWhereClause(schemaRow)) ! { ! if (where.Length > 0) ! { ! where.Append(" AND "); ! } ! ! string quotedId = this.GetQuotedIdentifier(schemaRow["BaseColumnName"]); ! ! PgParameter parameter = this.CreateParameter(schemaRow, i, true); ! ! where.AppendFormat( ! this.whereClausule2, ! quotedId, ! parameter.ParameterName); ! ! if (row != null && tableMapping != null) ! { ! DataColumn column = this.GetDataColumn( ! schemaRow["BaseColumnName"].ToString(), ! tableMapping, ! row); ! ! if (column != null) ! { ! parameter.Value = row[column, DataRowVersion.Original]; ! } ! } ! ! this.deleteCommand.Parameters.Add(parameter); ! ! i++; ! } ! } ! ! sql.AppendFormat( ! this.sqlDelete, ! this.GetQuotedIdentifier(tableName), ! where.ToString()); ! ! this.deleteCommand.CommandText = sql.ToString(); ! ! return this.deleteCommand; ! } ! ! private PgParameter CreateParameter( ! DataRow schemaRow, ! int index, ! bool isWhereParameter) ! { ! PgParameter parameter = new PgParameter(String.Format("@p{0}", index), (PgDbType)schemaRow["ProviderType"]); ! ! parameter.Size = Convert.ToInt32(schemaRow["ColumnSize"]); ! if (schemaRow["NumericPrecision"] != DBNull.Value) ! { ! parameter.Precision = Convert.ToByte(schemaRow["NumericPrecision"]); ! } ! if (schemaRow["NumericScale"] != DBNull.Value) ! { ! parameter.Precision = Convert.ToByte(schemaRow["NumericScale"]); ! } ! parameter.SourceColumn = Convert.ToString(schemaRow["BaseColumnName"]); ! ! if (isWhereParameter) ! { ! parameter.SourceVersion = DataRowVersion.Original; ! } ! else ! { ! parameter.SourceVersion = DataRowVersion.Current; ! } ! ! return parameter; ! } ! ! private bool IsUpdatable( ! DataRow schemaRow, ! DataRow row, ! DataTableMapping tableMapping) ! { ! if (row != null && tableMapping != null) ! { ! DataColumn column = this.GetDataColumn( ! schemaRow["BaseColumnName"].ToString(), ! tableMapping, ! row); ! ! if (column != null) ! { ! if (column.Expression != null && column.Expression.Length != 0) ! { ! return false; ! } ! if (column.AutoIncrement) ! { ! return false; ! } ! if (column.ReadOnly) ! { ! return false; ! } ! } ! } ! ! if ((bool) schemaRow["IsExpression"]) ! { ! return false; ! } ! if ((bool) schemaRow["IsAutoIncrement"]) ! { ! return false; ! } ! if ((bool) schemaRow["IsRowVersion"]) ! { ! return false; ! } ! if ((bool) schemaRow["IsReadOnly"]) ! { ! return false; ! } ! ! return true; ! } ! private bool IncludedInWhereClause(DataRow schemaRow) ! { ! PgDbType pgDbType = (PgDbType)schemaRow["ProviderType"]; ! if (!(bool)schemaRow["IsKey"]) ! { ! return false; ! } ! if (pgDbType == PgDbType.Binary) ! { ! return false; ! } ! if (pgDbType == PgDbType.Array) ! { ! return false; ! } ! return true; ! } ! private void BuildSchemaTable() ! { ! bool mustClose = false; ! if (this.SelectCommand == null) ! { ! throw new InvalidOperationException("The DataAdapter.SelectCommand property needs to be initialized."); ! } ! if (this.SelectCommand.Connection == null) ! { ! throw new InvalidOperationException("The DataAdapter.SelectCommand.Connection property needs to be initialized."); ! } ! if (this.schemaTable == null) ! { ! if (this.SelectCommand.Connection.State == ConnectionState.Closed) ! { ! mustClose = true; ! this.SelectCommand.Connection.Open(); ! } ! try ! { ! PgDataReader reader = SelectCommand.ExecuteReader(CommandBehavior.SchemaOnly); ! schemaTable = reader.GetSchemaTable(); ! reader.Close(); ! this.CheckSchemaTable(); ! } ! catch ! { ! throw; ! } ! finally ! { ! if (mustClose) ! { ! this.SelectCommand.Connection.Close(); ! } ! } ! } ! } ! private void CheckSchemaTable() ! { ! tableName = String.Empty; ! hasPrimaryKey = false; ! hasUniqueKey = false; ! foreach (DataRow schemaRow in schemaTable.Rows) ! { ! if (tableName.Length == 0) ! { ! tableName = (string)schemaRow["BaseSchemaName"] + "." + ! (string)schemaRow["BaseTableName"]; ! } ! if (!(bool)schemaRow["IsExpression"] && tableName != (string)schemaRow["BaseSchemaName"] + "." + (string)schemaRow["BaseTableName"]) ! { ! throw new InvalidOperationException("Dynamic SQL generation is not supported against multiple base tables."); ! } ! if ((bool)schemaRow["IsKey"]) ! { ! hasPrimaryKey = true; ! } ! if ((bool)schemaRow["IsUnique"]) ! { ! hasUniqueKey = true; ! } ! } ! } ! private string GetQuotedIdentifier(object identifier) ! { ! return quotePrefix + identifier.ToString() + quoteSuffix; ! } ! private void CreateCommand(ref PgCommand command) ! { ! if (command == null) ! { ! command = this.SelectCommand.Connection.CreateCommand(); ! } ! command.Transaction = this.SelectCommand.Transaction; ! command.CommandType = CommandType.Text; ! // None is the Default value for automatically generated commands ! command.UpdatedRowSource = UpdateRowSource.None; ! command.Parameters.Clear(); ! } ! private DataColumn GetDataColumn( ! string columnName, ! DataTableMapping tableMapping, ! DataRow row) ! { ! DataColumn dataColumn = null; ! // Get the DataColumnMapping that matches ! // the given column name ! DataColumnMapping columnMapping = tableMapping.GetColumnMappingBySchemaAction( ! columnName, ! this.dataAdapter.MissingMappingAction); ! if (columnMapping != null) ! { ! // Get the DataColumn for the given column name ! dataColumn = columnMapping.GetDataColumnBySchemaAction( ! row.Table, ! null, ! this.dataAdapter.MissingSchemaAction); ! } ! return dataColumn; ! } ! #endregion ! #region Event Handler Methods private void RowUpdatingHandler(object sender, PgRowUpdatingEventArgs e) { ! if (e.Status != UpdateStatus.Continue) ! { ! return; ! } ! ! // Check that we can really build a new command. ! // If the command passed in the FbRowUpdatingEventArgs ! // is different than the one existent in the CommabdBuilder ! // we can't build a new command ! if (e.Command != null) ! { ! PgCommand command = null; ! ! switch (e.StatementType) ! { ! case StatementType.Insert: ! command = this.insertCommand; ! break; ! ! case StatementType.Update: ! command = this.updateCommand; ! break; ! ! case StatementType.Delete: ! deleteCommand = this.deleteCommand; ! break; ! } ! ! if (command != e.Command) ! { ! return; ! } ! } ! ! try ! { ! switch (e.StatementType) ! { ! case StatementType.Insert: ! e.Command = this.BuildInsertCommand(e.Row, e.TableMapping); ! break; ! ! case StatementType.Update: ! e.Command = this.BuildUpdateCommand(e.Row, e.TableMapping); ! break; ! ! case StatementType.Delete: ! e.Command = this.BuildDeleteCommand(e.Row, e.TableMapping); ! break; ! } ! } ! catch (Exception exception) ! { ! e.Errors = exception; ! e.Status = UpdateStatus.ErrorsOccurred; ! } } #endregion ! } } --- 27,177 ---- namespace PostgreSql.Data.PostgreSqlClient { ! public sealed class PgCommandBuilder : DbCommandBuilder ! { ! #region · Fields · ! private PgRowUpdatingEventHandler rowUpdatingHandler; ! #endregion ! #region · Properties · ! [DefaultValue(null)] ! public new PgDataAdapter DataAdapter ! { ! get { return (PgDataAdapter)base.DataAdapter; } ! set { base.DataAdapter = value; } ! } ! #endregion ! #region · Constructors · ! public PgCommandBuilder() ! : this(null) ! { ! } ! public PgCommandBuilder(PgDataAdapter adapter) ! : base() ! { ! this.DataAdapter = adapter; ! this.ConflictOption = ConflictOption.OverwriteChanges; ! } ! #endregion ! #region · Static Methods · ! /// <include file='Doc/en_EN/FbCommandBuilder.xml' path='doc/class[@name="FbCommandBuilder"]/method[@name="DeriveParameters(PgCommand)"]/*'/> ! public static void DeriveParameters(PgCommand command) ! { ! } #endregion ! #region · DbCommandBuilder methods · ! public new PgCommand GetInsertCommand() ! { ! return base.GetInsertCommand() as PgCommand; ! } ! public new PgCommand GetUpdateCommand() ! { ! return base.GetUpdateCommand() as PgCommand; ! } ! public new PgCommand GetUpdateCommand(bool useColumnsForParameterNames) ! { ! return base.GetUpdateCommand(useColumnsForParameterNames) as PgCommand; ! } ! public new PgCommand GetDeleteCommand() ! { ! return base.GetDeleteCommand() as PgCommand; ! } ! public new PgCommand GetDeleteCommand(bool useColumnsForParameterNames) ! { ! return base.GetDeleteCommand(useColumnsForParameterNames) as PgCommand; ! } ! public override string QuoteIdentifier(string unquotedIdentifier) ! { ! if (unquotedIdentifier == null) ! { ! throw new ArgumentNullException("Unquoted identifier parameter cannot be null"); ! } ! return String.Format(base.QuotePrefix, unquotedIdentifier, base.QuoteSuffix); ! } ! public override string UnquoteIdentifier(string quotedIdentifier) ! { ! if (quotedIdentifier == null) ! { ! throw new ArgumentNullException("Quoted identifier parameter cannot be null"); ! } ! string unquotedIdentifier = quotedIdentifier.Trim(); ! if (unquotedIdentifier.StartsWith(base.QuotePrefix)) ! { ! unquotedIdentifier = unquotedIdentifier.Remove(0, 1); ! } ! if (unquotedIdentifier.EndsWith(base.QuoteSuffix)) ! { ! unquotedIdentifier = unquotedIdentifier.Remove(unquotedIdentifier.Length - 1, 1); ! } ! return unquotedIdentifier; ! } ! #endregion ! #region · Protected DbCommandBuilder methods · ! protected override void ApplyParameterInfo(DbParameter p, DataRow row, StatementType statementType, bool whereClause) ! { ! } ! protected override string GetParameterName(int parameterOrdinal) ! { ! return String.Format("@p{0}", parameterOrdinal); ! } ! protected override string GetParameterName(string parameterName) ! { ! return String.Format("@{0}", parameterName); ! } ! protected override string GetParameterPlaceholder(int parameterOrdinal) ! { ! return this.GetParameterName(parameterOrdinal); ! } ! protected override void SetRowUpdatingHandler(DbDataAdapter adapter) ! { ! if (!(adapter is PgDataAdapter)) ! { ! throw new InvalidOperationException("adapter needs to be a PgDataAdapter"); ! } ! this.rowUpdatingHandler = new PgRowUpdatingEventHandler(this.RowUpdatingHandler); ! ((PgDataAdapter)adapter).RowUpdating += this.rowUpdatingHandler; ! } ! #endregion ! #region · Event Handlers · private void RowUpdatingHandler(object sender, PgRowUpdatingEventArgs e) { ! base.RowUpdatingHandler(e); } #endregion ! } ! } Index: PgParameter.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient/PgParameter.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgParameter.cs 8 Sep 2005 18:41:54 -0000 1.1 --- PgParameter.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 19,22 **** --- 19,23 ---- using System; using System.Data; + using System.Data.Common; using System.ComponentModel; *************** *** 25,45 **** namespace PostgreSql.Data.PostgreSqlClient { ! [ParenthesizePropertyName(true), ! TypeConverter(typeof(Design.PgParameterConverter))] ! public sealed class PgParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable { #region · Fields · ! ParameterDirection direction; ! DataRowVersion sourceVersion; ! bool isNullable; ! string parameterName; ! string sourceColumn; ! object value; ! byte precision; ! byte scale; ! int size; ! PgDbType pgDbType; ! bool inferType; #endregion --- 26,48 ---- namespace PostgreSql.Data.PostgreSqlClient { ! [ParenthesizePropertyName(true)] ! [TypeConverter(typeof(Design.PgParameterConverter))] ! public sealed class PgParameter : DbParameter, ICloneable { #region · Fields · ! private ParameterDirection direction; ! private DataRowVersion sourceVersion; ! private bool isNullable; ! private string parameterName; ! private string sourceColumn; ! private object value; ! private byte precision; ! private byte scale; ! private int size; ! private PgDbType providerType; ! private bool inferType; ! private string sourceColumnNullMapping; ! private PgParameterCollection parent; #endregion *************** *** 47,58 **** #region · Properties · - string IDataParameter.ParameterName - { - get { return this.ParameterName; } - set { this.ParameterName = value; } - } - [DefaultValue("")] ! public string ParameterName { get { return this.parameterName; } --- 50,55 ---- #region · Properties · [DefaultValue("")] ! public override string ParameterName { get { return this.parameterName; } *************** *** 60,64 **** } ! [Category("Data"), DefaultValue((byte)0)] public byte Precision { --- 57,62 ---- } ! [Category("Data")] ! [DefaultValue((byte)0)] public byte Precision { *************** *** 67,71 **** } ! [Category("Data"), DefaultValue((byte)0)] public byte Scale { --- 65,70 ---- } ! [Category("Data")] ! [DefaultValue((byte)0)] public byte Scale { *************** *** 74,79 **** } ! [Category("Data"), DefaultValue(0)] ! public int Size { get { return this.size; } --- 73,79 ---- } ! [Category("Data")] ! [DefaultValue(0)] ! public override int Size { get { return this.size; } *************** *** 81,108 **** } ! [Browsable(false), ! Category("Data"), ! RefreshProperties(RefreshProperties.All), ! DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public DbType DbType { ! get { return this.PgDbTypeToDbType(this.pgDbType); } ! set { this.pgDbType = this.DbTypeToPgType(value); } } ! [RefreshProperties(RefreshProperties.All), ! Category("Data"), ! DefaultValue(PgDbType.VarChar)] public PgDbType PgDbType { ! get { return this.pgDbType; } ! set ! { ! this.pgDbType = value; ! } } ! [Category("Data"), DefaultValue(ParameterDirection.Input)] ! public ParameterDirection Direction { get { return this.direction; } --- 81,106 ---- } ! [Browsable(false)] ! [Category("Data")] ! [RefreshProperties(RefreshProperties.All)] ! [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] ! public override DbType DbType { ! get { return this.PgDbTypeToDbType(this.providerType); } ! set { this.providerType = this.DbTypeToPgType(value); } } ! [RefreshProperties(RefreshProperties.All)] ! [Category("Data")] ! [DefaultValue(PgDbType.VarChar)] public PgDbType PgDbType { ! get { return this.providerType; } ! set { this.providerType = value; } } ! [Category("Data")] ! [DefaultValue(ParameterDirection.Input)] ! public override ParameterDirection Direction { get { return this.direction; } *************** *** 110,118 **** } ! [Browsable(false), ! DesignOnly(true), ! DefaultValue(false), ! EditorBrowsable(EditorBrowsableState.Advanced)] ! public bool IsNullable { get { return this.isNullable; } --- 108,116 ---- } ! [Browsable(false)] ! [DesignOnly(true)] ! [DefaultValue(false)] ! [EditorBrowsable(EditorBrowsableState.Advanced)] ! public override bool IsNullable { get { return this.isNullable; } *************** *** 120,125 **** } ! [Category("Data"), DefaultValue("")] ! public string SourceColumn { get { return this.sourceColumn; } --- 118,124 ---- } ! [Category("Data")] ! [DefaultValue("")] ! public override string SourceColumn { get { return this.sourceColumn; } *************** *** 127,132 **** } ! [Category("Data"), DefaultValue(DataRowVersion.Current)] ! public DataRowVersion SourceVersion { get { return this.sourceVersion; } --- 126,132 ---- } ! [Category("Data")] ! [DefaultValue(DataRowVersion.Current)] ! public override DataRowVersion SourceVersion { get { return this.sourceVersion; } *************** *** 134,141 **** } ! [Category("Data"), ! TypeConverter(typeof(StringConverter)), ! DefaultValue(null)] ! public object Value { get { return this.value; } --- 134,141 ---- } ! [Category("Data")] ! [TypeConverter(typeof(StringConverter))] ! [DefaultValue(null)] ! public override object Value { get { return this.value; } *************** *** 154,157 **** --- 154,179 ---- } + public override int Offset + { + get { throw new Exception("The method or operation is not implemented."); } + set { throw new Exception("The method or operation is not implemented."); } + } + + public override bool SourceColumnNullMapping + { + get { throw new Exception("The method or operation is not implemented."); } + set { throw new Exception("The method or operation is not implemented."); } + } + + #endregion + + #region · Internal Properties · + + internal PgParameterCollection Parent + { + get { return this.parent; } + set { this.parent = value; } + } + #endregion *************** *** 163,167 **** this.sourceVersion = DataRowVersion.Current; this.isNullable = false; ! this.pgDbType = PgDbType.VarChar; this.inferType = true; } --- 185,189 ---- this.sourceVersion = DataRowVersion.Current; this.isNullable = false; ! this.providerType = PgDbType.VarChar; this.inferType = true; } *************** *** 178,182 **** this.inferType = false; this.parameterName = parameterName; ! this.pgDbType = dbType; } --- 200,204 ---- this.inferType = false; this.parameterName = parameterName; ! this.providerType = dbType; } *************** *** 185,189 **** this.inferType = false; this.parameterName = parameterName; ! this.pgDbType = dbType; this.size = size; } --- 207,211 ---- this.inferType = false; this.parameterName = parameterName; ! this.providerType = dbType; this.size = size; } *************** *** 197,201 **** this.inferType = false; this.parameterName = parameterName; ! this.pgDbType = dbType; this.size = size; this.sourceColumn = sourceColumn; --- 219,223 ---- this.inferType = false; this.parameterName = parameterName; ! this.providerType = dbType; this.size = size; this.sourceColumn = sourceColumn; *************** *** 217,221 **** this.inferType = false; this.parameterName = parameterName; ! this.pgDbType = dbType; this.size = size; this.direction = direction; --- 239,243 ---- this.inferType = false; this.parameterName = parameterName; ! this.providerType = dbType; this.size = size; this.direction = direction; *************** *** 230,250 **** #endregion ! #region · ICloneable Method · object ICloneable.Clone() { ! return new PgParameter( ! this.parameterName, ! this.PgDbType, ! this.size, ! this.direction, ! this.isNullable, ! this.precision, ! this.scale, ! this.sourceColumn, ! this.sourceVersion, ! this.value); } ! #endregion --- 252,262 ---- #endregion ! #region · ICloneable Methods · object ICloneable.Clone() { ! throw new NotImplementedException(); } ! #endregion *************** *** 265,269 **** string returnValue = String.Empty; ! switch (this.pgDbType) { case PgDbType.Array: --- 277,281 ---- string returnValue = String.Empty; ! switch (this.providerType) { case PgDbType.Array: *************** *** 385,388 **** --- 397,409 ---- #endregion + #region · Protected Methods · + + public override void ResetDbType() + { + throw new Exception("The method or operation is not implemented."); + } + + #endregion + #region · Private Methods · *************** *** 397,405 **** { case TypeCode.Byte: ! this.pgDbType = PgDbType.Byte; break; case TypeCode.Boolean: ! this.pgDbType = PgDbType.Boolean; break; --- 418,426 ---- { case TypeCode.Byte: ! this.providerType = PgDbType.Byte; break; case TypeCode.Boolean: ! this.providerType = PgDbType.Boolean; break; *************** *** 410,442 **** case TypeCode.String: case TypeCode.Char: ! this.pgDbType = PgDbType.Char; break; case TypeCode.Int16: ! this.pgDbType = PgDbType.Int2; break; case Typ... [truncated message content] |