@@ -21,6 +21,7 @@ use alloc::{
21
21
boxed:: Box ,
22
22
format,
23
23
string:: { String , ToString } ,
24
+ vec,
24
25
vec:: Vec ,
25
26
} ;
26
27
use helpers:: {
@@ -3029,14 +3030,6 @@ impl Display for Set {
3029
3030
}
3030
3031
}
3031
3032
3032
- /// Convert a `Set` into a `Statement`.
3033
- /// Convenience function, instead of writing `Statement::Set(Set::Set...{...})`
3034
- impl From < Set > for Statement {
3035
- fn from ( set : Set ) -> Self {
3036
- Statement :: Set ( set)
3037
- }
3038
- }
3039
-
3040
3033
/// A representation of a `WHEN` arm with all the identifiers catched and the statements to execute
3041
3034
/// for the arm.
3042
3035
///
@@ -10707,6 +10700,204 @@ impl fmt::Display for VacuumStatement {
10707
10700
}
10708
10701
}
10709
10702
10703
+ impl From < Set > for Statement {
10704
+ fn from ( s : Set ) -> Self {
10705
+ Self :: Set ( s)
10706
+ }
10707
+ }
10708
+
10709
+ impl From < Query > for Statement {
10710
+ fn from ( q : Query ) -> Self {
10711
+ Box :: new ( q) . into ( )
10712
+ }
10713
+ }
10714
+
10715
+ impl From < Box < Query > > for Statement {
10716
+ fn from ( q : Box < Query > ) -> Self {
10717
+ Self :: Query ( q)
10718
+ }
10719
+ }
10720
+
10721
+ impl From < Insert > for Statement {
10722
+ fn from ( i : Insert ) -> Self {
10723
+ Self :: Insert ( i)
10724
+ }
10725
+ }
10726
+
10727
+ impl From < CaseStatement > for Statement {
10728
+ fn from ( c : CaseStatement ) -> Self {
10729
+ Self :: Case ( c)
10730
+ }
10731
+ }
10732
+
10733
+ impl From < IfStatement > for Statement {
10734
+ fn from ( i : IfStatement ) -> Self {
10735
+ Self :: If ( i)
10736
+ }
10737
+ }
10738
+
10739
+ impl From < WhileStatement > for Statement {
10740
+ fn from ( w : WhileStatement ) -> Self {
10741
+ Self :: While ( w)
10742
+ }
10743
+ }
10744
+
10745
+ impl From < RaiseStatement > for Statement {
10746
+ fn from ( r : RaiseStatement ) -> Self {
10747
+ Self :: Raise ( r)
10748
+ }
10749
+ }
10750
+
10751
+ impl From < Function > for Statement {
10752
+ fn from ( f : Function ) -> Self {
10753
+ Self :: Call ( f)
10754
+ }
10755
+ }
10756
+
10757
+ impl From < OpenStatement > for Statement {
10758
+ fn from ( o : OpenStatement ) -> Self {
10759
+ Self :: Open ( o)
10760
+ }
10761
+ }
10762
+
10763
+ impl From < Delete > for Statement {
10764
+ fn from ( d : Delete ) -> Self {
10765
+ Self :: Delete ( d)
10766
+ }
10767
+ }
10768
+
10769
+ impl From < CreateTable > for Statement {
10770
+ fn from ( c : CreateTable ) -> Self {
10771
+ Self :: CreateTable ( c)
10772
+ }
10773
+ }
10774
+
10775
+ impl From < CreateIndex > for Statement {
10776
+ fn from ( c : CreateIndex ) -> Self {
10777
+ Self :: CreateIndex ( c)
10778
+ }
10779
+ }
10780
+
10781
+ impl From < CreateServerStatement > for Statement {
10782
+ fn from ( c : CreateServerStatement ) -> Self {
10783
+ Self :: CreateServer ( c)
10784
+ }
10785
+ }
10786
+
10787
+ impl From < CreateConnector > for Statement {
10788
+ fn from ( c : CreateConnector ) -> Self {
10789
+ Self :: CreateConnector ( c)
10790
+ }
10791
+ }
10792
+
10793
+ impl From < AlterSchema > for Statement {
10794
+ fn from ( a : AlterSchema ) -> Self {
10795
+ Self :: AlterSchema ( a)
10796
+ }
10797
+ }
10798
+
10799
+ impl From < AlterType > for Statement {
10800
+ fn from ( a : AlterType ) -> Self {
10801
+ Self :: AlterType ( a)
10802
+ }
10803
+ }
10804
+
10805
+ impl From < DropDomain > for Statement {
10806
+ fn from ( d : DropDomain ) -> Self {
10807
+ Self :: DropDomain ( d)
10808
+ }
10809
+ }
10810
+
10811
+ impl From < ShowCharset > for Statement {
10812
+ fn from ( s : ShowCharset ) -> Self {
10813
+ Self :: ShowCharset ( s)
10814
+ }
10815
+ }
10816
+
10817
+ impl From < ShowObjects > for Statement {
10818
+ fn from ( s : ShowObjects ) -> Self {
10819
+ Self :: ShowObjects ( s)
10820
+ }
10821
+ }
10822
+
10823
+ impl From < Use > for Statement {
10824
+ fn from ( u : Use ) -> Self {
10825
+ Self :: Use ( u)
10826
+ }
10827
+ }
10828
+
10829
+ impl From < CreateFunction > for Statement {
10830
+ fn from ( c : CreateFunction ) -> Self {
10831
+ Self :: CreateFunction ( c)
10832
+ }
10833
+ }
10834
+
10835
+ impl From < CreateTrigger > for Statement {
10836
+ fn from ( c : CreateTrigger ) -> Self {
10837
+ Self :: CreateTrigger ( c)
10838
+ }
10839
+ }
10840
+
10841
+ impl From < DropTrigger > for Statement {
10842
+ fn from ( d : DropTrigger ) -> Self {
10843
+ Self :: DropTrigger ( d)
10844
+ }
10845
+ }
10846
+
10847
+ impl From < DenyStatement > for Statement {
10848
+ fn from ( d : DenyStatement ) -> Self {
10849
+ Self :: Deny ( d)
10850
+ }
10851
+ }
10852
+
10853
+ impl From < CreateDomain > for Statement {
10854
+ fn from ( c : CreateDomain ) -> Self {
10855
+ Self :: CreateDomain ( c)
10856
+ }
10857
+ }
10858
+
10859
+ impl From < RenameTable > for Statement {
10860
+ fn from ( r : RenameTable ) -> Self {
10861
+ vec ! [ r] . into ( )
10862
+ }
10863
+ }
10864
+
10865
+ impl From < Vec < RenameTable > > for Statement {
10866
+ fn from ( r : Vec < RenameTable > ) -> Self {
10867
+ Self :: RenameTable ( r)
10868
+ }
10869
+ }
10870
+
10871
+ impl From < PrintStatement > for Statement {
10872
+ fn from ( p : PrintStatement ) -> Self {
10873
+ Self :: Print ( p)
10874
+ }
10875
+ }
10876
+
10877
+ impl From < ReturnStatement > for Statement {
10878
+ fn from ( r : ReturnStatement ) -> Self {
10879
+ Self :: Return ( r)
10880
+ }
10881
+ }
10882
+
10883
+ impl From < ExportData > for Statement {
10884
+ fn from ( e : ExportData ) -> Self {
10885
+ Self :: ExportData ( e)
10886
+ }
10887
+ }
10888
+
10889
+ impl From < CreateUser > for Statement {
10890
+ fn from ( c : CreateUser ) -> Self {
10891
+ Self :: CreateUser ( c)
10892
+ }
10893
+ }
10894
+
10895
+ impl From < VacuumStatement > for Statement {
10896
+ fn from ( v : VacuumStatement ) -> Self {
10897
+ Self :: Vacuum ( v)
10898
+ }
10899
+ }
10900
+
10710
10901
#[ cfg( test) ]
10711
10902
mod tests {
10712
10903
use crate :: tokenizer:: Location ;
0 commit comments