mirror of
				https://github.com/isar/rusqlite.git
				synced 2025-10-31 22:08:55 +08:00 
			
		
		
		
	Remove vtab() function from VTabCursor trait
This commit is contained in:
		| @@ -126,9 +126,6 @@ impl ArrayTabCursor { | |||||||
| impl VTabCursor for ArrayTabCursor { | impl VTabCursor for ArrayTabCursor { | ||||||
|     type Table = ArrayTab; |     type Table = ArrayTab; | ||||||
|  |  | ||||||
|     fn vtab(&self) -> &ArrayTab { |  | ||||||
|         unsafe { &*(self.base.pVtab as *const ArrayTab) } |  | ||||||
|     } |  | ||||||
|     fn filter(&mut self, idx_num: c_int, _idx_str: Option<&str>, args: &Values) -> Result<()> { |     fn filter(&mut self, idx_num: c_int, _idx_str: Option<&str>, args: &Values) -> Result<()> { | ||||||
|         if idx_num > 0 { |         if idx_num > 0 { | ||||||
|             self.ptr = try!(args.get_array(0)); |             self.ptr = try!(args.get_array(0)); | ||||||
|   | |||||||
| @@ -272,15 +272,16 @@ impl CSVTabCursor { | |||||||
|             eof: false, |             eof: false, | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /// Accessor to the associated virtual table. | ||||||
|  |     fn vtab(&self) -> &CSVTab { | ||||||
|  |         unsafe { &*(self.base.pVtab as *const CSVTab) } | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| impl VTabCursor for CSVTabCursor { | impl VTabCursor for CSVTabCursor { | ||||||
|     type Table = CSVTab; |     type Table = CSVTab; | ||||||
|  |  | ||||||
|     fn vtab(&self) -> &CSVTab { |  | ||||||
|         unsafe { &*(self.base.pVtab as *const CSVTab) } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // Only a full table scan is supported.  So `filter` simply rewinds to |     // Only a full table scan is supported.  So `filter` simply rewinds to | ||||||
|     // the beginning. |     // the beginning. | ||||||
|     fn filter(&mut self, _idx_num: c_int, _idx_str: Option<&str>, _args: &Values) -> Result<()> { |     fn filter(&mut self, _idx_num: c_int, _idx_str: Option<&str>, _args: &Values) -> Result<()> { | ||||||
|   | |||||||
| @@ -324,8 +324,6 @@ impl<'a> OrderBy<'a> { | |||||||
| /// Virtual table cursor trait. | /// Virtual table cursor trait. | ||||||
| pub trait VTabCursor: Sized { | pub trait VTabCursor: Sized { | ||||||
|     type Table: VTab; |     type Table: VTab; | ||||||
|     /// Accessor to the associated virtual table. |  | ||||||
|     fn vtab(&self) -> &Self::Table; |  | ||||||
|     /// Begin a search of a virtual table. |     /// Begin a search of a virtual table. | ||||||
|     fn filter(&mut self, idx_num: c_int, idx_str: Option<&str>, args: &Values) -> Result<()>; |     fn filter(&mut self, idx_num: c_int, idx_str: Option<&str>, args: &Values) -> Result<()>; | ||||||
|     /// Advance cursor to the next row of a result set initiated by `filter`. |     /// Advance cursor to the next row of a result set initiated by `filter`. | ||||||
|   | |||||||
| @@ -182,9 +182,6 @@ impl SeriesTabCursor { | |||||||
| impl VTabCursor for SeriesTabCursor { | impl VTabCursor for SeriesTabCursor { | ||||||
|     type Table = SeriesTab; |     type Table = SeriesTab; | ||||||
|  |  | ||||||
|     fn vtab(&self) -> &SeriesTab { |  | ||||||
|         unsafe { &*(self.base.pVtab as *const SeriesTab) } |  | ||||||
|     } |  | ||||||
|     fn filter(&mut self, idx_num: c_int, _idx_str: Option<&str>, args: &Values) -> Result<()> { |     fn filter(&mut self, idx_num: c_int, _idx_str: Option<&str>, args: &Values) -> Result<()> { | ||||||
|         let idx_num = QueryPlanFlags::from_bits_truncate(idx_num); |         let idx_num = QueryPlanFlags::from_bits_truncate(idx_num); | ||||||
|         let mut i = 0; |         let mut i = 0; | ||||||
|   | |||||||
| @@ -57,9 +57,6 @@ fn test_dummy_module() { | |||||||
|     impl VTabCursor for DummyTabCursor { |     impl VTabCursor for DummyTabCursor { | ||||||
|         type Table = DummyTab; |         type Table = DummyTab; | ||||||
|  |  | ||||||
|         fn vtab(&self) -> &DummyTab { |  | ||||||
|             unsafe { &*(self.base.pVtab as *const DummyTab) } |  | ||||||
|         } |  | ||||||
|         fn filter( |         fn filter( | ||||||
|             &mut self, |             &mut self, | ||||||
|             _idx_num: c_int, |             _idx_num: c_int, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user