Skip to content

Commit

Permalink
Fix initializer type for MADB_ErrorList
Browse files Browse the repository at this point in the history
The initializer { 0, 0, 0, -1 } results in an error entry of,
 {SqlState = "\000\000\000\377\000",
  SqlStateV2 = "\000\000\000\000\000",
  SqlErrorMsg = '\000' <repeats 512 times>,
  ReturnValue = 0}

The reason is that integers are converted to char initializers in the
SqlState char array and the remainder is set to 0. Instead, we should
use compatible types so no implicit conversion occurs. With this, the
entry becomes,

 {SqlState = "\000\000\000\000\000",
  SqlStateV2 = "\000\000\000\000\000",
  SqlErrorMsg = '\000' <repeats 512 times>,
  ReturnValue = -1}
  • Loading branch information
AdamMajer authored and lawrinn committed Oct 12, 2020
1 parent fc3b2fc commit 240fbc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ma_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ MADB_ERROR MADB_ErrorList[] =
{ "S1000", "", "General error", SQL_ERROR},
{ "S1107", "", "Row value out of range", SQL_ERROR},
{ "S1C00", "", "Optional feature not implemented", SQL_ERROR},
{ 0,0,0, -1}
{ "", "", "", -1}
};
/* }}} */

Expand Down

0 comments on commit 240fbc7

Please sign in to comment.