Thread: [pgsqlclient-checkins] pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient PgCommand.cs,NONE,1.1
Status: Inactive
Brought to you by:
carlosga_fb
Update of /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PostgreSqlClient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7345/Data/PostgreSqlClient Added Files: PgCommand.cs PgCommandBuilder.cs PgConnection.cs PgConnectionInternal.cs PgConnectionPool.cs PgDataAdapter.cs PgDataReader.cs PgDbType.cs PgError.cs PgErrorCollection.cs PgException.cs PgInfoMessageEventArgs.cs PgNotificationEventArgs.cs PgNotificationEventHandler.cs PgParameter.cs PgParameterCollection.cs PgRowUpdatedEventArgs.cs PgRowUpdatingEventArgs.cs PgTransaction.cs Log Message: Started the reorganization of the CVS module --- NEW FILE: PgTransaction.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; using System.Data; using System.Collections; using PostgreSql.Data.Protocol; namespace PostgreSql.Data.PostgreSqlClient { public sealed class PgTransaction : MarshalByRefObject, IDbTransaction, IDisposable { #region · Fields · private PgConnection connection; private IsolationLevel isolationLevel; private bool disposed; private bool isUpdated; #endregion #region · Properties · IDbConnection IDbTransaction.Connection { get { return this.Connection; } } public PgConnection Connection { get { if (!this.isUpdated) { return this.connection; } else { return null; } } } public IsolationLevel IsolationLevel { get { return this.isolationLevel; } } internal bool IsUpdated { get { return this.isUpdated; } set { if (this.connection != null && value) { this.connection.InternalConnection.ActiveTransaction = null; this.connection = null; } this.isUpdated = value; } } #endregion #region · Constructors · private PgTransaction() : this(null) { } internal PgTransaction(PgConnection connection) : this(connection, IsolationLevel.ReadCommitted) { } internal PgTransaction(PgConnection connection, IsolationLevel isolation) { this.connection = connection; this.isolationLevel = isolation; } #endregion #region · Finalizer · ~PgTransaction() { this.Dispose(false); } #endregion #region · IDisposable Methods · public void Dispose() { this.Dispose(true); GC.SuppressFinalize(this); } private void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { try { if (this.connection != null && !this.isUpdated) { // Implicitly roll back if the transaction still valid. this.Rollback(); } } finally { if (this.connection != null) { this.connection.InternalConnection.ActiveTransaction = null; this.connection = null; } this.disposed = true; this.isUpdated = true; } } } } #endregion #region · Methods · public void Commit() { if (this.isUpdated) { throw new InvalidOperationException("This Transaction has completed; it is no longer usable."); } try { this.connection.InternalConnection.Database.CommitTransaction(); this.IsUpdated = true; } catch (PgClientException ex) { throw new PgException(ex.Message, ex); } } public void Rollback() { if (this.isUpdated) { throw new InvalidOperationException("This Transaction has completed; it is no longer usable."); } try { this.connection.InternalConnection.Database.RollbackTransction(); this.IsUpdated = true; } catch (PgClientException ex) { throw new PgException(ex.Message, ex); } } #endregion #region · Internal Methods · internal void InternalBeginTransaction() { try { this.connection.InternalConnection.Database.BeginTransaction(isolationLevel); this.IsUpdated = false; } catch (PgClientException ex) { throw new PgException(ex.Message, ex); } } #endregion } } --- NEW FILE: PgInfoMessageEventArgs.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; using PostgreSql.Data.Protocol; using PostgreSql.Data.DbSchema; namespace PostgreSql.Data.PostgreSqlClient { #region Delegates public delegate void PgInfoMessageEventHandler(object sender, PgInfoMessageEventArgs e); #endregion public sealed class PgInfoMessageEventArgs : EventArgs { #region · Fields · private PgErrorCollection errors = new PgErrorCollection(); private string message = String.Empty; #endregion #region · Properties · public PgErrorCollection Errors { get { return this.errors; } } public string Message { get { return this.message; } } #endregion #region · Constructors · internal PgInfoMessageEventArgs(PgClientException ex) { this.message = ex.Message; foreach (PgClientError error in ex.Errors) { PgError newError = new PgError(); newError.Severity = error.Severity; newError.Code = error.Code; newError.Message = error.Message; newError.Detail = error.Detail; newError.Hint = error.Hint; newError.Line = error.Line; newError.Where = error.Where; newError.Position = error.Position; newError.Routine = error.Routine; this.errors.Add(newError); } } #endregion } } --- NEW FILE: PgNotificationEventHandler.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PostgreSqlClient { public delegate void PgNotificationEventHandler(object sender, PgNotificationEventArgs e); } --- NEW FILE: PgConnectionPool.cs --- // // Firebird .NET Data Provider - Firebird managed data provider for .NET and Mono // Copyright (C) 2002-2004 Carlos Guzman Alvarez // // Distributable under LGPL license. // You may obtain a copy of the License at http://www.gnu.org/copyleft/lesser.html // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // using System; using System.Data; using System.Collections; using System.Threading; namespace PostgreSql.Data.PostgreSqlClient { internal class PgConnectionPool : MarshalByRefObject { #region · Fields · private static ConnectionPool pool = null; #endregion #region · Methods · public static void Init() { if (pool == null) { pool = new ConnectionPool(); } } public static PgConnectionInternal GetConnection(string connectionString, PgConnection owningConnection) { Init(); return ((PgConnectionInternal)pool.CheckOut(connectionString, owningConnection)); } public static void FreeConnection(PgConnectionInternal c) { pool.CheckIn(c); } #endregion } internal class ConnectionPool { #region · Fields · private ArrayList locked; private ArrayList unlocked; private Thread cleanUpThread; #endregion #region · Constructors · public ConnectionPool() { this.locked = ArrayList.Synchronized(new ArrayList()); this.unlocked = ArrayList.Synchronized(new ArrayList()); this.cleanUpThread = new Thread(new ThreadStart(RunCleanUp)); this.cleanUpThread.Name = "CleanUp Thread"; this.cleanUpThread.Start(); this.cleanUpThread.IsBackground = true; } #endregion #region · Methods · public PgConnectionInternal CheckOut(string connectionString, PgConnection owningConnection) { PgConnectionInternal newConnection = null; lock (typeof(PgConnectionPool)) { if (this.unlocked.Count > 0) { long now = System.DateTime.Now.Ticks; PgConnectionInternal[] list = new PgConnectionInternal[this.unlocked.Count]; this.unlocked.CopyTo(0, list, 0, list.Length); foreach (PgConnectionInternal connection in list) { if (this.Validate(connection, connectionString)) { if (connection.Lifetime != 0) { if ((now - connection.Created) > connection.Lifetime) { this.unlocked.Remove(connection); this.Expire(connection); } else { this.unlocked.Remove(connection); this.locked.Add(connection); connection.OwningConnection = owningConnection; return connection; } } else { this.unlocked.Remove(connection); this.locked.Add(connection); connection.OwningConnection = owningConnection; return connection; } } else { this.unlocked.Remove(connection); this.Expire(connection); } } } newConnection = this.Create(connectionString); newConnection.OwningConnection = owningConnection; newConnection.Pooled = true; newConnection.Created = System.DateTime.Now.Ticks; newConnection.Connect(); this.locked.Add(newConnection); } return newConnection; } public void CheckIn(PgConnectionInternal connection) { lock (typeof(PgConnectionPool)) { connection.Created = System.DateTime.Now.Ticks; connection.OwningConnection = null; this.locked.Remove(connection); this.unlocked.Add(connection); } } #endregion #region · Private Methods · private void RunCleanUp() { TimeSpan interval = new TimeSpan(0, 0, 10); while (true) { this.CleanUp(null); Thread.Sleep(interval); } } private PgConnectionInternal Create(string connectionString) { try { PgConnectionInternal connection = new PgConnectionInternal(connectionString); return connection; } catch (Exception) { throw; } } private bool Validate(PgConnectionInternal connection, string connectionString) { try { return (connection.ConnectionString == connectionString && connection.Verify()); } catch (Exception) { throw; } } private void Expire(PgConnectionInternal connection) { try { if (connection.Verify()) { connection.Disconnect(); } } catch (Exception) { throw new PgException("Error closing database connection."); } } private void CleanUp(object State) { long now = System.DateTime.Now.Ticks; lock (this.unlocked.SyncRoot) { if (this.unlocked.Count > 0) { PgConnectionInternal[] list = new PgConnectionInternal[this.unlocked.Count]; this.unlocked.CopyTo(0, list, 0, list.Length); foreach (PgConnectionInternal connection in list) { if (connection.Lifetime != 0) { if ((now - connection.Created) >= connection.Lifetime) { this.unlocked.Remove(connection); this.Expire(connection); } } } } } } #endregion } } --- NEW FILE: PgConnectionInternal.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; using System.Collections; using System.Data; using System.Text; using System.Text.RegularExpressions; using Mono.Security.Protocol.Tls; using PostgreSql.Data.Protocol; using PostgreSql.Data.DbSchema; namespace PostgreSql.Data.PostgreSqlClient { internal sealed class PgConnectionInternal : MarshalByRefObject { #region · Fields · private string connectionString; private PgConnection owningConnection; private PgDbClient database; private PgConnectionParams options; private PgTransaction activeTransaction; private ArrayList preparedCommands; private int lifetime; private long created; private bool pooled; #endregion #region · Properties · public PgDbClient Database { get { return this.database; } } public PgTransaction ActiveTransaction { get { return this.activeTransaction; } set { this.activeTransaction = value; } } public string ConnectionString { get { return this.connectionString; } } public int Lifetime { get { return this.lifetime; } set { this.lifetime = value; } } public long Created { get { return this.created; } set { this.created = value; } } public bool Pooled { get { return this.pooled; } set { this.pooled = value; } } public PgConnectionParams Options { get { return this.options; } } public ArrayList PreparedCommands { get { if (this.preparedCommands == null) { this.preparedCommands = new ArrayList(); } return this.preparedCommands; } } public bool HasActiveTransaction { get { return (this.activeTransaction != null && !this.activeTransaction.IsUpdated); } } public PgConnection OwningConnection { set { this.owningConnection = value; } } #endregion #region · Constructors · public PgConnectionInternal(string connectionString) { this.options = new PgConnectionParams(); this.connectionString = connectionString; this.lifetime = 0; this.created = 0; this.pooled = true; this.database = new PgDbClient(); this.owningConnection = owningConnection; if (connectionString != null) { this.ParseConnectionString(connectionString); } } #endregion #region · Methods · public void Connect() { try { this.database.SslConnection = new SslConnectionCallback(OnSslConnection); this.database.Settings = this.Options; this.database.Connect(); } catch (PgClientException ex) { throw new PgException(ex.Message, ex); } } public void Disconnect() { try { this.database.Disconnect(); } catch (PgClientException ex) { throw new PgException(ex.Message, ex); } } public PgTransaction BeginTransaction(IsolationLevel level) { if (this.activeTransaction != null && !this.activeTransaction.IsUpdated) { throw new InvalidOperationException("A transaction is currently active. Parallel transactions are not supported."); } try { this.activeTransaction = new PgTransaction(this.owningConnection, level); this.activeTransaction.InternalBeginTransaction(); } catch (PgClientException ex) { throw new PgException(ex.Message, ex); } return this.activeTransaction; } public DataTable GetSchema(string collectionName, string[] restrictions) { PgDbSchema dbSchema = PgDbSchemaFactory.GetSchema(collectionName); if (dbSchema == null) { throw new NotSupportedException("Specified schema type is not supported."); } if (restrictions != null) { if (restrictions.Length > dbSchema.RestrictionColumns.Count) { throw new InvalidOperationException("The number of specified restrictions is not valid."); } } return dbSchema.GetSchema(this.owningConnection, restrictions); } public void DisposeActiveTransaction() { // Rollback active transation if (this.HasActiveTransaction) { this.activeTransaction.Dispose(); this.activeTransaction = null; } } public void ClosePreparedCommands() { if (this.PreparedCommands.Count > 0) { PgCommand[] commands = new PgCommand[this.PreparedCommands.Count]; this.PreparedCommands.CopyTo(0, commands, 0, commands.Length); foreach (PgCommand command in commands) { command.InternalClose(); } this.preparedCommands.Clear(); this.preparedCommands = null; } } public void AddPreparedCommand(PgCommand command) { if (!this.PreparedCommands.Contains(command)) { this.PreparedCommands.Add(command); } } public void RemovePreparedCommand(PgCommand command) { if (this.PreparedCommands.Contains(command)) { this.PreparedCommands.Remove(command); } } #endregion #region · Internal Methods · internal bool Verify() { bool isValid = true; try { // Try to send a Sync message to the PostgreSQL Server this.database.Sync(); } catch (Exception) { isValid = false; } return isValid; } #endregion #region · Private Methods · private void ParseConnectionString(string connectionStirng) { Regex search = new Regex(@"([\w\s\d]*)\s*=\s*([^;]*)"); MatchCollection elements = search.Matches(connectionString); foreach (Match element in elements) { if (element.Groups[2].Value.Trim().Length > 0) { switch (element.Groups[1].Value.Trim().ToLower()) { case "datasource": case "server": case "host": this.options.ServerName = element.Groups[2].Value.Trim(); break; case "database": this.options.Database = element.Groups[2].Value.Trim(); break; case "user name": case "user": this.options.UserName = element.Groups[2].Value.Trim(); break; case "user password": case "password": this.options.UserPassword = element.Groups[2].Value.Trim(); break; case "port": this.options.ServerPort = Int32.Parse(element.Groups[2].Value.Trim()); break; case "connection lifetime": this.lifetime = Int32.Parse(element.Groups[2].Value.Trim()); break; case "timeout": case "connection timeout": this.options.Timeout = Int32.Parse(element.Groups[2].Value.Trim()); break; case "packet size": this.options.PacketSize = Int32.Parse(element.Groups[2].Value.Trim()); break; case "pooling": this.options.Pooling = Boolean.Parse(element.Groups[2].Value.Trim()); break; case "ssl": this.options.SSL = Boolean.Parse(element.Groups[2].Value.Trim()); break; } } } if (options.UserName == String.Empty || options.ServerName == String.Empty || options.ServerPort == 0) { throw new ArgumentException("An invalid connection string argument has been supplied or a required connection string argument has not been supplied."); } else { if (options.PacketSize < 512 || options.PacketSize > 32767) { StringBuilder msg = new StringBuilder(); msg.AppendFormat("'Packet Size' value of {0} is not valid.\r\nThe value should be an integer >= 512 and <= 32767.", options.PacketSize); throw new ArgumentException(msg.ToString()); } } } #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 } } --- NEW FILE: PgDbType.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PostgreSqlClient { [Serializable] public enum PgDbType { Array , Binary , Boolean , Box , Byte , Char , Circle , Currency , Date , Decimal , Double , Float , Int2 , Int4 , Int8 , Interval , Line , LSeg , Numeric , Path , Point , Polygon , Text , Time , TimeWithTZ , Timestamp , TimestampWithTZ , VarChar , Vector } } --- NEW FILE: PgDataReader.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; using System.Collections; using System.Data; using System.Data.Common; using System.Globalization; using System.Reflection; using System.ComponentModel; using PostgreSql.Data.Protocol; using PostgreSql.Data.DbSchema; using PostgreSql.Data.PgTypes; namespace PostgreSql.Data.PostgreSqlClient { public sealed class PgDataReader : MarshalByRefObject, IEnumerable, IDataReader, IDisposable, IDataRecord { #region · Fields · private const int STARTPOS = -1; private bool disposed; private bool open; private int position; private int recordsAffected; private int fieldCount; private DataTable schemaTable; private CommandBehavior behavior; private PgCommand command; private PgConnection connection; private object[] row; #endregion #region · Constructors · private PgDataReader() { this.open = true; this.position = STARTPOS; this.recordsAffected = -1; this.fieldCount = -1; } internal PgDataReader(PgCommand command, PgConnection connection) : this() { this.command = command; this.behavior = this.command.CommandBehavior; this.connection = connection; this.fieldCount = this.command.Statement.RowDescriptor.Fields.Length; } #endregion #region · Finalizer · ~PgDataReader() { this.Dispose(false); } #endregion #region · IDisposable Methods · void IDisposable.Dispose() { this.Dispose(true); System.GC.SuppressFinalize(this); } private void Dispose(bool disposing) { if (!this.disposed) { try { if (disposing) { // release any managed resources this.Close(); this.command = null; this.connection = null; this.row = null; this.schemaTable= null; } // release any unmanaged resources } finally { } this.disposed = true; } } #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) { return; } // This will update RecordsAffected property this.UpdateRecordsAffected(); if (this.command != null && !this.command.IsDisposed) { if (this.command.Statement != null) { // Set values of output parameters this.command.InternalSetOutputParameters(); } this.command.ActiveDataReader = null; } if (this.connection != null) { if ((this.behavior & CommandBehavior.CloseConnection) == CommandBehavior.CloseConnection) { this.connection.Close(); } } this.open = false; this.position = STARTPOS; } public bool NextResult() { return false; } public bool Read() { bool read = false; if ((this.behavior == CommandBehavior.SingleRow && this.position != STARTPOS) || !this.command.Statement.HasRows) { } else { try { this.fieldCount = this.command.Statement.RowDescriptor.Fields.Length; this.position++; row = this.command.Statement.FetchRow(); read = (this.row == null) ? false : true; } catch (PgClientException ex) { throw new PgException(ex.Message, ex); } } return read; } #endregion #region GetSchemaTable Method public DataTable GetSchemaTable() { if (schemaTable == null) { schemaTable = this.GetSchemaTableStructure(); schemaTable.BeginLoadData(); PgCommand cInfoCmd = this.GetColumnInfoCmd(); PgCommand pKeyCmd = this.GetPrimaryKeyInfoCmd(); for (int i = 0; i < command.Statement.RowDescriptor.Fields.Length; i++) { object[] columnInfo = null; System.Array pKeyInfo = null; // Execute commands cInfoCmd.Parameters[0].Value = command.Statement.RowDescriptor.Fields[i].OidNumber; cInfoCmd.Parameters[1].Value = command.Statement.RowDescriptor.Fields[i].OidTable; pKeyCmd.Parameters[0].Value = command.Statement.RowDescriptor.Fields[i].OidTable; cInfoCmd.InternalPrepare(); pKeyCmd.InternalPrepare(); cInfoCmd.InternalExecute(); pKeyCmd.InternalExecute(); // Get Column Information if (cInfoCmd.Statement.Rows != null && cInfoCmd.Statement.Rows.Length > 0) { columnInfo = (object[])cInfoCmd.Statement.Rows[0]; } // Get Primary Key Info if (pKeyCmd.Statement.Rows != null && pKeyCmd.Statement.Rows.Length > 0) { object[] temp = (object[])pKeyCmd.Statement.Rows[0]; pKeyInfo = (System.Array)temp[3]; } // Add row information DataRow schemaRow = schemaTable.NewRow(); schemaRow["ColumnName"] = this.GetName(i); schemaRow["ColumnOrdinal"] = i; schemaRow["ColumnSize"] = this.GetSize(i); if (this.IsNumeric(i)) { schemaRow["NumericPrecision"] = this.GetNumericPrecision(i); schemaRow["NumericScale"] = this.GetNumericScale(i); } else { schemaRow["NumericPrecision"] = DBNull.Value; schemaRow["NumericScale"] = DBNull.Value; } schemaRow["DataType"] = this.GetFieldType(i); schemaRow["ProviderType"] = this.GetProviderType(i); schemaRow["IsLong"] = this.IsLong(i); schemaRow["IsRowVersion"] = false; schemaRow["IsUnique"] = false; schemaRow["IsAliased"] = this.IsAliased(i); schemaRow["IsExpression"] = this.IsExpression(i); ... [truncated message content] |