Skip to content

Commit

Permalink
import: fix comma in capacity
Browse files Browse the repository at this point in the history
This patch fixes error while importing image:
`nm_db_edit: database error: 8 values for 7 columns`

In some locales, there may be a comma instead of a period
in fractional numbers, which breaks the SQL query.

Closes #181
  • Loading branch information
0x501D committed Nov 6, 2024
1 parent 48610a1 commit a785f73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nm_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,13 @@ static const char NM_SQL_DRIVES_INSERT_NEW[] =
"INSERT INTO drives(vm_id, drive_name, drive_drv, "
"capacity, boot, discard, format) "
"VALUES((SELECT id FROM vms WHERE name='%s'), "
"'%s_a.img', '%s', %s, %s, %s, '%s')";
"'%s_a.img', '%s', '%s', %s, %s, '%s')";

static const char NM_SQL_DRIVES_INSERT_ADD[] =
"INSERT INTO drives(vm_id, drive_name, drive_drv, "
"capacity, boot, discard, format) "
"VALUES((SELECT id FROM vms WHERE name='%s'), "
"'%s_%c.img', '%s', %s, 0, %s, '%s')";
"'%s_%c.img', '%s', '%s', 0, %s, '%s')";

static const char NM_SQL_DRIVES_INSERT_IMPORTED[] =
"INSERT INTO drives(vm_id, drive_name, drive_drv, "
Expand Down

0 comments on commit a785f73

Please sign in to comment.