internal override Dictionary <string, string> LoadFields(DbGateway gateway, string tableName) { //TODO: load field length also return(gateway.LoadKeyValue <string, string>( string.Format(@"SELECT a.attname AS field, t.typname AS type FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '{0}' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND attname NOT IN ('cmin', 'cmax', 'ctid', 'oid', 'tableoid', 'xmin', 'xmax') ORDER BY a.attnum", tableName.ToLower()), "field", "type")); }
internal override Dictionary <string, string> LoadFields(DbGateway gateway, string tableName) { // thanks to Kristof Neirynck - http://www.crydust.be/blog/2006/12/26/mssql-lacks-describe-statement/ return(gateway.LoadKeyValue <string, string>( string.Format( @"SELECT column_name as name, data_type + COALESCE( '(' + CAST(character_maximum_length AS VARCHAR) + ')' , '(' + CAST(numeric_precision AS VARCHAR) + ')' , '' ) as [type] FROM information_schema.columns WHERE table_name = N'{0}';", tableName), "name", "type")); }
internal override Dictionary <string, string> LoadFields(DbGateway gateway, string tableName) { return(gateway.LoadKeyValue <string, string>( "describe " + tableName, "Field", "Type")); }