From 5fe4fb296ed2dafd46d2fcf418503ac35f13ec68 Mon Sep 17 00:00:00 2001 From: Pavel Balaev Date: Wed, 6 Nov 2024 15:01:52 +0300 Subject: [PATCH] import: fix comma in capacity 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 --- CHANGES | 1 + src/nm_database.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 3c3820e..9ab6e82 100644 --- a/CHANGES +++ b/CHANGES @@ -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 ------------------------ diff --git a/src/nm_database.h b/src/nm_database.h index 530ad4c..0423aa9 100644 --- a/src/nm_database.h +++ b/src/nm_database.h @@ -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, "