@miatechnet/node-odbc 2.4.16 → 2.4.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@miatechnet/node-odbc",
3
3
  "description": "unixodbc bindings for node - Fork with multi-result set support for stored procedures",
4
- "version": "2.4.16",
4
+ "version": "2.4.17",
5
5
  "homepage": "https://github.com/ppimentela/node-odbc/",
6
6
  "main": "lib/odbc.js",
7
7
  "types": "lib/odbc.d.ts",
@@ -1906,8 +1906,9 @@ class CallProcedureAsyncWorker : public ODBCAsyncWorker {
1906
1906
  }
1907
1907
 
1908
1908
  // Save the result set with column metadata to allResultSets
1909
+ // Use swap/move to transfer ownership and prevent double-free
1909
1910
  ResultSetData rsData;
1910
- rsData.rows = data->storedRows;
1911
+ rsData.rows.swap(data->storedRows); // Transfer ownership of rows vector
1911
1912
  rsData.columns = data->columns;
1912
1913
  rsData.column_count = data->column_count;
1913
1914
  rsData.bound_columns = data->bound_columns;
@@ -1916,8 +1917,7 @@ class CallProcedureAsyncWorker : public ODBCAsyncWorker {
1916
1917
 
1917
1918
  data->allResultSets.push_back(rsData);
1918
1919
 
1919
- // Clear storedRows and reset pointers (don't free, they're now in allResultSets)
1920
- data->storedRows.clear();
1920
+ // Reset pointers to NULL (ownership transferred to allResultSets)
1921
1921
  data->columns = NULL;
1922
1922
  data->column_count = 0;
1923
1923
  data->bound_columns = NULL;
@@ -1934,6 +1934,11 @@ class CallProcedureAsyncWorker : public ODBCAsyncWorker {
1934
1934
  SetError("[odbc] Error getting more results\0");
1935
1935
  return;
1936
1936
  }
1937
+
1938
+ // Set fetch size for the next result set
1939
+ if (hasMoreResults) {
1940
+ set_fetch_size(data, data->fetch_size);
1941
+ }
1937
1942
  }
1938
1943
  }
1939
1944
 
@@ -1951,8 +1956,9 @@ class CallProcedureAsyncWorker : public ODBCAsyncWorker {
1951
1956
  for (size_t rs_index = 0; rs_index < data->allResultSets.size(); rs_index++) {
1952
1957
  ResultSetData &rsData = data->allResultSets[rs_index];
1953
1958
 
1954
- // Restore column metadata and rows for this result set
1955
- data->storedRows = rsData.rows;
1959
+ // Transfer ownership of rows and column metadata for processing
1960
+ // Use swap to ensure proper ownership transfer
1961
+ data->storedRows.swap(rsData.rows);
1956
1962
  data->columns = rsData.columns;
1957
1963
  data->column_count = rsData.column_count;
1958
1964
  data->bound_columns = rsData.bound_columns;
@@ -1966,8 +1972,7 @@ class CallProcedureAsyncWorker : public ODBCAsyncWorker {
1966
1972
 
1967
1973
  allResults.Set(rs_index, singleResult);
1968
1974
 
1969
- // Mark rows as processed (process_data_for_napi frees them internally)
1970
- data->allResultSets[rs_index].rows.clear();
1975
+ // After process_data_for_napi, rows are freed and storedRows is cleared
1971
1976
  // Mark columns as processed to prevent double-free
1972
1977
  data->allResultSets[rs_index].columns = NULL;
1973
1978
  data->allResultSets[rs_index].bound_columns = NULL;