浏览代码

- Convenience macros for checking database capability vector

Jan Janak 21 年之前
父节点
当前提交
08375c1cf2
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. 14 1
      db/db_cap.h

+ 14 - 1
db/db_cap.h

@@ -39,6 +39,19 @@ typedef enum db_cap {
 	DB_CAP_DELETE =    1 << 3,  /* Database driver can delete data from database */
 	DB_CAP_UPDATE =    1 << 4   /* Database driver can update data in the database */
 } db_cap_t;
-	
+
+
+/*
+ * All database functions except raw_query
+ */
+#define DB_CAP_ALL (DB_CAP_QUERY | DB_CAP_INSERT | DB_CAP_DELETE | DB_CAP_UPDATE)	
+
+
+/*
+ * True if all the capabilities in cpv are supported by module
+ * represented by dbf, false otherwise
+ */
+#define DB_CAPABILITY(dbf, cpv) ((dbf)->cap & (cpv)) == (cpv))
+
 
 #endif /* DB_CAP_H */