Procházet zdrojové kódy

db_con internals changed a little bit

Jan Janak před 23 roky
rodič
revize
f82caf56d0
8 změnil soubory, kde provedl 20 přidání a 23 odebrání
  1. 8 8
      db/db.c
  2. 1 1
      db/db.h
  3. 6 9
      db/db_con.h
  4. 1 1
      db/db_key.h
  5. 1 1
      db/db_res.h
  6. 1 1
      db/db_row.h
  7. 1 1
      db/db_val.h
  8. 1 1
      db/example/README

+ 8 - 8
db/db.c

@@ -10,27 +10,27 @@ db_func_t dbf;
 
 int bind_dbmod(void)
 {
-	dbf.use_table = (db_use_table_f)find_export("db_use_table", 2);
+	dbf.use_table = (db_use_table_f)find_export("~db_use_table", 2);
 
-	dbf.init = (db_init_f)find_export("db_init", 1);
+	dbf.init = (db_init_f)find_export("~db_init", 1);
 	if (!dbf.init) return -1;
 
-	dbf.close = (db_close_f)find_export("db_close", 2);
+	dbf.close = (db_close_f)find_export("~db_close", 2);
 	if (!dbf.close) return -1;
 
-	dbf.query = (db_query_f)find_export("db_query", 2);
+	dbf.query = (db_query_f)find_export("~db_query", 2);
 	if (!dbf.query) return -1;
 
-	dbf.free_query = (db_free_query_f)find_export("db_free_query", 2);
+	dbf.free_query = (db_free_query_f)find_export("~db_free_query", 2);
 	if (!dbf.free_query) return -1;
 
-	dbf.insert = (db_insert_f)find_export("db_insert", 2);
+	dbf.insert = (db_insert_f)find_export("~db_insert", 2);
 	if (!dbf.insert) return -1;
 
-	dbf.delete = (db_delete_f)find_export("db_delete", 2);
+	dbf.delete = (db_delete_f)find_export("~db_delete", 2);
 	if (!dbf.delete) return -1;
 
-	dbf.update = (db_update_f)find_export("db_update", 2);
+	dbf.update = (db_update_f)find_export("~db_update", 2);
 	if (!dbf.update) return -1;
 
 	return 0;

+ 1 - 1
db/db.h

@@ -128,4 +128,4 @@ extern db_func_t dbf;
 int bind_dbmod(void);
  
 
-#endif
+#endif /* DB_H */

+ 6 - 9
db/db_con.h

@@ -13,22 +13,19 @@
  * handle
  */
 typedef struct {
-	char* table;    /* Default table to use */
-	void* con;      /* Mysql Connection */
-	void* res;      /* Result of previous operation */
-	void* row;      /* Actual row in the result */
-	int connected;
+	char* table;           /* Default table to use */
+	int connected;         /* 1 if database is connected */
+	unsigned char tail[0]; /* Variable length tail
+				* database module specific */    
 } db_con_t;
 
 
 #define CON_CONNECTED(cn)  ((cn)->connected)
 #define CON_TABLE(cn)      ((cn)->table)
-#define CON_CONNECTION(cn) ((cn)->con)
-#define CON_RESULT(cn)     ((cn)->res)
-#define CON_ROW(cn)        ((cn)->row)
+#define CON_TAIL(cn)       ((cn)->tail)
 
 
 int use_table(db_con_t* _h, const char* _t);
 
 
-#endif
+#endif /* DB_CON_H */

+ 1 - 1
db/db_key.h

@@ -12,4 +12,4 @@
 typedef const char* db_key_t;
 
 
-#endif
+#endif /* DB_KEY_H */

+ 1 - 1
db/db_res.h

@@ -50,4 +50,4 @@ int convert_result(db_con_t* _h, db_res_t* _r);
 int free_result(db_res_t* _r);
 
 
-#endif
+#endif /* DB_RES_H */

+ 1 - 1
db/db_row.h

@@ -29,4 +29,4 @@ int convert_row(db_con_t* _h, struct db_res* _res, db_row_t* _r);
 int free_row(db_row_t* _r);
 
 
-#endif
+#endif /* DB_ROW_H */

+ 1 - 1
db/db_val.h

@@ -65,4 +65,4 @@ int str2val(db_type_t _t, db_val_t* _v, const char* _s, int _l);
 int val2str(db_val_t* _v, char* _s, int* _len);
 
 
-#endif
+#endif /* DB_VAL_H */

+ 1 - 1
db/example/README

@@ -1,6 +1,6 @@
 $Id$
 
-This is very simple example module that shows, how to
+This is very simple example module that shows how to
 use database interface.
 
 If you want to compile this module, move it to modules