patch-drivers_freetds_dbd_freetds_c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. $OpenBSD: patch-drivers_freetds_dbd_freetds_c,v 1.2 2017/06/03 16:24:05 steven Exp $
  2. From FreeBSD.
  3. Index: drivers/freetds/dbd_freetds.c
  4. --- drivers/freetds/dbd_freetds.c.orig
  5. +++ drivers/freetds/dbd_freetds.c
  6. @@ -474,6 +474,7 @@ dbi_result_t *dbd_list_tables(dbi_conn_t * conn, const
  7. {
  8. dbi_result_t *res;
  9. char *sql_cmd;
  10. + char *current_db = NULL;
  11. if (db == NULL || db[0] == '\0') {
  12. /* Use current database */
  13. @@ -481,7 +482,6 @@ dbi_result_t *dbd_list_tables(dbi_conn_t * conn, const
  14. return res;
  15. }
  16. - char *current_db = NULL;
  17. if (conn->current_db)
  18. /* Reserved current DB name */
  19. current_db = strdup(conn->current_db);
  20. @@ -529,9 +529,9 @@ size_t dbd_quote_string(dbi_driver_t * driver, const c
  21. {
  22. /* foo's -> 'foo''s' */
  23. size_t len;
  24. + const char *escaped = "\'";
  25. strcpy(dest, "\'");
  26. - const char *escaped = "\'";
  27. len = _dbd_freetds_escape_chars(dest + 1, orig, strlen(orig), escaped);
  28. @@ -580,6 +580,8 @@ dbi_result_t *dbd_query(dbi_conn_t * conn, const char
  29. * everything else will be filled in by DBI */
  30. unsigned int idx = 0;
  31. + unsigned short type = 0;
  32. + unsigned int attribs = 0;
  33. dbi_result_t *result = NULL;
  34. dbi_row_t *row = NULL;
  35. FREETDSCON *tdscon = (FREETDSCON *) conn->connection;
  36. @@ -649,9 +651,6 @@ dbi_result_t *dbd_query(dbi_conn_t * conn, const char
  37. return NULL;
  38. }
  39. - unsigned short type = 0;
  40. - unsigned int attribs = 0;
  41. -
  42. _translate_freetds_type(datafmt[idx], &type, &attribs);
  43. /* Fill fields value in result */
  44. _dbd_result_add_field(result, idx, datafmt[idx]->name, type, attribs);
  45. @@ -976,6 +975,7 @@ dbi_row_t *_dbd_freetds_buffers_binding(dbi_conn_t * c
  46. dbi_row_t *row = NULL;
  47. unsigned int idx = 0;
  48. void *addr = NULL;
  49. + char **orig;
  50. FREETDSCON *tdscon = (FREETDSCON *) conn->connection;
  51. @@ -1003,8 +1003,7 @@ dbi_row_t *_dbd_freetds_buffers_binding(dbi_conn_t * c
  52. dstfmt.format = CS_FMT_UNUSED;
  53. addr = malloc(sizeof(CS_NUMERIC_TYPE));
  54. - char **orig =
  55. - &(result->rows[result->numrows_matched]->field_values[idx].d_string);
  56. + orig = &(result->rows[result->numrows_matched]->field_values[idx].d_string);
  57. if (cs_convert(tdscon->ctx, datafmt[idx], *orig, &dstfmt, addr, NULL) !=
  58. CS_SUCCEED) {