mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
res_config_odbc/res_odbc: Fix handling of non-text columns updates with empty values.
This patch fixes setting nullable integer columns to NULL instead of an empty string, which fails for PostgreSQL, for example. The current code is supposed to do so, but the check is broken. The patch also allows the first column in the list to be a nullable integer. This patch also adds a compatibility setting in res_odbc.conf, allow_empty_string_in_nontext. It is enabled by default. It should be disabled for database backends (such as PostgreSQL) that require NULL instead of an empty string for Integer columns. Review: https://reviewboard.asterisk.org/r/3375 (issue ASTERISK-23459) Reported by: zvision patches: res_config_odbc.diff uploaded by zvision (License 5755) ........ Merged revisions 411399 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@411408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -221,4 +221,10 @@ int ast_odbc_clear_cache(const char *database, const char *tablename);
|
||||
*/
|
||||
SQLRETURN ast_odbc_ast_str_SQLGetData(struct ast_str **buf, int pmaxlen, SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, SQLLEN *StrLen_or_Ind);
|
||||
|
||||
/*! \brief Checks if the database natively supports implicit conversion from an empty string to a number (0).
|
||||
* \param obj The ODBC object
|
||||
* \return Returns 1 if the implicit conversion is valid and non-text columns can take empty strings, 0 if the conversion is not valid and NULLs should be used instead '\'
|
||||
*/
|
||||
int ast_odbc_allow_empty_string_in_nontext(struct odbc_obj *obj);
|
||||
|
||||
#endif /* _ASTERISK_RES_ODBC_H */
|
||||
|
||||
Reference in New Issue
Block a user