/** * Sets the import plugin properties. * Called in the constructor. * * @return void */ protected function setProperties() { $this->_setAnalyze(false); if ($GLOBALS['plugin_param'] !== 'table') { $this->_setAnalyze(true); } $generalOptions = parent::setProperties(); $this->properties->setText('CSV'); $this->properties->setExtension('csv'); if ($GLOBALS['plugin_param'] !== 'table') { $leaf = new BoolPropertyItem(); $leaf->setName("col_names"); $leaf->setText(__('The first line of the file contains the table column names' . ' <i>(if this is unchecked, the first line will become part' . ' of the data)</i>')); $generalOptions->addProperty($leaf); } else { $hint = new PMA_Message(__('If the data in each row of the file is not' . ' in the same order as in the database, list the corresponding' . ' column names here. Column names must be separated by commas' . ' and not enclosed in quotations.')); $leaf = new TextPropertyItem(); $leaf->setName("columns"); $leaf->setText(__('Column names: ') . PMA_Util::showHint($hint)); $generalOptions->addProperty($leaf); } $leaf = new BoolPropertyItem(); $leaf->setName("ignore"); $leaf->setText(__('Do not abort on INSERT error')); $generalOptions->addProperty($leaf); }
/** * Sets the import plugin properties. * Called in the constructor. * * @return void */ protected function setProperties() { if ($GLOBALS['cfg']['Import']['ldi_local_option'] == 'auto') { $GLOBALS['cfg']['Import']['ldi_local_option'] = false; $result = $GLOBALS['dbi']->tryQuery('SHOW VARIABLES LIKE \'local\\_infile\';'); if ($result != false && $GLOBALS['dbi']->numRows($result) > 0) { $tmp = $GLOBALS['dbi']->fetchRow($result); if ($tmp[1] == 'ON') { $GLOBALS['cfg']['Import']['ldi_local_option'] = true; } } $GLOBALS['dbi']->freeResult($result); unset($result); } $generalOptions = parent::setProperties(); $this->properties->setText('CSV using LOAD DATA'); $this->properties->setExtension('ldi'); $leaf = new TextPropertyItem(); $leaf->setName("columns"); $leaf->setText(__('Column names: ')); $generalOptions->addProperty($leaf); $leaf = new BoolPropertyItem(); $leaf->setName("ignore"); $leaf->setText(__('Do not abort on INSERT error')); $generalOptions->addProperty($leaf); $leaf = new BoolPropertyItem(); $leaf->setName("local_option"); $leaf->setText(__('Use LOCAL keyword')); $generalOptions->addProperty($leaf); }