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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 05:37:55  来源:igfitidea点击:

getColumnLabel vs. getColumnName

javaresultset

提问by sova

What is the difference between ResultSetMetaData.getColumnLabeland ResultSetMetaData.getColumnName?

ResultSetMetaData.getColumnLabelResultSetMetaData.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 ASis not specified, the value returned from getColumnLabelwill be the same as the value returned by the getColumnNamemethod.

如果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”