File tree Expand file tree Collapse file tree 5 files changed +29
-0
lines changed
Expand file tree Collapse file tree 5 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,10 @@ impl crate::statement::Stmt for crate::hrana::Statement<HttpSender> {
234234 Some ( & named_param. name )
235235 }
236236
237+ fn column_count ( & self ) -> usize {
238+ self . cols . len ( )
239+ }
240+
237241 fn columns ( & self ) -> Vec < crate :: Column > {
238242 //FIXME: there are several blockers here:
239243 // 1. We cannot know the column types before sending a query, so this method will never return results right
Original file line number Diff line number Diff line change @@ -145,6 +145,10 @@ impl Stmt for LibsqlStmt {
145145 self . 0 . parameter_name ( idx)
146146 }
147147
148+ fn column_count ( & self ) -> usize {
149+ self . 0 . column_count ( )
150+ }
151+
148152 fn columns ( & self ) -> Vec < Column > {
149153 self . 0 . columns ( )
150154 }
Original file line number Diff line number Diff line change @@ -779,6 +779,16 @@ impl Stmt for RemoteStatement {
779779 }
780780 }
781781
782+ fn column_count ( & self ) -> usize {
783+ if let Some ( stmt) = self . local_statement . as_ref ( ) {
784+ return stmt. column_count ( ) ;
785+ }
786+ match self . metas . first ( ) {
787+ Some ( meta) => meta. columns . len ( ) ,
788+ None => 0 ,
789+ }
790+ }
791+
782792 fn columns ( & self ) -> Vec < Column > {
783793 if let Some ( stmt) = self . local_statement . as_ref ( ) {
784794 return stmt. columns ( ) ;
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ pub(crate) trait Stmt {
2222
2323 fn parameter_name ( & self , idx : i32 ) -> Option < & str > ;
2424
25+ fn column_count ( & self ) -> usize ;
26+
2527 fn columns ( & self ) -> Vec < Column > ;
2628}
2729
@@ -95,6 +97,11 @@ impl Statement {
9597 self . inner . parameter_name ( idx)
9698 }
9799
100+ /// Fetch the number of columns for the prepared statement.
101+ pub fn column_count ( & self ) -> usize {
102+ self . inner . column_count ( )
103+ }
104+
98105 /// Fetch the list of columns for the prepared statement.
99106 pub fn columns ( & self ) -> Vec < Column > {
100107 self . inner . columns ( )
Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ impl Stmt for SyncedStatement {
5656 self . inner . parameter_name ( idx)
5757 }
5858
59+ fn column_count ( & self ) -> usize {
60+ self . inner . column_count ( )
61+ }
62+
5963 fn columns ( & self ) -> Vec < Column > {
6064 self . inner . columns ( )
6165 }
You can’t perform that action at this time.
0 commit comments