using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization.Json;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;
using DevExpress.Utils.Text.Internal;
using DevExpress.Web.ASPxTabControl;
using Framework;
using NPOI.SS.Formula.Functions;
using WebApp.Common;
using Contract.Domain;
using System.Collections;
using Match = System.Text.RegularExpressions.Match;
using System.Runtime.Serialization;

namespace HraWeb
{
[DataContract(Namespace = "Contract.Domain")]
public class UserTabColumn
{
[DataMember]
public virtual string ColumnName { get; set; }
[DataMember]
public virtual string DataType { get; set; }

[DataMember]
public virtual string Comments { get; set; }
}
public partial class BasInstDefaultValueConfigManage : EntityDetail<BasInstDefaultValue>
{

//初始页面控件
protected override void InitPage(string id)
{

// BindEntityDrop(txt_TableName_, "all_tables",false);
base.InitPage(id);
}
protected void BindEntityDrop()
{

//txt_InstrumentTypeId_.DataTextField = "InstrumentTypeName";
//txt_InstrumentTypeId_.DataValueField = "Id";
//txt_InstrumentTypeId_.DataSource =
// Holworth.Utility.Utility.ListToT<BasInstrumentType>(Dao.FindList(new QueryInfo("BasInstrumentType")))
// .ToList();
//txt_InstrumentTypeId_.DataBind();

}

protected override BasInstDefaultValue LoadData(string id)
{
var obj = base.LoadData(id);
return obj;
}

protected override void Page_Load(object sender, EventArgs e)
{

if (Request["_method"] == "Table2Drop")
{
string tableName = Request["entityType"] ?? "";
if (!string.IsNullOrEmpty(tableName))
Table2Drop(tableName);
}
else if (Request["_method"] == "getTable")
{
GetTable();

}
else if (Request["_method"] == "getModel")
{
getModel();
}

// base.svc = Psvc;
base.Page_Load(sender, e);
}

public void getModel()
{
string tname = Request["_tname"] ?? "";
if (!string.IsNullOrEmpty(tname))
{
QueryInfo info=new QueryInfo("BasInstDefaultValue");
}
}

public void GetTable()
{
string tname = Request["tname"];
QueryInfo colTypeInfo = new QueryInfo();
colTypeInfo.CustomSQL = string.Format(@"select a.column_name column_name,a.DATA_TYPE DATA_TYPE,b.comments comments from User_Tab_Columns a inner join user_col_comments b on a.table_name=b.table_name
and lower(a.column_name) not in(
'sequence',
'is_deleted',
'py',
'create_uid',
'create_uname',
'create_oid',
'create_pid',
'create_date',
'last_mod_uid',
'last_mod_uname',
'last_mod_oid',
'last_mod_pid',
'last_mod_datetime')
and a.column_name=b.column_name where a.TABLE_NAME=upper(trim('{0}'))", tname.ToUpper());
List<UserTabColumn> columnDic = Dao.ExcuteDataSet(colTypeInfo).Tables[0].ToList<UserTabColumn>();
var s = Newtonsoft.Json.JsonConvert.SerializeObject(columnDic);
HttpContext.Current.Response.Write(s);
HttpContext.Current.Response.End();

}

public void Table2Drop(string tableName)
{
QueryInfo tabInfo = new QueryInfo();
tabInfo.CustomSQL = @"select a.TABLE_NAME TABLE_NAME,b.COMMENTS COMMENTS
from user_tables a,user_tab_comments b
WHERE a.TABLE_NAME=b.TABLE_NAME
";
//
var keyword = Request["keyword"] ?? string.Empty;
if (!string.IsNullOrEmpty(keyword))
{

tabInfo.CustomSQL += string.Format(" and b.{0} like '%{1}%'", "COMMENTS", keyword);

}
//tabInfo.PageSize = int.Parse(HttpContext.Current.Request["rows"]);
//int pageIndex = int.Parse(HttpContext.Current.Request["page"]);
//tabInfo.StartRecord = (pageIndex - 1) * tabInfo.PageSize;
//tabInfo.TotalCount = 1;
//
DataTable dt = Dao.ExcuteDataSet(tabInfo).Tables[0];
var s = Newtonsoft.Json.JsonConvert.SerializeObject(dt);
HttpContext.Current.Response.Write(s);
HttpContext.Current.Response.End();

}

protected Hashtable SetInfo()
{
Hashtable aa = new Hashtable();
aa.Clear();
foreach (string key in Request.Params.Keys)
{
if (regEx.IsMatch(key))
{
Match m = regEx.Match(key);
string g = m.Groups["TAG"].Value;
if (string.IsNullOrEmpty(Request.Params[key]))
{
continue;
}
if (string.IsNullOrEmpty(g))
{
if (!aa.Contains(m.Groups["PROP"].Value))
{
aa.Add(m.Groups["PROP"].Value, Request.Params[key]);
}
}
else
{
if (!aa.Contains(m.Groups["PROP"].Value + "_" + g))
{
aa.Add(m.Groups["PROP"].Value + "_" + g, Request.Params[key]);
}

}
}
}
return aa;
}
private static string regexCtlValObj = @"\w{3,5}?_(?<PROP>\w*)_(?<TAG>(\w\d{1,2})*)$";
public static System.Text.RegularExpressions.Regex regEx = new Regex(regexCtlValObj, RegexOptions.IgnoreCase);

private Contract.IService.IRskValuationModelConfigService psvc;
/// <summary>
/// 初始化
/// </summary>
Contract.IService.IRskValuationModelConfigService Psvc
{
get
{
if (psvc == null)
{
psvc = ctx.GetObject("RskValuationModelConfigService") as Contract.IService.IRskValuationModelConfigService;
}
return psvc;

}
}

}
}

oracle获取表和列的备注的更多相关文章

  1. Oracle 获取表的主键、外键以及唯一约束条件

    Oracle 获取表的主键.外键以及唯一约束条件 Select a.Owner 主键拥有者, a.table_name 主键表, b.Column_Name 主键列, b.Constraint_Nam ...

  2. MySql 、Oracle 获取表结构和字段信息

    1.MySql获取表结构信息 SELECT TABLE_NAME, TABLE_COMMENT FROM information_schema.`TABLES` WHERE TABLE_SCHEMA ...

  3. Oracle 获取表结构信息

    通过Oracle中的user_tab_cols, user_col_comments, user_constraints, user_cons_columns表联合查询. user_tab_cols用 ...

  4. ORACLE获取表信息方法

    获取表: select table_name from user_tables; //当前用户的表 select table_name from all_tables; //所有用户的表 select ...

  5. Oracle 获取表注释和列注释

    全部表 select table_name from user_tables; //当前用户拥有的表 select table_name from all_tables; //所有用户的表 selec ...

  6. SqlServer和Oracle判断表和列是否存在

    SqlServer .判断表Users是否存在 if object_id(N'Users',N'U') is not null print '存在' else print '不存在' .判断表User ...

  7. Oracle判断表、列、主键是否存在的方法

    在编写程序时,数据库结构会经常变化,所以经常需要编写一些数据库脚本,编写完成后需发往现场执行,如果已经存在或者重复执行,有些脚本会报错,所以需要判断其是否存在,现在我就把经常用到的一些判断方法和大家分 ...

  8. oracle给表及列添加注释

    给表添加注释 comment on   table    MW_SYS.MWT_OM_OBJ1 is '业务类型的对象实例.'; 给表中的列添加注释 comment on column MW_SYS. ...

  9. MYSQL 获取表的列信息

    SELECT COLUMN_NAME as '列名' ,DATA_TYPE as '字段类型' ,COLUMN_TYPE as '长度加类型' FROM information_schema.`COL ...

随机推荐

  1. LeetCode Kill Process

    原题链接在这里:https://leetcode.com/problems/kill-process/description/ 题目: Given n processes, each process ...

  2. predis的使用

    predis是PHP连接Redis的操作库,由于它完全使用php编写,大量使用命名空间以及闭包等功能,只支持php5.3以上版本,故实测性能一般,每秒25000次读写. 将session数据存放到re ...

  3. 使用axis2进行webservice发布与调用

    一.介绍下cxf.axis.axis2区别 新一代的Web Services 框架如Axis2.CXF 都是由现有的项目中逐渐演化而来的,Axis2 是由大家熟悉的Axis 1.x 系列演化过来,而A ...

  4. (装)Android高性能编程基本规范

    最近总结了一些,Android应用开发中,需要注意的一些事项,与大家分享     1.尽量少的声明全局变量   2.声明全局静态变量,一定要加final声明   3.声明非静态的全局变量,最好不要初始 ...

  5. Crypto 加密解密

    import binascii from Crypto.Cipher import AES #秘钥,此处需要将字符串转为字节 from utils import config from utils.e ...

  6. leetcode609

    public class Solution { public IList<IList<string>> FindDuplicate(string[] paths) { Dict ...

  7. Element-UI使用基本介绍

    Element-Ul是饿了么前端团队推出的一款基于Vue.js 2.0 的桌面端UI框架,手机端有对应框架是Mint UI . 开发环境 1.安装webpack npm install -g webp ...

  8. 分析比较多表查询中的IN与JOIN

    IN 是子查询的关键字,JOIN 是连接的关键字,项目开发中经常会使用到多表查询,而子查询与连接正是实现多表查询的重要途径.那两者是怎么运行的?IN与JOIN哪个更好?下面就来分析与比较. 现在有te ...

  9. 【bzoj3940】[Usaco2015 Feb]Censoring

    [题目描述] FJ把杂志上所有的文章摘抄了下来并把它变成了一个长度不超过10^5的字符串S.他有一个包含n个单词的列表,列表里的n个单词 记为t_1...t_N.他希望从S中删除这些单词.  FJ每次 ...

  10. vim 的小幅移动

    1.操作符命令和位移 x --->删除一个字符,4x ---->删除4个字符. dw --->可以删除一个单词,d4w ---->删除4个单词. d$  ----> 删除 ...