Beispiel #1
0
 internal static void SetDSInfo(MySqlSchemaCollection sc)
 {
     string[] array = new string[]
     {
         "INT",
         "YEAR",
         "MEDIUMINT"
     };
     MySqlDbType[] array2 = new MySqlDbType[]
     {
         MySqlDbType.Int32,
         MySqlDbType.Year,
         MySqlDbType.Int24
     };
     for (int i = 0; i < array.Length; i++)
     {
         MySqlSchemaRow expr_3E = sc.AddRow();
         expr_3E["TypeName"]              = array[i];
         expr_3E["ProviderDbType"]        = array2[i];
         expr_3E["ColumnSize"]            = 0;
         expr_3E["CreateFormat"]          = array[i];
         expr_3E["CreateParameters"]      = null;
         expr_3E["DataType"]              = "System.Int32";
         expr_3E["IsAutoincrementable"]   = (array2[i] != MySqlDbType.Year);
         expr_3E["IsBestMatch"]           = true;
         expr_3E["IsCaseSensitive"]       = false;
         expr_3E["IsFixedLength"]         = true;
         expr_3E["IsFixedPrecisionScale"] = true;
         expr_3E["IsLong"]               = false;
         expr_3E["IsNullable"]           = true;
         expr_3E["IsSearchable"]         = true;
         expr_3E["IsSearchableWithLike"] = false;
         expr_3E["IsUnsigned"]           = false;
         expr_3E["MaximumScale"]         = 0;
         expr_3E["MinimumScale"]         = 0;
         expr_3E["IsConcurrencyType"]    = DBNull.Value;
         expr_3E["IsLiteralSupported"]   = false;
         expr_3E["LiteralPrefix"]        = null;
         expr_3E["LiteralSuffix"]        = null;
         expr_3E["NativeDataType"]       = null;
     }
 }
Beispiel #2
0
 internal static void SetDSInfo(MySqlSchemaCollection sc)
 {
     string[] array = new string[]
     {
         "DATE",
         "DATETIME",
         "TIMESTAMP"
     };
     MySqlDbType[] array2 = new MySqlDbType[]
     {
         MySqlDbType.Date,
         MySqlDbType.DateTime,
         MySqlDbType.Timestamp
     };
     for (int i = 0; i < array.Length; i++)
     {
         MySqlSchemaRow mySqlSchemaRow = sc.AddRow();
         mySqlSchemaRow["TypeName"]              = array[i];
         mySqlSchemaRow["ProviderDbType"]        = array2[i];
         mySqlSchemaRow["ColumnSize"]            = 0;
         mySqlSchemaRow["CreateFormat"]          = array[i];
         mySqlSchemaRow["CreateParameters"]      = null;
         mySqlSchemaRow["DataType"]              = "System.DateTime";
         mySqlSchemaRow["IsAutoincrementable"]   = false;
         mySqlSchemaRow["IsBestMatch"]           = true;
         mySqlSchemaRow["IsCaseSensitive"]       = false;
         mySqlSchemaRow["IsFixedLength"]         = true;
         mySqlSchemaRow["IsFixedPrecisionScale"] = true;
         mySqlSchemaRow["IsLong"]               = false;
         mySqlSchemaRow["IsNullable"]           = true;
         mySqlSchemaRow["IsSearchable"]         = true;
         mySqlSchemaRow["IsSearchableWithLike"] = false;
         mySqlSchemaRow["IsUnsigned"]           = false;
         mySqlSchemaRow["MaximumScale"]         = 0;
         mySqlSchemaRow["MinimumScale"]         = 0;
         mySqlSchemaRow["IsConcurrencyType"]    = DBNull.Value;
         mySqlSchemaRow["IsLiteralSupported"]   = false;
         mySqlSchemaRow["LiteralPrefix"]        = null;
         mySqlSchemaRow["LiteralSuffix"]        = null;
         mySqlSchemaRow["NativeDataType"]       = null;
     }
 }
        public static void SetDSInfo(MySqlSchemaCollection sc)
        {
            string[]      types  = new string[] { "BLOB", "TINYBLOB", "MEDIUMBLOB", "LONGBLOB", "BINARY", "VARBINARY" };
            MySqlDbType[] dbtype = new MySqlDbType[] { MySqlDbType.Blob,
                                                       MySqlDbType.TinyBlob, MySqlDbType.MediumBlob, MySqlDbType.LongBlob, MySqlDbType.Binary, MySqlDbType.VarBinary };
            long[]   sizes  = new long[] { 65535L, 255L, 16777215L, 4294967295L, 255L, 65535L };
            string[] format = new string[] { null, null, null, null, "binary({0})", "varbinary({0})" };
            string[] parms  = new string[] { null, null, null, null, "length", "length" };

            // we use name indexing because this method will only be called
            // when GetSchema is called for the DataSourceInformation
            // collection and then it wil be cached.
            for (int x = 0; x < types.Length; x++)
            {
                MySqlSchemaRow row = sc.AddRow();
                row["TypeName"]              = types[x];
                row["ProviderDbType"]        = dbtype[x];
                row["ColumnSize"]            = sizes[x];
                row["CreateFormat"]          = format[x];
                row["CreateParameters"]      = parms[x];
                row["DataType"]              = "System.Byte[]";
                row["IsAutoincrementable"]   = false;
                row["IsBestMatch"]           = true;
                row["IsCaseSensitive"]       = false;
                row["IsFixedLength"]         = x < 4 ? false : true;
                row["IsFixedPrecisionScale"] = false;
                row["IsLong"]               = sizes[x] > 255;
                row["IsNullable"]           = true;
                row["IsSearchable"]         = false;
                row["IsSearchableWithLike"] = false;
                row["IsUnsigned"]           = DBNull.Value;
                row["MaximumScale"]         = DBNull.Value;
                row["MinimumScale"]         = DBNull.Value;
                row["IsConcurrencyType"]    = DBNull.Value;
                row["IsLiteralSupported"]   = false;
                row["LiteralPrefix"]        = "0x";
                row["LiteralSuffix"]        = DBNull.Value;
                row["NativeDataType"]       = DBNull.Value;
            }
        }
Beispiel #4
0
        internal static void SetDSInfo(MySqlSchemaCollection sc)
        {
            string[] types = new string[] { "CHAR", "NCHAR", "VARCHAR", "NVARCHAR", "SET",
                                            "ENUM", "TINYTEXT", "TEXT", "MEDIUMTEXT", "LONGTEXT" };
            MySqlDbType[] dbtype = new MySqlDbType[] { MySqlDbType.String, MySqlDbType.String,
                                                       MySqlDbType.VarChar, MySqlDbType.VarChar, MySqlDbType.Set, MySqlDbType.Enum,
                                                       MySqlDbType.TinyText, MySqlDbType.Text, MySqlDbType.MediumText,
                                                       MySqlDbType.LongText };

            // we use name indexing because this method will only be called
            // when GetSchema is called for the DataSourceInformation
            // collection and then it wil be cached.
            for (int x = 0; x < types.Length; x++)
            {
                MySqlSchemaRow row = sc.AddRow();
                row["TypeName"]              = types[x];
                row["ProviderDbType"]        = dbtype[x];
                row["ColumnSize"]            = 0;
                row["CreateFormat"]          = x < 4 ? types[x] + "({0})" : types[x];
                row["CreateParameters"]      = x < 4 ? "size" : null;
                row["DataType"]              = "System.String";
                row["IsAutoincrementable"]   = false;
                row["IsBestMatch"]           = true;
                row["IsCaseSensitive"]       = false;
                row["IsFixedLength"]         = false;
                row["IsFixedPrecisionScale"] = true;
                row["IsLong"]               = false;
                row["IsNullable"]           = true;
                row["IsSearchable"]         = true;
                row["IsSearchableWithLike"] = true;
                row["IsUnsigned"]           = false;
                row["MaximumScale"]         = 0;
                row["MinimumScale"]         = 0;
                row["IsConcurrencyType"]    = DBNull.Value;
                row["IsLiteralSupported"]   = false;
                row["LiteralPrefix"]        = null;
                row["LiteralSuffix"]        = null;
                row["NativeDataType"]       = null;
            }
        }
Beispiel #5
0
        internal static void SetDSInfo(MySqlSchemaCollection sc)
        {
            string[]      types  = new string[] { "MEDIUMINT", "INT" };
            MySqlDbType[] dbtype = new MySqlDbType[] { MySqlDbType.UInt24,
                                                       MySqlDbType.UInt32 };

            // we use name indexing because this method will only be called
            // when GetSchema is called for the DataSourceInformation
            // collection and then it wil be cached.
            for (int x = 0; x < types.Length; x++)
            {
                MySqlSchemaRow row = sc.AddRow();
                row["TypeName"]              = types[x];
                row["ProviderDbType"]        = dbtype[x];
                row["ColumnSize"]            = 0;
                row["CreateFormat"]          = types[x] + " UNSIGNED";
                row["CreateParameters"]      = null;
                row["DataType"]              = "System.UInt32";
                row["IsAutoincrementable"]   = true;
                row["IsBestMatch"]           = true;
                row["IsCaseSensitive"]       = false;
                row["IsFixedLength"]         = true;
                row["IsFixedPrecisionScale"] = true;
                row["IsLong"]               = false;
                row["IsNullable"]           = true;
                row["IsSearchable"]         = true;
                row["IsSearchableWithLike"] = false;
                row["IsUnsigned"]           = true;
                row["MaximumScale"]         = 0;
                row["MinimumScale"]         = 0;
                row["IsConcurrencyType"]    = DBNull.Value;
                row["IsLiteralSupported"]   = false;
                row["LiteralPrefix"]        = null;
                row["LiteralSuffix"]        = null;
                row["NativeDataType"]       = null;
            }
        }
Beispiel #6
0
 public static void SetDSInfo(MySqlSchemaCollection sc)
 {
     string[] array = new string[]
     {
         "BLOB",
         "TINYBLOB",
         "MEDIUMBLOB",
         "LONGBLOB",
         "BINARY",
         "VARBINARY"
     };
     MySqlDbType[] array2 = new MySqlDbType[]
     {
         MySqlDbType.Blob,
         MySqlDbType.TinyBlob,
         MySqlDbType.MediumBlob,
         MySqlDbType.LongBlob,
         MySqlDbType.Binary,
         MySqlDbType.VarBinary
     };
     long[] array3 = new long[]
     {
         65535L,
         255L,
         16777215L,
         4294967295L,
         255L,
         65535L
     };
     string[] array4 = new string[]
     {
         null,
         null,
         null,
         null,
         "binary({0})",
         "varbinary({0})"
     };
     string[] array5 = new string[]
     {
         null,
         null,
         null,
         null,
         "length",
         "length"
     };
     for (int i = 0; i < array.Length; i++)
     {
         MySqlSchemaRow mySqlSchemaRow = sc.AddRow();
         mySqlSchemaRow["TypeName"]              = array[i];
         mySqlSchemaRow["ProviderDbType"]        = array2[i];
         mySqlSchemaRow["ColumnSize"]            = array3[i];
         mySqlSchemaRow["CreateFormat"]          = array4[i];
         mySqlSchemaRow["CreateParameters"]      = array5[i];
         mySqlSchemaRow["DataType"]              = "System.Byte[]";
         mySqlSchemaRow["IsAutoincrementable"]   = false;
         mySqlSchemaRow["IsBestMatch"]           = true;
         mySqlSchemaRow["IsCaseSensitive"]       = false;
         mySqlSchemaRow["IsFixedLength"]         = (i >= 4);
         mySqlSchemaRow["IsFixedPrecisionScale"] = false;
         mySqlSchemaRow["IsLong"]               = (array3[i] > 255L);
         mySqlSchemaRow["IsNullable"]           = true;
         mySqlSchemaRow["IsSearchable"]         = false;
         mySqlSchemaRow["IsSearchableWithLike"] = false;
         mySqlSchemaRow["IsUnsigned"]           = DBNull.Value;
         mySqlSchemaRow["MaximumScale"]         = DBNull.Value;
         mySqlSchemaRow["MinimumScale"]         = DBNull.Value;
         mySqlSchemaRow["IsConcurrencyType"]    = DBNull.Value;
         mySqlSchemaRow["IsLiteralSupported"]   = false;
         mySqlSchemaRow["LiteralPrefix"]        = "0x";
         mySqlSchemaRow["LiteralSuffix"]        = DBNull.Value;
         mySqlSchemaRow["NativeDataType"]       = DBNull.Value;
     }
 }
        public void SingleProcedureParameters()
        {
            if (st.Version < new Version(5, 0))
            {
                return;
            }

            st.execSQL("DROP PROCEDURE IF EXISTS spTest");
            st.execSQL("CREATE PROCEDURE spTest(id int, IN id2 INT(11), " +
                       "INOUT io1 VARCHAR(20), OUT out1 FLOAT) BEGIN END");
            string[] restrictions = new string[4];
            restrictions[1] = st.database0;
            restrictions[2] = "spTest";
#if RT
            MySqlSchemaCollection procs = st.conn.GetSchemaCollection("PROCEDURES", restrictions);
#else
            DataTable procs = st.conn.GetSchema("PROCEDURES", restrictions);
#endif
            Assert.Equal(1, procs.Rows.Count);
            Assert.Equal("spTest", procs.Rows[0][0]);
            Assert.Equal(st.database0.ToLower(), procs.Rows[0][2].ToString().ToLower(CultureInfo.InvariantCulture));
            Assert.Equal("spTest", procs.Rows[0][3]);

#if RT
            MySqlSchemaCollection parameters = st.conn.GetSchemaCollection("PROCEDURE PARAMETERS", restrictions);
#else
            DataTable parameters = st.conn.GetSchema("PROCEDURE PARAMETERS", restrictions);
#endif
            Assert.Equal(4, parameters.Rows.Count);

#if RT
            MySqlSchemaRow row = parameters.Rows[0];
#else
            DataRow row = parameters.Rows[0];
#endif
            Assert.Equal(st.database0.ToLower(CultureInfo.InvariantCulture),
                         row["SPECIFIC_SCHEMA"].ToString().ToLower(CultureInfo.InvariantCulture));
            Assert.Equal("spTest", row["SPECIFIC_NAME"]);
            Assert.Equal(1, row["ORDINAL_POSITION"]);
            Assert.Equal("IN", row["PARAMETER_MODE"]);
            Assert.Equal("id", row["PARAMETER_NAME"]);
            Assert.Equal("INT", row["DATA_TYPE"].ToString().ToUpper(CultureInfo.InvariantCulture));

            row = parameters.Rows[1];
            Assert.Equal(st.database0.ToLower(CultureInfo.InvariantCulture), row["SPECIFIC_SCHEMA"].ToString().ToLower(CultureInfo.InvariantCulture));
            Assert.Equal("spTest", row["SPECIFIC_NAME"]);
            Assert.Equal(2, row["ORDINAL_POSITION"]);
            Assert.Equal("IN", row["PARAMETER_MODE"]);
            Assert.Equal("id2", row["PARAMETER_NAME"]);
            Assert.Equal("INT", row["DATA_TYPE"].ToString().ToUpper(CultureInfo.InvariantCulture));

            row = parameters.Rows[2];
            Assert.Equal(st.database0.ToLower(CultureInfo.InvariantCulture), row["SPECIFIC_SCHEMA"].ToString().ToLower(CultureInfo.InvariantCulture));
            Assert.Equal("spTest", row["SPECIFIC_NAME"]);
            Assert.Equal(3, row["ORDINAL_POSITION"]);
            Assert.Equal("INOUT", row["PARAMETER_MODE"]);
            Assert.Equal("io1", row["PARAMETER_NAME"]);
            Assert.Equal("VARCHAR", row["DATA_TYPE"].ToString().ToUpper(CultureInfo.InvariantCulture));

            row = parameters.Rows[3];
            Assert.Equal(st.database0.ToLower(CultureInfo.InvariantCulture), row["SPECIFIC_SCHEMA"].ToString().ToLower(CultureInfo.InvariantCulture));
            Assert.Equal("spTest", row["SPECIFIC_NAME"]);
            Assert.Equal(4, row["ORDINAL_POSITION"]);
            Assert.Equal("OUT", row["PARAMETER_MODE"]);
            Assert.Equal("out1", row["PARAMETER_NAME"]);
            Assert.Equal("FLOAT", row["DATA_TYPE"].ToString().ToUpper(CultureInfo.InvariantCulture));
        }