11use std:: fmt:: Debug ;
22
33/// Errors when initializing a SQL-based backend.
4- #[ cfg( feature = "database " ) ]
4+ #[ cfg( feature = "rusqlite " ) ]
55#[ derive( Debug ) ]
66pub enum SqlInitializationError {
77 /// A file or directory could not be opened or created.
@@ -10,7 +10,7 @@ pub enum SqlInitializationError {
1010 SQL ( rusqlite:: Error ) ,
1111}
1212
13- #[ cfg( feature = "database " ) ]
13+ #[ cfg( feature = "rusqlite " ) ]
1414impl core:: fmt:: Display for SqlInitializationError {
1515 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
1616 match self {
@@ -24,7 +24,7 @@ impl core::fmt::Display for SqlInitializationError {
2424 }
2525}
2626
27- #[ cfg( feature = "database " ) ]
27+ #[ cfg( feature = "rusqlite " ) ]
2828impl std:: error:: Error for SqlInitializationError {
2929 fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
3030 match self {
@@ -34,22 +34,22 @@ impl std::error::Error for SqlInitializationError {
3434 }
3535}
3636
37- #[ cfg( feature = "database " ) ]
37+ #[ cfg( feature = "rusqlite " ) ]
3838impl From < rusqlite:: Error > for SqlInitializationError {
3939 fn from ( value : rusqlite:: Error ) -> Self {
4040 Self :: SQL ( value)
4141 }
4242}
4343
44- #[ cfg( feature = "database " ) ]
44+ #[ cfg( feature = "rusqlite " ) ]
4545impl From < std:: io:: Error > for SqlInitializationError {
4646 fn from ( value : std:: io:: Error ) -> Self {
4747 Self :: IO ( value)
4848 }
4949}
5050
5151/// Errors while reading or writing to and from a SQL-based peer backend.
52- #[ cfg( feature = "database " ) ]
52+ #[ cfg( feature = "rusqlite " ) ]
5353#[ derive( Debug ) ]
5454pub enum SqlPeerStoreError {
5555 /// A consensus critical data structure is malformed.
@@ -60,7 +60,7 @@ pub enum SqlPeerStoreError {
6060 SQL ( rusqlite:: Error ) ,
6161}
6262
63- #[ cfg( feature = "database " ) ]
63+ #[ cfg( feature = "rusqlite " ) ]
6464impl core:: fmt:: Display for SqlPeerStoreError {
6565 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
6666 match self {
@@ -80,7 +80,7 @@ impl core::fmt::Display for SqlPeerStoreError {
8080 }
8181}
8282
83- #[ cfg( feature = "database " ) ]
83+ #[ cfg( feature = "rusqlite " ) ]
8484impl std:: error:: Error for SqlPeerStoreError {
8585 fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
8686 match self {
@@ -91,22 +91,22 @@ impl std::error::Error for SqlPeerStoreError {
9191 }
9292}
9393
94- #[ cfg( feature = "database " ) ]
94+ #[ cfg( feature = "rusqlite " ) ]
9595impl From < rusqlite:: Error > for SqlPeerStoreError {
9696 fn from ( value : rusqlite:: Error ) -> Self {
9797 Self :: SQL ( value)
9898 }
9999}
100100
101- #[ cfg( feature = "database " ) ]
101+ #[ cfg( feature = "rusqlite " ) ]
102102impl From < bitcoin:: consensus:: encode:: Error > for SqlPeerStoreError {
103103 fn from ( value : bitcoin:: consensus:: encode:: Error ) -> Self {
104104 Self :: Deserialize ( value)
105105 }
106106}
107107
108108/// Errors while reading or writing to and from a SQL-based block header backend.
109- #[ cfg( feature = "database " ) ]
109+ #[ cfg( feature = "rusqlite " ) ]
110110#[ derive( Debug ) ]
111111pub enum SqlHeaderStoreError {
112112 /// The headers do not link together.
@@ -117,7 +117,7 @@ pub enum SqlHeaderStoreError {
117117 SQL ( rusqlite:: Error ) ,
118118}
119119
120- #[ cfg( feature = "database " ) ]
120+ #[ cfg( feature = "rusqlite " ) ]
121121impl core:: fmt:: Display for SqlHeaderStoreError {
122122 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
123123 match self {
@@ -134,7 +134,7 @@ impl core::fmt::Display for SqlHeaderStoreError {
134134 }
135135}
136136
137- #[ cfg( feature = "database " ) ]
137+ #[ cfg( feature = "rusqlite " ) ]
138138impl std:: error:: Error for SqlHeaderStoreError {
139139 fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
140140 match self {
@@ -145,14 +145,14 @@ impl std::error::Error for SqlHeaderStoreError {
145145 }
146146}
147147
148- #[ cfg( feature = "database " ) ]
148+ #[ cfg( feature = "rusqlite " ) ]
149149impl From < rusqlite:: Error > for SqlHeaderStoreError {
150150 fn from ( value : rusqlite:: Error ) -> Self {
151151 Self :: SQL ( value)
152152 }
153153}
154154
155- #[ cfg( feature = "database " ) ]
155+ #[ cfg( feature = "rusqlite " ) ]
156156impl From < bitcoin:: consensus:: encode:: Error > for SqlHeaderStoreError {
157157 fn from ( value : bitcoin:: consensus:: encode:: Error ) -> Self {
158158 Self :: Deserialize ( value)
0 commit comments