File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -146,10 +146,7 @@ impl Inserter<&str> for FlatVector {
146
146
147
147
impl Inserter < & String > for FlatVector {
148
148
fn insert ( & self , index : usize , value : & String ) {
149
- let cstr = CString :: new ( value. as_bytes ( ) ) . unwrap ( ) ;
150
- unsafe {
151
- duckdb_vector_assign_string_element ( self . ptr , index as u64 , cstr. as_ptr ( ) ) ;
152
- }
149
+ self . insert ( index, value. as_str ( ) ) ;
153
150
}
154
151
}
155
152
@@ -170,16 +167,7 @@ impl Inserter<&[u8]> for FlatVector {
170
167
171
168
impl Inserter < & Vec < u8 > > for FlatVector {
172
169
fn insert ( & self , index : usize , value : & Vec < u8 > ) {
173
- let value_size = value. len ( ) ;
174
- unsafe {
175
- // This function also works for binary data. https://duckdb.org/docs/api/c/api#duckdb_vector_assign_string_element_len
176
- duckdb_vector_assign_string_element_len (
177
- self . ptr ,
178
- index as u64 ,
179
- value. as_ptr ( ) as * const :: std:: os:: raw:: c_char ,
180
- value_size as u64 ,
181
- ) ;
182
- }
170
+ self . insert ( index, value. as_slice ( ) ) ;
183
171
}
184
172
}
185
173
You can’t perform that action at this time.
0 commit comments