Ticket Hash: | 4a791e70abdcefb9ede49e10c1d2b55918c30ff6 | |||
Title: | SQLiteDataAdapter disposes external SelectCommand | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Important | Priority: | NextRelease | |
Subsystem: | Data_Adapter | Resolution: | Fixed | |
Last Modified: | 2013-04-10 07:17:39 | |||
Version Found In: | 1.0.84 | |||
User Comments: | ||||
anonymous added on 2013-04-09 07:04:48:
(text/x-fossil-plain)
I have this code: /// <summary> /// Initializes the query for getting the serial numbers for an account id /// </summary> private void device_GetIndexes_Initialize() { command_device_GetIndexes = new SQLiteCommand( @"SELECT i.reg_type ||' ' || i.reg_id as REG_ID, i.index_value, i.tariff_id, i.dec_before||'.'||i.dec_after as WHEELS, i.mhy_seq, '' as NEW_WHEELS, i.last_index, i.last_date, i.prev_period_index, i.prev_period_date, i.prevmonthofprevperiodindex, i.prevmonthofprevperioddate, i.retries, i.reg_type FROM pda_indexes i WHERE i.dve_seq=:dve_seq ORDER BY i.reg_order ", litedb); param_device_GetIndexes_dve_seq = new SQLiteParameter("dve_seq"); command_device_GetIndexes.Parameters.Add(param_device_GetIndexes_dve_seq); } internal DataTable device_GetIndexes(long dve_seq) { if (command_device_GetIndexes == null) device_GetIndexes_Initialize(); param_device_GetIndexes_dve_seq.Value = dve_seq; DataTable dt = new DataTable(); dt.TableName = "INDEXES"; using ( SQLiteDataAdapter adapter = new SQLiteDataAdapter(command_device_GetIndexes) ) { adapter.Fill(dt); return dt; } } The first time it is executed, it will make a new command and a parameter. The second time it will reuse the prepared statement and just change the value of the parameter. This worked fine in 1.0.82. But in 1.0.84 the dispose of the SQLiteDataAdapter seems to dispose my SQLiteCommand as well! I don't think it should do this in case I pass a SQLiteCommand as constructor to the SQLiteDataAdapter (I want to reuse the command). mistachkin added on 2013-04-09 21:10:47: (text/x-fossil-plain) This will be fixed prior to the 1.0.85.0 release. mistachkin added on 2013-04-09 22:35:26: (text/x-fossil-plain) Preliminary fix checked-in [89a866c1e8] on trunk. mistachkin added on 2013-04-10 07:17:39: (text/x-fossil-plain) Test added on trunk by check-in [f11d1e6b74]. |