MySql.Data.MySqlClient.MySqlConnection.CurrentDatabase C# (CSharp) Method

CurrentDatabase() private method

private CurrentDatabase ( ) : string
return string
		internal string CurrentDatabase()
		{
			if (Database != null && Database.Length > 0)
				return Database;
			MySqlCommand cmd = new MySqlCommand("SELECT database()", this);
			return cmd.ExecuteScalar().ToString();
		}

Usage Example

Exemplo n.º 1
0
        private static ProcedureCacheEntry GetProcData(MySqlConnection connection, string spName)
        {
            string text  = string.Empty;
            string text2 = spName;
            int    num   = spName.IndexOf(".");

            if (num != -1)
            {
                text  = spName.Substring(0, num);
                text2 = spName.Substring(num + 1, spName.Length - num - 1);
            }
            string[] array = new string[4];
            array[1] = ((text.Length > 0) ? text : connection.CurrentDatabase());
            array[2] = text2;
            MySqlSchemaCollection schemaCollection = connection.GetSchemaCollection("procedures", array);

            if (schemaCollection.Rows.Count > 1)
            {
                throw new MySqlException(Resources.ProcAndFuncSameName);
            }
            if (schemaCollection.Rows.Count == 0)
            {
                throw new MySqlException(string.Format(Resources.InvalidProcName, text2, text));
            }
            ProcedureCacheEntry procedureCacheEntry = new ProcedureCacheEntry();

            procedureCacheEntry.procedure = schemaCollection;
            ISSchemaProvider iSSchemaProvider = new ISSchemaProvider(connection);

            string[] restrictions = iSSchemaProvider.CleanRestrictions(array);
            MySqlSchemaCollection procedureParameters = iSSchemaProvider.GetProcedureParameters(restrictions, schemaCollection);

            procedureCacheEntry.parameters = procedureParameters;
            return(procedureCacheEntry);
        }
All Usage Examples Of MySql.Data.MySqlClient.MySqlConnection::CurrentDatabase