Krassmus / Fleximport

A plugin for Stud.IP to import users and courses
GNU General Public License v2.0
1 stars 1 forks source link

Exception when csv uses comma as delimiter #1

Open AaronWiora opened 3 years ago

AaronWiora commented 3 years ago

Today I tried to upload the file auth_user_md5.csv that I have exported from the profile page of a user, but I got this message:

Houston, we've got a problem.

Typ: PDOException
Nachricht: SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'user_id, username, password, perms, vorname, nachname, email, validation_key, auth_plugin, locked...' is too long
Code: 42000
Stack trace:
#$ lib/classes/StudipPDO.class.php(169)
#0 lib/classes/StudipPDO.class.php(169): PDO->exec('CREATE TABLE `f...')
#1 public/plugins_packages/data-quest/Fleximport/classes/FleximportTable.php(259): StudipPDO->exec('CREATE TABLE `f...')
#2 public/plugins_packages/data-quest/Fleximport/controllers/import.php(76): FleximportTable->createTable(Array, Array)
#3 vendor/trails/trails.php(557): ImportController->process_action('73888e1ba41b404...')
#4 app/controllers/studip_controller.php(129): Trails_Controller->perform('process/73888e1...')
#5 vendor/trails/trails.php(154): StudipController->perform('process/73888e1...')
#6 vendor/trails/trails.php(121): Trails_Dispatcher->map_uri_to_response('import/process/...')
#7 lib/plugins/core/StudIPPlugin.class.php(161): Trails_Dispatcher->dispatch('import/process/...')
#8 public/plugins.php(54): StudIPPlugin->perform('import/process/...')
#9 {main}

I also tried to upload other files and they worked, so I compared the auth_user_md5.csv with other exported csv. I noticed that the auth_user_md5.csv file uses comma as delimiter while all the other files I checked are using semicolon. After changing the commas to semicolons i could also upload the auth_user_md5.csv.

Does Fleximport only support certain delimiters?

Krassmus commented 3 years ago

CSV means "comma separated values", but most of the times (and I mean Excel exports and a lot other stuff) the CSV is semikolon separated values.

You should try to open that file in libreoffice with comma as the delimiter and save/export it to csv with semikolon as delimiter. Then you could upload it to Fleximport. Does that work better?

AaronWiora commented 3 years ago

This does work for me. Maybe you could add this information to the wiki because the error message might not be helpful for everyone.