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 5fe4fb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
unreleased
------------------------
- Feature: image format type support: qcow2 and raw
- Bugfix: fix import on some locales

v3.3.1 - 19.02.2024
------------------------
Expand Down
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 5fe4fb2

Please sign in to comment.