@@ -142,7 +142,7 @@ where
142142 > ,
143143 Eq < columns:: table_name , & ' a String > ,
144144 > ,
145- Eq < columns:: table_schema , String > ,
145+ Eq < columns:: table_schema , Cow < ' a , String > > ,
146146 > ,
147147 columns:: ordinal_position ,
148148 > : QueryFragment < Conn :: Backend > ,
@@ -183,7 +183,7 @@ where
183183 > ,
184184 Eq < key_column_usage:: table_name , & ' a String > ,
185185 > ,
186- Eq < key_column_usage:: table_schema , String > ,
186+ Eq < key_column_usage:: table_schema , Cow < ' a , String > > ,
187187 > ,
188188 key_column_usage:: ordinal_position ,
189189 > : QueryFragment < Conn :: Backend > ,
@@ -209,32 +209,31 @@ where
209209 . load ( conn)
210210}
211211
212- pub fn load_table_names < Conn > (
212+ pub fn load_table_names < ' a , Conn > (
213213 connection : & Conn ,
214- schema_name : Option < & str > ,
214+ schema_name : Option < & ' a str > ,
215215) -> Result < Vec < TableName > , Box < dyn Error > >
216216where
217217 Conn : Connection ,
218218 Conn :: Backend : UsesInformationSchema ,
219219 String : FromSql < sql_types:: Text , Conn :: Backend > ,
220- Order <
220+ Filter <
221221 Filter <
222222 Filter <
223- Filter <
224- Select < tables:: table , ( tables:: table_name , tables:: table_schema ) > ,
225- Eq < tables:: table_schema , String > ,
226- > ,
227- NotLike < tables:: table_name , & ' static str > ,
223+ Select < tables:: table , tables:: table_name > ,
224+ Eq < tables:: table_schema , Cow < ' a , str > > ,
228225 > ,
229- Like < tables:: table_type , & ' static str > ,
226+ NotLike < tables:: table_name , & ' static str > ,
230227 > ,
231- tables:: table_name ,
228+ Like < tables:: table_type , & ' static str > ,
232229 > : QueryFragment < Conn :: Backend > ,
233230{
234231 use self :: information_schema:: tables:: dsl:: * ;
235232
236233 let default_schema = Conn :: Backend :: default_schema ( connection) ?;
237- let db_schema_name = schema_name. unwrap_or ( & default_schema) ;
234+ let db_schema_name = schema_name
235+ . map ( Cow :: Borrowed )
236+ . unwrap_or_else ( || Cow :: Owned ( default_schema. clone ( ) ) ) ;
238237
239238 let mut table_names = tables
240239 . select ( table_name)
@@ -272,7 +271,7 @@ where
272271 table_constraints:: table ,
273272 Eq < table_constraints:: constraint_type , & ' static str > ,
274273 > ,
275- Eq < table_constraints:: table_schema , String > ,
274+ Eq < table_constraints:: table_schema , Cow < ' a , str > > ,
276275 > ,
277276 referential_constraints:: table ,
278277 And <
@@ -323,7 +322,9 @@ where
323322 use self :: information_schema:: table_constraints as tc;
324323
325324 let default_schema = Conn :: Backend :: default_schema ( connection) ?;
326- let schema_name = schema_name. unwrap_or ( & default_schema) ;
325+ let schema_name = schema_name
326+ . map ( Cow :: Borrowed )
327+ . unwrap_or_else ( || Cow :: Owned ( default_schema. clone ( ) ) ) ;
327328
328329 let constraint_names = tc:: table
329330 . filter ( tc:: constraint_type. eq ( "FOREIGN KEY" ) )
0 commit comments