CloneSet558


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
87260.962compilation_unit
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
1871
src/NHibernate/Driver/MySqlDataDriver.cs
2731
src/NHibernate/Driver/NpgsqlDriver.cs
Clone Instance
1
Line Count
87
Source Line
1
Source File
src/NHibernate/Driver/MySqlDataDriver.cs

using System;

namespace NHibernate.Driver
{
        /// <summary>
        /// Provides a database driver for MySQL.
        /// </summary>
        /// <remarks>
        /// <para>
        /// In order to use this driver you must have the assembly <c>MySql.Data.dll</c> available for 
        /// NHibernate to load, including its dependencies (<c>ICSharpCode.SharpZipLib.dll</c> is required by
        /// the assembly <c>MySql.Data.dll</c> as of the time of this writing).
        /// </para>
        /// <para>
        /// Please check the product's <see href="http://www.mysql.com/products/connector/net/">website</see>
        /// for any updates and/or documentation regarding MySQL.
        /// </para>
        /// </remarks>
        public class MySqlDataDriver : ReflectionBasedDriver
        {
                /// <summary>
                /// Initializes a new instance of the <see cref="MySqlDataDriver"/> class.
                /// </summary>
                /// <exception cref="HibernateException">
                /// Thrown when the <c>MySql.Data</c> assembly can not be loaded.
                /// </exception>
                public MySqlDataDriver() : base(
                        "MySql.Data",
                        "MySql.Data.MySqlClient.MySqlConnection",
                        "MySql.Data.MySqlClient.MySqlCommand")
                {
                }

                /// <summary>
                /// MySql.Data uses named parameters in the sql.
                /// </summary>
                /// <value><see langword="true" /> - MySql uses <c>?</c> in the sql.</value>
                public override bool UseNamedPrefixInSql
                {
                        get { return true;
                            }
                }

                /// <summary></summary>
                public override bool UseNamedPrefixInParameter
                {
                        get { return true;
                            }
                }

                /// <summary>
                /// MySql.Data use the <c>?</c> to locate parameters in sql.
                /// </summary>
                /// <value><c>?</c> is used to locate parameters in sql.</value>
                public override string NamedPrefix
                {
                        get { return "?";
                            }
                }

                /// <summary>
                /// The MySql.Data driver does NOT support more than 1 open IDataReader
                /// with only 1 IDbConnection.
                /// </summary>
                /// <value><see langword="false" /> - it is not supported.</value>
                public override bool SupportsMultipleOpenReaders
                {
                        get { return false;
                            }
                }

                /// <summary>
                /// MySql.Data does not support preparing of commands.
                /// </summary>
                /// <value><see langword="false" /> - it is not supported.</value>
                /// <remarks>
                /// With the Gamma MySql.Data provider it is throwing an exception with the 
                /// message "Expected End of data packet" when a select command is prepared.
                /// </remarks>
                protected override bool SupportsPreparingCommands
                {
                        get { return false;
                            }
                }

                public override bool SupportsMultipleQueries
                {
                        get { return true;
                            }
                }

        }
}


Clone Instance
2
Line Count
73
Source Line
1
Source File
src/NHibernate/Driver/NpgsqlDriver.cs

namespace NHibernate.Driver
{
        /// <summary>
        /// The PostgreSQL data provider provides a database driver for PostgreSQL.
        /// <p>
        /// Author: <a href="mailto:oliver@weichhold.com">Oliver Weichhold</a>
        /// </p>
        /// </summary>
        /// <remarks>
        /// <p>
        /// In order to use this Driver you must have the Npgsql.dll Assembly available for 
        /// NHibernate to load it.
        /// </p>
        /// <p>
        /// Please check the products website 
        /// <a href="http://www.postgresql.org/">http://www.postgresql.org/</a>
        /// for any updates and or documentation.
        /// </p>
        /// <p>
        /// The homepage for the .NET DataProvider is: 
    /// <a href="http://pgfoundry.org/projects/npgsql">http://pgfoundry.org/projects/npgsql</a>. 
        /// </p>
        /// </remarks>
        public class NpgsqlDriver : ReflectionBasedDriver
        {
                /// <summary>
                /// Initializes a new instance of the <see cref="NpgsqlDriver"/> class.
                /// </summary>
                /// <exception cref="HibernateException">
                /// Thrown when the <c>Npgsql</c> assembly can not be loaded.
                /// </exception>
                public NpgsqlDriver() : base(
                        "Npgsql",
                        "Npgsql.NpgsqlConnection",
                        "Npgsql.NpgsqlCommand")
                {
                }

                public override bool UseNamedPrefixInSql
                {
                        get { return true;
                            }
                }

                public override bool UseNamedPrefixInParameter
                {
                        get { return true;
                            }
                }

                public override string NamedPrefix
                {
                        get { return ":";
                            }
                }

                public override bool SupportsMultipleOpenReaders
                {
                        get { return false;
                            }
                }

                protected override bool SupportsPreparingCommands
                {
                        // NOTE: Npgsql1.0 and 2.0-preview apparently doesn't correctly  support prepared commands.
                        // The following exception is thrown on insert statements:
                        // Npgsql.NpgsqlException : ERROR: 42601: cannot insert multiple commands into a prepared statement
                        get { return false;
                            }
                }

                public override bool SupportsMultipleQueries
                {
                        get { return true;
                            }
                }

        }
}


Clone AbstractionParameter Count: 6Parameter Bindings

 [[#variable70bb4280]]
namespace NHibernate.Driver
{
   /// <summary>
   /// Provides a database driver for MySQL.
   /// The PostgreSQL data provider provides a database driver for PostgreSQL.
   /// <p>
   /// Author: <a href="mailto:oliver@weichhold.com">Oliver Weichhold</a>
   /// </p>
   /// </summary>
   /// <remarks>
   /// <para>
   /// In order to use this driver you must have the assembly <c>MySql.Data.dll</c> available for 
   /// NHibernate to load, including its dependencies (<c>ICSharpCode.SharpZipLib.dll</c> is required by
   /// the assembly <c>MySql.Data.dll</c> as of the time of this writing).
   /// </para>
   /// <para>
   /// Please check the product's <see href="http://www.mysql.com/products/connector/net/">website</see>
   /// for any updates and/or documentation regarding MySQL.
   /// </para>
   /// <p>
   /// In order to use this Driver you must have the Npgsql.dll Assembly available for 
   /// NHibernate to load it.
   /// </p>
   /// <p>
   /// Please check the products website 
   /// <a href="http://www.postgresql.org/">http://www.postgresql.org/</a>
   /// for any updates and or documentation.
   /// </p>
   /// <p>
   /// The homepage for the .NET DataProvider is: 
   /// <a href="http://pgfoundry.org/projects/npgsql">http://pgfoundry.org/projects/npgsql</a>. 
   /// </p>
   /// </remarks>
   public class [[#variable70bb41a0]]: ReflectionBasedDriver
   {
      /// <summary>
      /// Initializes a new instance of the <see cref="MySqlDataDriver"/> class.
      /// Initializes a new instance of the <see cref="NpgsqlDriver"/> class.
      /// </summary>
      /// <exception cref="HibernateException">
      /// Thrown when the <c>MySql.Data</c> assembly can not be loaded.
      /// Thrown when the <c>Npgsql</c> assembly can not be loaded.
      /// </exception>
      public [[#variable70bb41a0]](): base( [[#variable70bb41c0]], [[#variable70bb4160]], [[#variable70bb40e0]])
      {
      }

      /// <summary>
      /// MySql.Data uses named parameters in the sql.
      /// </summary>
      /// <value><see langword="true" /> - MySql uses <c>?</c> in the sql.</value>
      public override bool UseNamedPrefixInSql
      {
         get
         {
            return true;
         }
      }

      /// <summary></summary>
      public override bool UseNamedPrefixInParameter
      {
         get
         {
            return true;
         }
      }

      /// <summary>
      /// MySql.Data use the <c>?</c> to locate parameters in sql.
      /// </summary>
      /// <value><c>?</c> is used to locate parameters in sql.</value>
      public override string NamedPrefix
      {
         get
         {
            return [[#variable70bb40c0]];
         }
      }

      /// <summary>
      /// The MySql.Data driver does NOT support more than 1 open IDataReader
      /// with only 1 IDbConnection.
      /// </summary>
      /// <value><see langword="false" /> - it is not supported.</value>
      public override bool SupportsMultipleOpenReaders
      {
         get
         {
            return false;
         }
      }

      /// <summary>
      /// MySql.Data does not support preparing of commands.
      /// </summary>
      /// <value><see langword="false" /> - it is not supported.</value>
      /// <remarks>
      /// With the Gamma MySql.Data provider it is throwing an exception with the 
      /// message "Expected End of data packet" when a select command is prepared.
      /// </remarks>
      protected override bool SupportsPreparingCommands
      {
         // NOTE: Npgsql1.0 and 2.0-preview apparently doesn't correctly  support prepared commands.
         // The following exception is thrown on insert statements:
         // Npgsql.NpgsqlException : ERROR: 42601: cannot insert multiple commands into a prepared statement
         get
         {
            return false;
         }
      }

      public override bool SupportsMultipleQueries
      {
         get
         {
            return true;
         }
      }

   }
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#70bb4280]]
using System; 
12[[#70bb4280]]
21[[#70bb41a0]]
MySqlDataDriver 
22[[#70bb41a0]]
NpgsqlDriver 
31[[#70bb41c0]]
"MySql.Data" 
32[[#70bb41c0]]
"Npgsql" 
41[[#70bb4160]]
"MySql.Data.MySqlClient.MySqlConnection" 
42[[#70bb4160]]
"Npgsql.NpgsqlConnection" 
51[[#70bb40e0]]
"MySql.Data.MySqlClient.MySqlCommand" 
52[[#70bb40e0]]
"Npgsql.NpgsqlCommand" 
61[[#70bb40c0]]
"?" 
62[[#70bb40c0]]
":"