File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
app/code/core/Mage/ImportExport/Model/Resource/Helper Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -54,12 +54,21 @@ public function getMaxDataSize()
54
54
*/
55
55
public function getNextAutoincrement ($ tableName )
56
56
{
57
- $ adapter = $ this ->_getReadAdapter ();
58
- $ entityStatus = $ adapter ->showTableStatus ($ tableName );
57
+ $ connection = $ this ->getConnection ();
58
+ $ entityStatus = $ connection ->showTableStatus ($ tableName );
59
59
60
60
if (empty ($ entityStatus ['Auto_increment ' ])) {
61
- Mage::throwException (Mage::helper ('importexport ' )->__ ('Cannot get autoincrement value ' ));
61
+ $ sql = sprintf (
62
+ 'SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = %s AND TABLE_SCHEMA = DATABASE() ' ,
63
+ $ this ->quote ($ tableName )
64
+ );
65
+ $ entityStatus = $ connection ->fetchRow ($ sql );
66
+ if (empty ($ entityStatus ['AUTO_INCREMENT ' ]))
67
+ {
68
+ throw new \Magento \Framework \Exception \LocalizedException (__ ('Cannot get autoincrement value ' ));
62
69
}
63
- return $ entityStatus ['Auto_increment ' ];
70
+
71
+ return $ entityStatus ['AUTO_INCREMENT ' ];
72
+
64
73
}
65
74
}
You can’t perform that action at this time.
0 commit comments