在不使用ResultSetMetaData的情况下从表中检索列名

时间:2015-10-24 18:56:22

标签: java sql database jdbc

我们可以在不使用ResultSetMetaData对象的情况下获取表列信息。还有其他选择吗?

1 个答案:

答案 0 :(得分:1)

您可以通过调用Connection.getMetaData() getColumns(null, null, "MyTable", "%")来获取表的列信息,而无需运行a:5:{i:0;s:94:"Source model "neoshopsettings/blockposition" not found for attribute "category_block_position"";i:1;s:4045:"#0 /home/mybest/public_html/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php(387): Mage::exception('Mage_Eav', 'Source model "n...') #1 /home/mybest/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Form.php(201): Mage_Eav_Model_Entity_Attribute_Abstract->getSource() #2 /home/mybest/public_html/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php(113): Mage_Adminhtml_Block_Widget_Form->_setFieldset(Array, Object(Varien_Data_Form_Element_Fieldset)) #3 /home/mybest/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Form.php(144): Mage_Adminhtml_Block_Catalog_Category_Tab_Attributes->_prepareForm() #4 /home/mybest/public_html/app/code/core/Mage/Core/Block/Abstract.php(918): Mage_Adminhtml_Block_Widget_Form->_beforeToHtml() #5 /home/mybest/public_html/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php(140): Mage_Core_Block_Abstract->toHtml() #6 /home/mybest/public_html/app/code/core/Mage/Core/Block/Abstract.php(293): Mage_Adminhtml_Block_Catalog_Category_Tabs->_prepareLayout() #7 /home/mybest/public_html/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout)) #8 /home/mybest/public_html/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit/Form.php(55): Mage_Core_Model_Layout->createBlock('adminhtml/catal...', 'tabs') #9 /home/mybest/public_html/app/code/core/Mage/Core/Block/Abstract.php(293): Mage_Adminhtml_Block_Catalog_Category_Edit_Form->_prepareLayout() #10 /home/mybest/public_html/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout)) #11 /home/mybest/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php(82): Mage_Core_Model_Layout->createBlock('adminhtml/catal...') #12 /home/mybest/public_html/app/code/core/Mage/Core/Block/Abstract.php(293): Mage_Adminhtml_Block_Widget_Form_Container->_prepareLayout() #13 /home/mybest/public_html/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout)) #14 /home/mybest/public_html/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('adminhtml/catal...', 'category.edit') #15 /home/mybest/public_html/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('adminhtml/catal...', 'category.edit') #16 /home/mybest/public_html/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element)) #17 /home/mybest/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) #18 /home/mybest/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks() #19 /home/mybest/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks() #20 /home/mybest/public_html/app/code/core/Mage/Adminhtml/Controller/Action.php(275): Mage_Core_Controller_Varien_Action->loadLayout(NULL, true, true) #21 /home/mybest/public_html/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php(201): Mage_Adminhtml_Controller_Action->loadLayout() #22 /home/mybest/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Catalog_CategoryController->editAction() #23 /home/mybest/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('edit') #24 /home/mybest/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #25 /home/mybest/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch() #26 /home/mybest/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array) #27 /home/mybest/public_html/index.php(90): Mage::run('', 'store') #28 {main}";s:3:"url";s:77:"/index.php/admin/catalog_category/index/key/932b15d75078085a168fe65b5695d53b/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";} 语句。