soci
soci copied to clipboard
Firebird backend prevents you from inserting values larger than the designed field length
Firebird backend prevents you from inserting values larger than the designed field length For example if you have a VARCHAR(20) for a field, an exception will be thrown if you try to insert more than 20 characters, that control is made by SOCI itself not Firebird server, whereas it should be optional like a global define variable like: FB_TRUNCATE_CHAR to set or not. Because normally Firebird automatically truncates chars.
Thank you for your understanding.
FWIW I think the current behaviour is desirable and the unit tests explicitly check for it and warn about what I consider to be a bug in the MySQL backend which does silently truncate data.
I have no idea why would anybody want this to happen, but if there is a good reason to do this, it should definitely be "opt-in", i.e. you should need to call some enable_silent_string_truncation()
to make this happen -- and personally I'm just not interested in implementing this at all.
The problem is that I should explicitly limit any user input control (wxTextEntry
) max length to that filed designed VARCHAR length or I will get a soci_error
exception, and because I am silently eating all the exceptions, then nothing will happen at all, and the use won't notice that his desired data entry has NOT been inserted into the table.
because I am silently eating all the exceptions
Err, yes, that's the problem, right here. You probably/arguably/definitely/absolutely should fix this.
because I am silently eating all the exceptions
Err, yes, that's the problem, right here. You probably/arguably/definitely/absolutely should fix this.
Do you mean, I should expose all the thrown soci_error
to the end user via a wxLogError
?
If so, then the majority of the end users won't pay attention to the thrown error messages, they just think that it is an error related to the application, and that's why I am silently eating these thrown exceptions.
I don't know the details of what you're doing, but you need to do something about the exceptions raised when writing into the database. Showing a message box, as wxLogError()
does by default, is not the best UI, but you could display the problem in some different way in your UI. The point is that the exception is how you know about the problem in the first place and you can't just throw it away without doing anything with it.