From: <cin...@us...> - 2008-03-30 11:41:35
|
Revision: 545 http://firebird.svn.sourceforge.net/firebird/?rev=545&view=rev Author: cincura_net Date: 2008-03-30 04:41:40 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Code cleanup, pretty printing of schema commands. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCharacterSets.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCheckConstraints.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbChecksByTable.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCollations.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbColumnPrivileges.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbColumns.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbDomains.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbForeignKeyColumns.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbForeignKeys.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbFunctions.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbGenerators.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbIndexColumns.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbIndexes.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbPrimaryKeys.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbProcedureParameters.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbProcedurePrivileges.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbProcedures.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbRoles.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbTableConstraints.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbTablePrivileges.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbTables.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbTriggers.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbUniqueKeys.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbViewColumns.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbViewPrivileges.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbViews.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCharacterSets.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCharacterSets.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCharacterSets.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Constributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -23,30 +26,29 @@ namespace FirebirdSql.Data.Schema { - internal class FbCharacterSets : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbCharacterSets : FbSchema + { + #region \xB7 Protected Methods \xB7 - protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + protected override StringBuilder GetCommandText(string[] restrictions) + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS CHARACTER_SET_CATALOG, " + - "null AS CHARACTER_SET_SCHEMA, " + - "rdb$character_set_name AS CHARACTER_SET_NAME, " + - "rdb$character_set_id AS CHARACTER_SET_ID, " + - "rdb$default_collate_name AS DEFAULT_COLLATION," + - "rdb$bytes_per_character AS BYTES_PER_CHARACTER, " + - "rdb$description AS DESCRIPTION " + - "FROM " + - "rdb$character_sets"); + sql.Append( + @"SELECT + null AS CHARACTER_SET_CATALOG, + null AS CHARACTER_SET_SCHEMA, + rdb$character_set_name AS CHARACTER_SET_NAME, + rdb$character_set_id AS CHARACTER_SET_ID, + rdb$default_collate_name AS DEFAULT_COLLATION, + rdb$bytes_per_character AS BYTES_PER_CHARACTER, + rdb$description AS DESCRIPTION + FROM rdb$character_sets"); - if (restrictions != null) - { - int index = 0; + if (restrictions != null) + { + int index = 0; /* CHARACTER_SET_CATALOG */ if (restrictions.Length >= 1 && restrictions[0] != null) @@ -60,21 +62,21 @@ /* CHARACTER_SET_NAME */ if (restrictions.Length >= 3 && restrictions[2] != null) - { + { where.AppendFormat(CultureInfo.CurrentUICulture, "rdb$character_set_name = @p{0}", index++); } - } + } - if (where.Length > 0) - { + if (where.Length > 0) + { sql.AppendFormat(CultureInfo.CurrentUICulture, " WHERE {0} ", where.ToString()); } - sql.Append(" ORDER BY rdb$character_set_name"); + sql.Append(" ORDER BY rdb$character_set_name"); - return sql; - } + return sql; + } - #endregion - } + #endregion + } } \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCheckConstraints.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCheckConstraints.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCheckConstraints.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Constributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -23,28 +26,27 @@ namespace FirebirdSql.Data.Schema { - internal class FbCheckConstraints : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbCheckConstraints : FbSchema + { + #region \xB7 Protected Methods \xB7 - protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + protected override StringBuilder GetCommandText(string[] restrictions) + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS CONSTRAINT_CATALOG, " + - "null AS CONSTRAINT_SCHEMA, " + - "chk.rdb$constraint_name AS CONSTRAINT_NAME, " + - "trig.rdb$trigger_source AS CHECK_CLAUSULE, " + - "trig.rdb$description AS DESCRIPTION " + - "FROM RDB$CHECK_CONSTRAINTS chk " + - "inner join rdb$triggers trig ON chk.rdb$trigger_name = trig.rdb$trigger_name" - ); - - if (restrictions != null) - { + sql.Append( + @"SELECT + null AS CONSTRAINT_CATALOG, + null AS CONSTRAINT_SCHEMA, + chk.rdb$constraint_name AS CONSTRAINT_NAME, + trig.rdb$trigger_source AS CHECK_CLAUSULE, + trig.rdb$description AS DESCRIPTION + FROM rdb$check_constraints chk + INNER JOIN rdb$triggers trig ON chk.rdb$trigger_name = trig.rdb$trigger_name"); + + if (restrictions != null) + { /* CONSTRAINT_CATALOG */ if (restrictions.Length >= 1 && restrictions[0] != null) { @@ -57,21 +59,21 @@ /* CONSTRAINT_NAME */ if (restrictions.Length >= 3 && restrictions[2] != null) - { - where.Append("chk.rdb$constraint_name = @p0"); - } - } + { + where.Append("chk.rdb$constraint_name = @p0"); + } + } - if (where.Length > 0) - { + if (where.Length > 0) + { sql.AppendFormat(CultureInfo.CurrentUICulture, " WHERE {0}", where.ToString()); } - sql.Append(" ORDER BY chk.rdb$constraint_name"); + sql.Append(" ORDER BY chk.rdb$constraint_name"); - return sql; - } + return sql; + } - #endregion - } + #endregion + } } \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbChecksByTable.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbChecksByTable.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbChecksByTable.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Constributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -23,30 +26,30 @@ namespace FirebirdSql.Data.Schema { - internal class FbChecksByTable : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbChecksByTable : FbSchema + { + #region \xB7 Protected Methods \xB7 - protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + protected override StringBuilder GetCommandText(string[] restrictions) + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS CONSTRAINT_CATALOG, " + - "null AS CONSTRAINT_SCHEMA, " + - "chktb.rdb$constraint_name AS CONSTRAINT_NAME, " + - "chktb.rdb$relation_name AS TABLE_NAME, " + - "trig.rdb$trigger_source AS CHECK_CLAUSULE, " + - "trig.rdb$description AS DESCRIPTION " + - "FROM rdb$relation_constraints chktb " + - "inner join rdb$check_constraints chk ON (chktb.rdb$constraint_name = chk.rdb$constraint_name AND chktb.rdb$constraint_type = 'CHECK') " + - "inner join rdb$triggers trig ON chk.rdb$trigger_name = trig.rdb$trigger_name"); + sql.Append( + @"SELECT + null AS CONSTRAINT_CATALOG, + null AS CONSTRAINT_SCHEMA, + chktb.rdb$constraint_name AS CONSTRAINT_NAME, + chktb.rdb$relation_name AS TABLE_NAME, + trig.rdb$trigger_source AS CHECK_CLAUSULE, + trig.rdb$description AS DESCRIPTION + FROM rdb$relation_constraints chktb + INNER JOIN rdb$check_constraints chk ON (chktb.rdb$constraint_name = chk.rdb$constraint_name AND chktb.rdb$constraint_type = 'CHECK') + INNER JOIN rdb$triggers trig ON chk.rdb$trigger_name = trig.rdb$trigger_name"); - if (restrictions != null) - { - int index = 0; + if (restrictions != null) + { + int index = 0; /* CONSTRAINT_CATALOG */ if (restrictions.Length >= 1 && restrictions[0] != null) @@ -65,16 +68,16 @@ } } - if (where.Length > 0) - { + if (where.Length > 0) + { sql.AppendFormat(CultureInfo.CurrentUICulture, " WHERE {0} ", where.ToString()); } - sql.Append(" ORDER BY chktb.rdb$relation_name, chktb.rdb$constraint_name"); + sql.Append(" ORDER BY chktb.rdb$relation_name, chktb.rdb$constraint_name"); - return sql; - } + return sql; + } - #endregion - } + #endregion + } } \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCollations.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCollations.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbCollations.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Contributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -23,29 +26,28 @@ namespace FirebirdSql.Data.Schema { - internal class FbCollations : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbCollations : FbSchema + { + #region \xB7 Protected Methods \xB7 - protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + protected override StringBuilder GetCommandText(string[] restrictions) + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS COLLATION_CATALOG, " + - "null AS COLLATION_SCHEMA, " + - "coll.rdb$collation_name AS COLLATION_NAME, " + - "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " + - "coll.rdb$description AS DESCRIPTION " + - "FROM rdb$collations coll " + - "left join rdb$character_sets cs ON coll.rdb$character_set_id = cs.rdb$character_set_id" - ); + sql.Append( + @"SELECT + null AS COLLATION_CATALOG, + null AS COLLATION_SCHEMA, + coll.rdb$collation_name AS COLLATION_NAME, + cs.rdb$character_set_name AS CHARACTER_SET_NAME, + coll.rdb$description AS DESCRIPTION + FROM rdb$collations coll + LEFT JOIN rdb$character_sets cs ON coll.rdb$character_set_id = cs.rdb$character_set_id"); - if (restrictions != null) - { - int index = 0; + if (restrictions != null) + { + int index = 0; /* COLLATION_CATALOG */ if (restrictions.Length >= 1 && restrictions[0] != null) @@ -58,22 +60,22 @@ } /* COLLATION_NAME */ - if (restrictions.Length >= 3 && restrictions[2] != null) - { + if (restrictions.Length >= 3 && restrictions[2] != null) + { where.AppendFormat(CultureInfo.CurrentUICulture, "coll.rdb$collation_name = @p{0}", index++); } - } + } - if (where.Length > 0) - { + if (where.Length > 0) + { sql.AppendFormat(CultureInfo.CurrentUICulture, " WHERE {0} ", where.ToString()); } - sql.Append(" ORDER BY cs.rdb$character_set_name, coll.rdb$collation_name"); + sql.Append(" ORDER BY cs.rdb$character_set_name, coll.rdb$collation_name"); - return sql; - } + return sql; + } - #endregion - } + #endregion + } } \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbColumnPrivileges.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbColumnPrivileges.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbColumnPrivileges.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Contributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -23,33 +26,32 @@ namespace FirebirdSql.Data.Schema { - internal class FbColumnPrivileges : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbColumnPrivileges : FbSchema + { + #region \xB7 Protected Methods \xB7 - protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + protected override StringBuilder GetCommandText(string[] restrictions) + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS TABLE_CATALOG, " + - "null AS TABLE_SCHEMA, " + - "rdb$relation_name AS TABLE_NAME, " + - "rdb$field_name AS COLUMN_NAME, " + - "rdb$user AS GRANTEE, " + - "rdb$grantor AS GRANTOR, " + - "rdb$privilege AS PRIVILEGE, " + - "rdb$grant_option AS WITH_GRANT " + - "FROM " + - "rdb$user_privileges"); + sql.Append( + @"SELECT + null AS TABLE_CATALOG, + null AS TABLE_SCHEMA, + rdb$relation_name AS TABLE_NAME, + rdb$field_name AS COLUMN_NAME, + rdb$user AS GRANTEE, + rdb$grantor AS GRANTOR, + rdb$privilege AS PRIVILEGE, + rdb$grant_option AS WITH_GRANT + FROM rdb$user_privileges"); - where.Append("rdb$object_type = 0"); + where.Append("rdb$object_type = 0"); - if (restrictions != null) - { - int index = 0; + if (restrictions != null) + { + int index = 0; /* TABLE_CATALOG */ if (restrictions.Length >= 1 && restrictions[0] != null) @@ -63,13 +65,13 @@ /* TABLE_NAME */ if (restrictions.Length >= 3 && restrictions[2] != null) - { + { where.AppendFormat(CultureInfo.CurrentUICulture, " AND rdb$relation_name = @p{0}", index++); } /* COLUMN_NAME */ if (restrictions.Length >= 4 && restrictions[3] != null) - { + { where.AppendFormat(CultureInfo.CurrentUICulture, " AND rdb$field_name = @p{0}", index++); } @@ -80,22 +82,22 @@ } /* GRANTEE */ - if (restrictions.Length >= 5 && restrictions[4] != null) - { + if (restrictions.Length >= 5 && restrictions[4] != null) + { where.AppendFormat(CultureInfo.CurrentUICulture, " AND rdb$user = @p{0}", index++); } - } + } - if (where.Length > 0) - { + if (where.Length > 0) + { sql.AppendFormat(CultureInfo.CurrentUICulture, " WHERE {0} ", where.ToString()); } - sql.Append(" ORDER BY rdb$relation_name"); + sql.Append(" ORDER BY rdb$relation_name"); - return sql; - } + return sql; + } - #endregion - } + #endregion + } } \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbColumns.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbColumns.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbColumns.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -29,55 +29,54 @@ namespace FirebirdSql.Data.Schema { - internal class FbColumns : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbColumns : FbSchema + { + #region \xB7 Protected Methods \xB7 protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS TABLE_CATALOG, " + - "null AS TABLE_SCHEMA, " + - "rfr.rdb$relation_name AS TABLE_NAME, " + - "rfr.rdb$field_name AS COLUMN_NAME, " + - "null AS COLUMN_DATA_TYPE, " + - "fld.rdb$field_sub_type AS COLUMN_SUB_TYPE, " + - "cast(fld.rdb$field_length AS integer) AS COLUMN_SIZE, " + - "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " + - "cast(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, " + - "cast(fld.rdb$character_length AS integer) AS CHARACTER_MAX_LENGTH, " + - "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " + - "rfr.rdb$field_position AS ORDINAL_POSITION, " + - "null AS DOMAIN_CATALOG, " + - "null AS DOMAIN_SCHEMA, " + - "rfr.rdb$field_source AS DOMAIN_NAME, " + - "null AS SYSTEM_DATA_TYPE, " + - "rfr.rdb$default_source AS COLUMN_DEFAULT, " + - "fld.rdb$computed_source AS COMPUTED_SOURCE, " + - "fld.rdb$dimensions AS COLUMN_ARRAY, " + - "coalesce(fld.rdb$null_flag, rfr.rdb$null_flag) AS COLUMN_NULLABLE, " + - "0 AS IS_READONLY, " + - "fld.rdb$field_type AS FIELD_TYPE, " + - "null AS CHARACTER_SET_CATALOG, " + - "null AS CHARACTER_SET_SCHEMA, " + - "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " + - "null AS COLLATION_CATALOG, " + - "null AS COLLATION_SCHEMA, " + - "coll.rdb$collation_name AS COLLATION_NAME, " + - "rfr.rdb$description AS DESCRIPTION " + - "FROM " + - "rdb$relation_fields rfr " + - "left join rdb$fields fld ON rfr.rdb$field_source = fld.rdb$field_name " + - "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " + - "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)"); + sql.Append( + @"SELECT + null AS TABLE_CATALOG, + null AS TABLE_SCHEMA, + rfr.rdb$relation_name AS TABLE_NAME, + rfr.rdb$field_name AS COLUMN_NAME, + null AS COLUMN_DATA_TYPE, + fld.rdb$field_sub_type AS COLUMN_SUB_TYPE, + CAST(fld.rdb$field_length AS integer) AS COLUMN_SIZE, + CAST(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, + CAST(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, + CAST(fld.rdb$character_length AS integer) AS CHARACTER_MAX_LENGTH, + CAST(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, + rfr.rdb$field_position AS ORDINAL_POSITION, + null AS DOMAIN_CATALOG, + null AS DOMAIN_SCHEMA, + rfr.rdb$field_source AS DOMAIN_NAME, + null AS SYSTEM_DATA_TYPE, + rfr.rdb$default_source AS COLUMN_DEFAULT, + fld.rdb$computed_source AS COMPUTED_SOURCE, + fld.rdb$dimensions AS COLUMN_ARRAY, + coalesce(fld.rdb$null_flag, rfr.rdb$null_flag) AS COLUMN_NULLABLE, + 0 AS IS_READONLY, + fld.rdb$field_type AS FIELD_TYPE, + null AS CHARACTER_SET_CATALOG, + null AS CHARACTER_SET_SCHEMA, + cs.rdb$character_set_name AS CHARACTER_SET_NAME, + null AS COLLATION_CATALOG, + null AS COLLATION_SCHEMA, + coll.rdb$collation_name AS COLLATION_NAME, + rfr.rdb$description AS DESCRIPTION + FROM rdb$relation_fields rfr + LEFT JOIN rdb$fields fld ON rfr.rdb$field_source = fld.rdb$field_name + LEFT JOIN rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id + LEFT JOIN rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)"); - if (restrictions != null) - { - int index = 0; + if (restrictions != null) + { + int index = 0; /* TABLE_CATALOG */ if (restrictions.Length >= 1 && restrictions[0] != null) @@ -86,62 +85,62 @@ /* TABLE_SCHEMA */ if (restrictions.Length >= 2 && restrictions[1] != null) - { + { } /* TABLE_NAME */ if (restrictions.Length >= 3 && restrictions[2] != null) - { + { where.AppendFormat(CultureInfo.CurrentUICulture, "rfr.rdb$relation_name = @p{0}", index++); } /* COLUMN_NAME */ if (restrictions.Length >= 4 && restrictions[3] != null) - { - if (where.Length > 0) - { - where.Append(" AND "); - } + { + if (where.Length > 0) + { + where.Append(" AND "); + } where.AppendFormat(CultureInfo.CurrentUICulture, "rfr.rdb$field_name = @p{0}", index++); } - } + } - if (where.Length > 0) - { + if (where.Length > 0) + { sql.AppendFormat(CultureInfo.CurrentUICulture, " WHERE {0} ", where.ToString()); } - sql.Append(" ORDER BY rfr.rdb$relation_name, rfr.rdb$field_position"); + sql.Append(" ORDER BY rfr.rdb$relation_name, rfr.rdb$field_position"); - return sql; - } + return sql; + } - protected override DataTable ProcessResult(DataTable schema) - { - schema.BeginLoadData(); + protected override DataTable ProcessResult(DataTable schema) + { + schema.BeginLoadData(); schema.Columns.Add("IS_NULLABLE", typeof(bool)); schema.Columns.Add("IS_ARRAY", typeof(bool)); - foreach (DataRow row in schema.Rows) - { - int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture); - - int subType = 0; - if (row["COLUMN_SUB_TYPE"] != System.DBNull.Value) - { - subType = Convert.ToInt32(row["COLUMN_SUB_TYPE"], CultureInfo.InvariantCulture); - } + foreach (DataRow row in schema.Rows) + { + int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture); - int scale = 0 ; - if (row["NUMERIC_SCALE"] != System.DBNull.Value) - { - scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture); - } + int subType = 0; + if (row["COLUMN_SUB_TYPE"] != System.DBNull.Value) + { + subType = Convert.ToInt32(row["COLUMN_SUB_TYPE"], CultureInfo.InvariantCulture); + } - row["IS_NULLABLE"] = (row["COLUMN_NULLABLE"] == DBNull.Value); - row["IS_ARRAY"] = (row["COLUMN_ARRAY"] == DBNull.Value); + int scale = 0; + if (row["NUMERIC_SCALE"] != System.DBNull.Value) + { + scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture); + } + row["IS_NULLABLE"] = (row["COLUMN_NULLABLE"] == DBNull.Value); + row["IS_ARRAY"] = (row["COLUMN_ARRAY"] == DBNull.Value); + FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale); row["COLUMN_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture); @@ -159,10 +158,10 @@ row["CHARACTER_OCTET_LENGTH"] = 0; } - if (row["NUMERIC_PRECISION"] == System.DBNull.Value) - { - row["NUMERIC_PRECISION"] = 0; - } + if (row["NUMERIC_PRECISION"] == System.DBNull.Value) + { + row["NUMERIC_PRECISION"] = 0; + } if ((dbType == FbDbType.Decimal || dbType == FbDbType.Numeric) && (row["NUMERIC_PRECISION"] == System.DBNull.Value || Convert.ToInt32(row["NUMERIC_PRECISION"]) == 0)) @@ -179,8 +178,8 @@ } } - schema.EndLoadData(); - schema.AcceptChanges(); + schema.EndLoadData(); + schema.AcceptChanges(); // Remove not more needed columns schema.Columns.Remove("COLUMN_NULLABLE"); @@ -189,8 +188,8 @@ schema.Columns.Remove("CHARACTER_MAX_LENGTH"); return schema; - } + } - #endregion - } + #endregion + } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbDomains.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbDomains.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbDomains.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Contributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -26,133 +29,132 @@ namespace FirebirdSql.Data.Schema { - internal class FbDomains : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbDomains : FbSchema + { + #region \xB7 Protected Methods \xB7 - protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + protected override StringBuilder GetCommandText(string[] restrictions) + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS DOMAIN_CATALOG, " + - "null AS DOMAIN_SCHEMA, " + - "fld.rdb$field_name AS DOMAIN_NAME, " + - "null AS DOMAIN_DATA_TYPE, " + - "rdb$field_sub_type AS DOMAIN_SUB_TYPE, " + - "cast(fld.rdb$field_length AS integer) AS DOMAIN_SIZE, " + - "cast(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, " + - "cast(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, " + - "cast(fld.rdb$character_length AS integer) AS CHARACTER_MAX_LENGTH, " + - "cast(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, " + - "fld.rdb$null_flag AS COLUMN_NULLABLE, " + - "fld.rdb$dimensions AS COLUMN_ARRAY, " + - "fld.rdb$description AS DESCRIPTION, " + - "fld.rdb$field_type AS FIELD_TYPE, " + - "null AS CHARACTER_SET_CATALOG, " + - "null AS CHARACTER_SET_SCHEMA, " + - "cs.rdb$character_set_name AS CHARACTER_SET_NAME, " + - "null AS COLLATION_CATALOG, " + - "null AS COLLATION_SCHEMA, " + - "coll.rdb$collation_name AS COLLATION_NAME " + - "FROM " + - "rdb$fields fld " + - "left join rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id " + - "left join rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)"); + sql.Append( + @"SELECT + null AS DOMAIN_CATALOG, + null AS DOMAIN_SCHEMA, + fld.rdb$field_name AS DOMAIN_NAME, + null AS DOMAIN_DATA_TYPE, + rdb$field_sub_type AS DOMAIN_SUB_TYPE, + CAST(fld.rdb$field_length AS integer) AS DOMAIN_SIZE, + CAST(fld.rdb$field_precision AS integer) AS NUMERIC_PRECISION, + CAST(fld.rdb$field_scale AS integer) AS NUMERIC_SCALE, + CAST(fld.rdb$character_length AS integer) AS CHARACTER_MAX_LENGTH, + CAST(fld.rdb$field_length AS integer) AS CHARACTER_OCTET_LENGTH, + fld.rdb$null_flag AS COLUMN_NULLABLE, + fld.rdb$dimensions AS COLUMN_ARRAY, + fld.rdb$description AS DESCRIPTION, + fld.rdb$field_type AS FIELD_TYPE, + null AS CHARACTER_SET_CATALOG, + null AS CHARACTER_SET_SCHEMA, + cs.rdb$character_set_name AS CHARACTER_SET_NAME, + null AS COLLATION_CATALOG, + null AS COLLATION_SCHEMA, + coll.rdb$collation_name AS COLLATION_NAME + FROM rdb$fields fld + LEFT JOIN rdb$character_sets cs ON cs.rdb$character_set_id = fld.rdb$character_set_id + LEFT JOIN rdb$collations coll ON (coll.rdb$collation_id = fld.rdb$collation_id AND coll.rdb$character_set_id = fld.rdb$character_set_id)"); - where.Append("not rdb$field_name starting with 'RDB$'"); + where.Append("rdb$field_name NOT STARTING WITH 'RDB$'"); - if (restrictions != null) - { - int index = 0; + if (restrictions != null) + { + int index = 0; - /* DOMAIN_CATALOG */ - if (restrictions.Length >= 1 && restrictions[0] != null) - { - } + /* DOMAIN_CATALOG */ + if (restrictions.Length >= 1 && restrictions[0] != null) + { + } - /* DOMAIN_SCHEMA */ - if (restrictions.Length >= 2 && restrictions[1] != null) - { - } + /* DOMAIN_SCHEMA */ + if (restrictions.Length >= 2 && restrictions[1] != null) + { + } - /* DOMAIN_NAME */ - if (restrictions.Length >= 3 && restrictions[2] != null) - { - where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$field_name = @p{0}", index++); - } - } + /* DOMAIN_NAME */ + if (restrictions.Length >= 3 && restrictions[2] != null) + { + where.AppendFormat(CultureInfo.CurrentCulture, " AND rdb$field_name = @p{0}", index++); + } + } - if (where.Length > 0) - { - sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString()); - } + if (where.Length > 0) + { + sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString()); + } - sql.Append(" ORDER BY rdb$field_name"); + sql.Append(" ORDER BY rdb$field_name"); - return sql; - } + return sql; + } - protected override DataTable ProcessResult(DataTable schema) - { - schema.BeginLoadData(); + protected override DataTable ProcessResult(DataTable schema) + { + schema.BeginLoadData(); schema.Columns.Add("IS_NULLABLE", typeof(bool)); schema.Columns.Add("IS_ARRAY", typeof(bool)); - foreach (DataRow row in schema.Rows) - { - int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture); + foreach (DataRow row in schema.Rows) + { + int blrType = Convert.ToInt32(row["FIELD_TYPE"], CultureInfo.InvariantCulture); - int subType = 0; - if (row["DOMAIN_SUB_TYPE"] != System.DBNull.Value) - { - subType = Convert.ToInt32(row["DOMAIN_SUB_TYPE"], CultureInfo.InvariantCulture); - } + int subType = 0; + if (row["DOMAIN_SUB_TYPE"] != System.DBNull.Value) + { + subType = Convert.ToInt32(row["DOMAIN_SUB_TYPE"], CultureInfo.InvariantCulture); + } - int scale = 0; - if (row["NUMERIC_SCALE"] != System.DBNull.Value) - { - scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture); - } + int scale = 0; + if (row["NUMERIC_SCALE"] != System.DBNull.Value) + { + scale = Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture); + } - row["IS_NULLABLE"] = (row["COLUMN_NULLABLE"] == DBNull.Value); - row["IS_ARRAY"] = (row["COLUMN_ARRAY"] == DBNull.Value); + row["IS_NULLABLE"] = (row["COLUMN_NULLABLE"] == DBNull.Value); + row["IS_ARRAY"] = (row["COLUMN_ARRAY"] == DBNull.Value); - FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale); - row["DOMAIN_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture); + FbDbType dbType = (FbDbType)TypeHelper.GetDbDataType(blrType, subType, scale); + row["DOMAIN_DATA_TYPE"] = TypeHelper.GetDataTypeName((DbDataType)dbType).ToLower(CultureInfo.CurrentCulture); - if (dbType == FbDbType.Char || dbType == FbDbType.VarChar) - { + if (dbType == FbDbType.Char || dbType == FbDbType.VarChar) + { row["DOMAIN_SIZE"] = row["CHARACTER_MAX_LENGTH"]; - } - else - { - row["CHARACTER_OCTET_LENGTH"] = 0; - } + } + else + { + row["CHARACTER_OCTET_LENGTH"] = 0; + } - if (dbType == FbDbType.Binary || dbType == FbDbType.Text) - { - row["DOMAIN_SIZE"] = Int32.MaxValue; - } + if (dbType == FbDbType.Binary || dbType == FbDbType.Text) + { + row["DOMAIN_SIZE"] = Int32.MaxValue; + } - if (row["NUMERIC_PRECISION"] == System.DBNull.Value) - { - row["NUMERIC_PRECISION"] = 0; - } + if (row["NUMERIC_PRECISION"] == System.DBNull.Value) + { + row["NUMERIC_PRECISION"] = 0; + } - if ((dbType == FbDbType.Decimal || dbType == FbDbType.Numeric) && + if ((dbType == FbDbType.Decimal || dbType == FbDbType.Numeric) && (row["NUMERIC_PRECISION"] == System.DBNull.Value || Convert.ToInt32(row["NUMERIC_PRECISION"]) == 0)) - { - row["NUMERIC_PRECISION"] = row["DOMAIN_SIZE"]; - } + { + row["NUMERIC_PRECISION"] = row["DOMAIN_SIZE"]; + } - row["NUMERIC_SCALE"] = (-1) * scale; - } + row["NUMERIC_SCALE"] = (-1) * scale; + } - schema.EndLoadData(); - schema.AcceptChanges(); + schema.EndLoadData(); + schema.AcceptChanges(); // Remove not more needed columns schema.Columns.Remove("COLUMN_NULLABLE"); @@ -160,9 +162,9 @@ schema.Columns.Remove("FIELD_TYPE"); schema.Columns.Remove("CHARACTER_MAX_LENGTH"); - return schema; - } + return schema; + } - #endregion - } + #endregion + } } \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbForeignKeyColumns.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbForeignKeyColumns.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbForeignKeyColumns.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Contributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -33,36 +36,28 @@ StringBuilder where = new StringBuilder(); sql.Append( - @"SELECT " + - "null AS CONSTRAINT_CATALOG, " + - "null AS CONSTRAINT_SCHEMA, " + - "co.rdb$constraint_name AS CONSTRAINT_NAME, " + - "null AS TABLE_CATALOG, " + - "null AS TABLE_SCHEMA, " + - "co.rdb$relation_name AS TABLE_NAME, " + - "coidxseg.rdb$field_name AS COLUMN_NAME, " + - "null as REFERENCED_TABLE_CATALOG, " + - "null as REFERENCED_TABLE_SCHEMA, " + - "refidx.rdb$relation_name as REFERENCED_TABLE_NAME, " + - "refidxseg.rdb$field_name AS REFERENCED_COLUMN_NAME, " + - "coidxseg.rdb$field_position as ORDINAL_POSITION " + - "FROM " + - "rdb$relation_constraints co, " + - "rdb$ref_constraints ref, " + - "rdb$indices tempidx, " + - "rdb$indices refidx," + - "rdb$index_segments coidxseg, " + - "rdb$index_segments refidxseg "); - - where.Append( - "co.rdb$constraint_name = ref.rdb$constraint_name and " + - "co.rdb$constraint_type = 'FOREIGN KEY' and " + - "co.rdb$index_name = tempidx.rdb$index_name and " + - "co.rdb$index_name = coidxseg.rdb$index_name and " + - "refidx.rdb$index_name = tempidx.rdb$foreign_key and " + - "refidxseg.rdb$index_name = refidx.rdb$index_name and " + - "coidxseg.rdb$field_position = refidxseg.rdb$field_position "); + @"SELECT + null AS CONSTRAINT_CATALOG, + null AS CONSTRAINT_SCHEMA, + co.rdb$constraint_name AS CONSTRAINT_NAME, + null AS TABLE_CATALOG, + null AS TABLE_SCHEMA, + co.rdb$relation_name AS TABLE_NAME, + coidxseg.rdb$field_name AS COLUMN_NAME, + null as REFERENCED_TABLE_CATALOG, + null as REFERENCED_TABLE_SCHEMA, + refidx.rdb$relation_name as REFERENCED_TABLE_NAME, + refidxseg.rdb$field_name AS REFERENCED_COLUMN_NAME, + coidxseg.rdb$field_position as ORDINAL_POSITION + FROM rdb$relation_constraints co + INNER JOIN rdb$ref_constraints ref ON co.rdb$constraint_name = ref.rdb$constraint_name + INNER JOIN rdb$indices tempidx ON co.rdb$index_name = tempidx.rdb$index_name + INNER JOIN rdb$index_segments coidxseg ON co.rdb$index_name = coidxseg.rdb$index_name + INNER JOIN rdb$index_segments refidxseg ON coidxseg.rdb$field_position = refidxseg.rdb$field_position + INNER JOIN rdb$indices refidx ON refidxseg.rdb$index_name = refidx.rdb$index_name"); + where.Append("co.rdb$constraint_type = 'FOREIGN KEY'"); + if (restrictions != null) { int index = 0; @@ -80,19 +75,19 @@ /* TABLE_NAME */ if (restrictions.Length >= 3 && restrictions[2] != null) { - where.AppendFormat(CultureInfo.CurrentCulture, " and co.rdb$relation_name = @p{0}", index++); + where.AppendFormat(CultureInfo.CurrentCulture, " AND co.rdb$relation_name = @p{0}", index++); } /* CONSTRAINT_NAME */ if (restrictions.Length >= 4 && restrictions[3] != null) { - where.AppendFormat(CultureInfo.CurrentCulture, " and co.rdb$constraint_name = @p{0}", index++); + where.AppendFormat(CultureInfo.CurrentCulture, " AND co.rdb$constraint_name = @p{0}", index++); } /* COLUMN_NAME */ if (restrictions.Length >= 5 && restrictions[4] != null) { - where.AppendFormat(CultureInfo.CurrentCulture, " and coidxseg.rdb$field_name = @p{0}", index++); + where.AppendFormat(CultureInfo.CurrentCulture, " AND coidxseg.rdb$field_name = @p{0}", index++); } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbForeignKeys.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbForeignKeys.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbForeignKeys.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Constributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -23,81 +26,76 @@ namespace FirebirdSql.Data.Schema { - internal class FbForeignKeys : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbForeignKeys : FbSchema + { + #region \xB7 Protected Methods \xB7 - protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + protected override StringBuilder GetCommandText(string[] restrictions) + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS CONSTRAINT_CATALOG, " + - "null AS CONSTRAINT_SCHEMA, " + - "co.rdb$constraint_name AS CONSTRAINT_NAME, " + - "null AS TABLE_CATALOG, " + - "null AS TABLE_SCHEMA, " + - "co.rdb$relation_name AS TABLE_NAME, " + - "null as REFERENCED_TABLE_CATALOG, " + - "null as REFERENCED_TABLE_SCHEMA, " + - "refidx.rdb$relation_name as REFERENCED_TABLE_NAME, " + - "co.rdb$deferrable AS IS_DEFERRABLE, " + - "co.rdb$initially_deferred AS INITIALLY_DEFERRED, " + - "ref.rdb$match_option AS MATCH_OPTION, " + - "ref.rdb$update_rule AS UPDATE_RULE, " + - "ref.rdb$delete_rule AS DELETE_RULE, " + - "co.rdb$index_name as INDEX_NAME " + - "FROM " + - "rdb$relation_constraints co, " + - "rdb$ref_constraints ref, " + - "rdb$indices tempidx, " + - "rdb$indices refidx "); + sql.Append( + @"SELECT + null AS CONSTRAINT_CATALOG, + null AS CONSTRAINT_SCHEMA, + co.rdb$constraint_name AS CONSTRAINT_NAME, + null AS TABLE_CATALOG, + null AS TABLE_SCHEMA, + co.rdb$relation_name AS TABLE_NAME, + null as REFERENCED_TABLE_CATALOG, + null as REFERENCED_TABLE_SCHEMA, + refidx.rdb$relation_name as REFERENCED_TABLE_NAME, + co.rdb$deferrable AS IS_DEFERRABLE, + co.rdb$initially_deferred AS INITIALLY_DEFERRED, + ref.rdb$match_option AS MATCH_OPTION, + ref.rdb$update_rule AS UPDATE_RULE, + ref.rdb$delete_rule AS DELETE_RULE, + co.rdb$index_name as INDEX_NAME + FROM rdb$relation_constraints co + INNER JOIN rdb$ref_constraints ref ON co.rdb$constraint_name = ref.rdb$constraint_name + INNER JOIN rdb$indices tempidx ON co.rdb$index_name = tempidx.rdb$index_name + INNER JOIN rdb$indices refidx ON refidx.rdb$index_name = tempidx.rdb$foreign_key"); - where.Append( - "co.rdb$constraint_name = ref.rdb$constraint_name and " + - "co.rdb$constraint_type = 'FOREIGN KEY' and " + - "co.rdb$index_name = tempidx.rdb$index_name and " + - "refidx.rdb$index_name = tempidx.rdb$foreign_key"); + where.Append("co.rdb$constraint_type = 'FOREIGN KEY'"); - if (restrictions != null) - { - int index = 0; + if (restrictions != null) + { + int index = 0; /* CONSTRAINT_CATALOG */ - if (restrictions.Length >= 1 && restrictions[0] != null) - { - } + if (restrictions.Length >= 1 && restrictions[0] != null) + { + } - /* CONSTRAINT_SCHEMA */ - if (restrictions.Length >= 2 && restrictions[1] != null) - { - } + /* CONSTRAINT_SCHEMA */ + if (restrictions.Length >= 2 && restrictions[1] != null) + { + } - /* TABLE_NAME */ - if (restrictions.Length >= 3 && restrictions[2] != null) - { - where.AppendFormat(CultureInfo.CurrentCulture, " and co.rdb$relation_name = @p{0}", index++); - } + /* TABLE_NAME */ + if (restrictions.Length >= 3 && restrictions[2] != null) + { + where.AppendFormat(CultureInfo.CurrentCulture, " AND co.rdb$relation_name = @p{0}", index++); + } /* CONSTRAINT_NAME */ if (restrictions.Length >= 4 && restrictions[3] != null) { - where.AppendFormat(CultureInfo.CurrentCulture, " and rel.rdb$constraint_name = @p{0}", index++); + where.AppendFormat(CultureInfo.CurrentCulture, " AND rel.rdb$constraint_name = @p{0}", index++); } } - if (where.Length > 0) - { - sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString()); - } + if (where.Length > 0) + { + sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString()); + } - sql.Append(" ORDER BY co.rdb$relation_name, co.rdb$constraint_name"); + sql.Append(" ORDER BY co.rdb$relation_name, co.rdb$constraint_name"); - return sql; - } + return sql; + } - #endregion - } + #endregion + } } \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbFunctions.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbFunctions.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbFunctions.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Constributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -23,94 +26,94 @@ namespace FirebirdSql.Data.Schema { - internal class FbFunctions : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbFunctions : FbSchema + { + #region \xB7 Protected Methods \xB7 - protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + protected override StringBuilder GetCommandText(string[] restrictions) + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS FUNCTION_CATALOG, " + - "null AS FUNCTION_SCHEMA, " + - "rdb$function_name AS FUNCTION_NAME, " + - "rdb$system_flag AS IS_SYSTEM_FUNCTION, " + - "rdb$function_type AS FUNCTION_TYPE, " + - "rdb$query_name AS QUERY_NAME, " + - "rdb$module_name AS FUNCTION_MODULE_NAME, " + - "rdb$entrypoint AS FUNCTION_ENTRY_POINT, " + - "rdb$return_argument AS RETURN_ARGUMENT, " + - "rdb$description AS DESCRIPTION " + - "FROM rdb$functions"); + sql.Append( + @"SELECT + null AS FUNCTION_CATALOG, + null AS FUNCTION_SCHEMA, + rdb$function_name AS FUNCTION_NAME, + rdb$system_flag AS IS_SYSTEM_FUNCTION, + rdb$function_type AS FUNCTION_TYPE, + rdb$query_name AS QUERY_NAME, + rdb$module_name AS FUNCTION_MODULE_NAME, + rdb$entrypoint AS FUNCTION_ENTRY_POINT, + rdb$return_argument AS RETURN_ARGUMENT, + rdb$description AS DESCRIPTION + FROM rdb$functions"); - if (restrictions != null) - { - int index = 0; + if (restrictions != null) + { + int index = 0; - /* FUNCTION_CATALOG */ - if (restrictions.Length >= 1 && restrictions[0] != null) - { - } + /* FUNCTION_CATALOG */ + if (restrictions.Length >= 1 && restrictions[0] != null) + { + } - /* FUNCTION_SCHEMA */ - if (restrictions.Length >= 2 && restrictions[1] != null) - { - } + /* FUNCTION_SCHEMA */ + if (restrictions.Length >= 2 && restrictions[1] != null) + { + } - /* FUNCTION_NAME */ - if (restrictions.Length >= 3 && restrictions[2] != null) - { - where.AppendFormat(CultureInfo.CurrentCulture, "rdb$function_name = @p{0}", index++); - } + /* FUNCTION_NAME */ + if (restrictions.Length >= 3 && restrictions[2] != null) + { + where.AppendFormat(CultureInfo.CurrentCulture, "rdb$function_name = @p{0}", index++); + } - /* IS_SYSTEM_FUNCTION */ - if (restrictions.Length >= 4 && restrictions[3] != null) - { - if (where.Length > 0) - { - where.Append(" AND "); - } + /* IS_SYSTEM_FUNCTION */ + if (restrictions.Length >= 4 && restrictions[3] != null) + { + if (where.Length > 0) + { + where.Append(" AND "); + } - where.AppendFormat(CultureInfo.CurrentCulture, "rdb$system_flag = @p{0}", index++); - } - } + where.AppendFormat(CultureInfo.CurrentCulture, "rdb$system_flag = @p{0}", index++); + } + } - if (where.Length > 0) - { - sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString()); - } + if (where.Length > 0) + { + sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString()); + } - sql.Append(" ORDER BY rdb$function_name"); + sql.Append(" ORDER BY rdb$function_name"); - return sql; - } + return sql; + } - protected override DataTable ProcessResult(DataTable schema) - { - schema.BeginLoadData(); + protected override DataTable ProcessResult(DataTable schema) + { + schema.BeginLoadData(); - foreach (DataRow row in schema.Rows) - { - if (row["IS_SYSTEM_FUNCTION"] == DBNull.Value || - Convert.ToInt32(row["IS_SYSTEM_FUNCTION"], CultureInfo.InvariantCulture) == 0) - { - row["IS_SYSTEM_FUNCTION"] = false; - } - else - { - row["IS_SYSTEM_FUNCTION"] = true; - } - } + foreach (DataRow row in schema.Rows) + { + if (row["IS_SYSTEM_FUNCTION"] == DBNull.Value || + Convert.ToInt32(row["IS_SYSTEM_FUNCTION"], CultureInfo.InvariantCulture) == 0) + { + row["IS_SYSTEM_FUNCTION"] = false; + } + else + { + row["IS_SYSTEM_FUNCTION"] = true; + } + } - schema.EndLoadData(); - schema.AcceptChanges(); + schema.EndLoadData(); + schema.AcceptChanges(); - return schema; - } + return schema; + } - #endregion - } + #endregion + } } \ No newline at end of file Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbGenerators.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbGenerators.cs 2008-03-30 10:41:32 UTC (rev 544) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Schema/FbGenerators.cs 2008-03-30 11:41:40 UTC (rev 545) @@ -14,6 +14,9 @@ * * Copyright (c) 2002, 2007 Carlos Guzman Alvarez * All Rights Reserved. + * + * Constributors: + * Jiri Cincura (ji...@ci...) */ using System; @@ -23,90 +26,89 @@ namespace FirebirdSql.Data.Schema { - internal class FbGenerators : FbSchema - { - #region \xB7 Protected Methods \xB7 + internal class FbGenerators : FbSchema + { + #region \xB7 Protected Methods \xB7 - protected override StringBuilder GetCommandText(string[] restrictions) - { - StringBuilder sql = new StringBuilder(); - StringBuilder where = new StringBuilder(); + protected override StringBuilder GetCommandText(string[] restrictions) + { + StringBuilder sql = new StringBuilder(); + StringBuilder where = new StringBuilder(); - sql.Append( - @"SELECT " + - "null AS GENERATOR_CATALOG, " + - "null AS GENERATOR_SCHEMA, " + - "rdb$generator_name AS GENERATOR_NAME, " + - "rdb$system_flag AS IS_SYSTEM_GENERATOR, " + - "rdb$generator_id AS GENERATOR_ID " + - "FROM " + - "rdb$generators"); + sql.Append( + @"SELECT + null AS GENERATOR_CATALOG, + null AS GENERATOR_SCHEMA, + rdb$generator_name AS GENERATOR_NAME, + rdb$system_flag AS IS_SYSTEM_GENERATOR, + rdb$generator_id AS GENERATOR_ID + FROM rdb$generators"); - if (restrictions != null) - { - int index = 0; + if (restrictions != null) + { + int index = 0; - /* GENERATOR_CATALOG */ - if (restrictions.Length >= 1 && restrictions[0] != null) - { - } + /* GENERATOR_CATALOG */ + if (restrictions.Length >= 1 && restrictions[0] != null) + { + } - /* GENERATOR_SCHEMA */ - if (restrictions.Length >= 2 && restrictions[1] != null) - { - } + /* GENERATOR_SCHEMA */ + if (restrictions.Length >= 2 && restrictions[1] != null) + { + } - /* GENERATOR_NAME */ - if (restrictions.Length >= 3 && restrictions[2] != null) - { - where.AppendFormat(CultureInfo.CurrentCulture, "rdb$generator_name = @p{0}", index++); - } + /* GENERATOR_NAME */ + if (restrictions.Length >= 3 && restrictions[2] != null) + { + where.AppendFormat(CultureInfo.CurrentCulture, "rdb$generator_name = @p{0}", index++); + } /* IS_SYSTEM_GENERATOR */ - if (restrictions.Length >= 4 && restrictions[3] != null) - { - if (where.Length > 0) - { - where.Append(" AND "); - } + if (restrictions.Length >= 4 && restrictions[3] != null) + { + if (where.Length > 0) + { + where.Append(" AND "); + } - where.AppendFormat(CultureInfo.CurrentCulture, "rdb$system_flag = @p{0}", index++); - } - } + where.AppendFormat(CultureInfo.CurrentCulture, "rdb$system_flag = @p{0}", index++); + } + } - if (where.Length > 0) - { - sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString()); - } + if (where.Length > 0) + { + sql.AppendFormat(CultureInfo.CurrentCulture, " WHERE {0} ", where.ToString()); + } - sql.Append(" ORDER BY rdb$generator_name"); + sql.Append(" ORDER BY rdb$generator_name"); - return sql; - } + return sql; + } - protected override DataTable ProcessResult(DataTable schema) - { - schema.BeginLoadData(); + protected override DataTable ProcessResult(DataTable schema) + { + schema.BeginLoadData(); - foreach (DataRow row in schema.Rows) - { - if (row["IS_SYSTEM_GENERATOR"] == DBNull.Value || - Convert.ToInt32(row["IS_SYSTEM_GENERATOR"], CultureInfo.InvariantCulture) == 0) - { - row["IS_SYSTEM_GENERATOR"] = false; - } - else - { - row["IS_SYSTEM_GENERATOR"] = true; - } - } + foreach (DataRow row in schema.Rows) + { + if (row["IS_SYSTEM_GENERATOR"] == DBNull.Value || + Convert.ToInt32(row["IS_SYSTEM_GENERATOR"], CultureInfo.InvariantCulture) == 0) + { + row["IS_SYSTEM_GENERATOR"] = false; + } + else + { + row["IS_SYSTEM_GENERATOR"] = true; + } + } - schema.EndLoadData(); - schema.AcceptChanges(); + schema.EndLoadData(... [truncated message content] |