Exemple #1
0
        public MySqlCollationSchemaCollection GetCollations(MySqlCharacterSetSchema characterSet)
        {
            MySqlCollationSchemaCollection collations = new MySqlCollationSchemaCollection();

            using (IPooledDbConnection conn = connectionPool.Request()) {
                using (IDbCommand command = conn.CreateCommand(String.Format("SHOW COLLATION LIKE '{0}%';",
                                                                             characterSet.Name))) {
                    try {
                        using (IDataReader r = command.ExecuteReader()) {
                            while (r.Read())
                            {
                                MySqlCollationSchema collation = new MySqlCollationSchema(this);
                                collation.Name             = r.GetString(0);
                                collation.CharacterSetName = r.GetString(1);
                                collation.Id = r.GetInt32(2);
                                collation.IsDefaultCollation = r.GetString(3) == "Yes" ? true : false;
                                collation.IsCompiled         = r.GetString(4) == "Yes" ? true : false;
                                collation.SortLength         = r.GetInt32(5);
                                collations.Add(collation);
                            }
                            r.Close();
                        }
                    } catch (Exception e) {
                        QueryService.RaiseException(e);
                    } finally {
                        conn.Release();
                    }
                }
            }
            return(collations);
        }
Exemple #2
0
        public MySqlCollationSchemaCollection GetCollations()
        {
            MySqlCharacterSetSchema sch = new MySqlCharacterSetSchema(this);

            sch.Name = "";
            return(GetCollations(sch));
        }
Exemple #3
0
        //http://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html
        public MySqlCharacterSetSchemaCollection GetCharacterSets()
        {
            MySqlCharacterSetSchemaCollection characterSets = new MySqlCharacterSetSchemaCollection();

            using (IPooledDbConnection conn = connectionPool.Request()) {
                using (IDbCommand command = conn.CreateCommand("SHOW CHARACTER SET;")) {
                    try {
                        using (IDataReader r = command.ExecuteReader()) {
                            while (r.Read())
                            {
                                MySqlCharacterSetSchema charset = new MySqlCharacterSetSchema(this);
                                charset.Name    = r.GetString(0);
                                charset.Comment = r.GetString(1);
                                charset.DefaultCollactionName = r.GetString(2);
                                charset.MaxLength             = r.GetInt32(3);
                                characterSets.Add(charset);
                            }
                            r.Close();
                        }
                    } catch (Exception e) {
                        QueryService.RaiseException(e);
                    } finally {
                        conn.Release();
                    }
                }
            }
            return(characterSets);
        }
		public MySqlCharacterSetSchema (MySqlCharacterSetSchema schema)
			: base (schema)
		{
			defaultCollactionName = schema.defaultCollactionName;
			defaultCollactionName = schema.defaultCollactionName;
		}
		public MySqlCollationSchemaCollection GetCollations (MySqlCharacterSetSchema characterSet)
		{
			MySqlCollationSchemaCollection collations = new MySqlCollationSchemaCollection ();

			using (IPooledDbConnection conn = connectionPool.Request ()) {
				using (IDbCommand command = conn.CreateCommand (String.Format ("SHOW COLLATION LIKE '{0}%';", 
																				characterSet.Name))) {
					
					try {
						using (IDataReader r = command.ExecuteReader ()) {
							while (r.Read ()) {
								MySqlCollationSchema collation = new MySqlCollationSchema (this);
								collation.Name = r.GetString (0);
								collation.CharacterSetName = r.GetString (1);
								collation.Id = r.GetInt32 (2);
								collation.IsDefaultCollation = r.GetString (3) == "Yes" ? true : false;
								collation.IsCompiled = r.GetString (4) == "Yes" ? true : false;
								collation.SortLength = r.GetInt32 (5);
								collations.Add (collation);
							}
							r.Close ();
						}
					} catch (Exception e) {
						QueryService.RaiseException (e);
					} finally {
						conn.Release ();
					}					
				}
			}
			return collations;
		}
		public MySqlCollationSchemaCollection GetCollations ()
		{
			MySqlCharacterSetSchema sch = new MySqlCharacterSetSchema (this);
			sch.Name = "";
			return GetCollations (sch);
		}
		//http://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html
		public MySqlCharacterSetSchemaCollection GetCharacterSets ()
		{
			MySqlCharacterSetSchemaCollection characterSets = new MySqlCharacterSetSchemaCollection ();

			using (IPooledDbConnection conn = connectionPool.Request ()) {
				using (IDbCommand command = conn.CreateCommand ("SHOW CHARACTER SET;")) {
					try {
						using (IDataReader r = command.ExecuteReader ()) {
							while (r.Read ()) {
								MySqlCharacterSetSchema charset = new MySqlCharacterSetSchema (this);
								charset.Name = r.GetString (0);
								charset.Comment = r.GetString (1);
								charset.DefaultCollactionName = r.GetString (2);
								charset.MaxLength = r.GetInt32 (3);
								characterSets.Add (charset);
							}
							r.Close ();
						}
					} catch (Exception e) {
						QueryService.RaiseException (e);
					} finally {
						conn.Release ();
					}
				}
			}
			return characterSets;
		}
 public MySqlCharacterSetSchema(MySqlCharacterSetSchema schema)
     : base(schema)
 {
     defaultCollactionName = schema.defaultCollactionName;
     defaultCollactionName = schema.defaultCollactionName;
 }