java getColumnLabel 与 getColumnName
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4271152/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
getColumnLabel vs. getColumnName
提问by sova
What is the difference between ResultSetMetaData.getColumnLabeland ResultSetMetaData.getColumnName?
ResultSetMetaData.getColumnLabel和 ResultSetMetaData.getColumnName 有什么区别?
Label: Gets the designated column's suggested title for use in printouts and displays.
标签:获取指定列的建议标题以用于打印输出和显示。
Name: Get the designated column's name.
名称:获取指定列的名称。
Does anyone know how Label is determined?
有谁知道标签是如何确定的?
回答by stacker
String getColumnLabel(int column) throws SQLException;
If a SQL AS
is not specified, the value returned from
getColumnLabel
will be the same as the value returned by the
getColumnName
method.
如果AS
未指定SQL ,则返回
getColumnLabel
的值将与getColumnName
方法返回的值相同
。
Example:
例子:
select id as user_no from users
- getColumnLabel would return 'user_no'
- getColumnName would return 'id'
- getColumnLabel 将返回“user_no”
- getColumnName 将返回“id”