r17450 - gnucash/trunk/src - 1) Rename col_type_handler_t -> GncSqlColumnTypeHandler

Phil Longstaff plongstaff at cvs.gnucash.org
Sat Aug 2 14:57:13 EDT 2008


Author: plongstaff
Date: 2008-08-02 14:57:13 -0400 (Sat, 02 Aug 2008)
New Revision: 17450
Trac: http://svn.gnucash.org/trac/changeset/17450

Modified:
   gnucash/trunk/src/backend/sql/gnc-account-sql.c
   gnucash/trunk/src/backend/sql/gnc-backend-sql.c
   gnucash/trunk/src/backend/sql/gnc-backend-sql.h
   gnucash/trunk/src/backend/sql/gnc-commodity-sql.c
   gnucash/trunk/src/backend/sql/gnc-lots-sql.c
   gnucash/trunk/src/backend/sql/gnc-transaction-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-owner-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c
Log:
1) Rename col_type_handler_t -> GncSqlColumnTypeHandler
2) More doxygen comments



Modified: gnucash/trunk/src/backend/sql/gnc-account-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-account-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/backend/sql/gnc-account-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -341,7 +341,7 @@
     }
 }
 
-static col_type_handler_t account_guid_handler
+static GncSqlColumnTypeHandler account_guid_handler
 	= { load_account_guid,
 		gnc_sql_add_objectref_guid_col_info_to_list,
 		gnc_sql_add_colname_to_list,

Modified: gnucash/trunk/src/backend/sql/gnc-backend-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-backend-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/backend/sql/gnc-backend-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -989,7 +989,7 @@
 	(*pList) = g_slist_append( (*pList), value );
 }
 
-static col_type_handler_t string_handler
+static GncSqlColumnTypeHandler string_handler
     = { load_string,
 		add_string_col_info_to_list,
 		gnc_sql_add_colname_to_list,
@@ -1072,7 +1072,7 @@
 	(*pList) = g_slist_append( (*pList), value );
 }
 
-static col_type_handler_t int_handler
+static GncSqlColumnTypeHandler int_handler
 	= { load_int,
 		add_int_col_info_to_list,
 		gnc_sql_add_colname_to_list,
@@ -1155,7 +1155,7 @@
 	(*pList) = g_slist_append( (*pList), value );
 }
 
-static col_type_handler_t boolean_handler
+static GncSqlColumnTypeHandler boolean_handler
 	= { load_boolean,
 		add_boolean_col_info_to_list,
 		gnc_sql_add_colname_to_list,
@@ -1231,7 +1231,7 @@
 	(*pList) = g_slist_append( (*pList), value );
 }
 
-static col_type_handler_t int64_handler
+static GncSqlColumnTypeHandler int64_handler
 	= { load_int64,
 		add_int64_col_info_to_list,
 		gnc_sql_add_colname_to_list,
@@ -1311,7 +1311,7 @@
 	(*pList) = g_slist_append( (*pList), value );
 }
 
-static col_type_handler_t double_handler
+static GncSqlColumnTypeHandler double_handler
 	= { load_double,
 		add_double_col_info_to_list,
 		gnc_sql_add_colname_to_list,
@@ -1391,7 +1391,7 @@
 	(*pList) = g_slist_append( (*pList), value );
 }
 
-static col_type_handler_t guid_handler
+static GncSqlColumnTypeHandler guid_handler
 	= { load_guid,
 		add_guid_col_info_to_list,
 		gnc_sql_add_colname_to_list,
@@ -1538,7 +1538,7 @@
 	(*pList) = g_slist_append( (*pList), value );
 }
 
-static col_type_handler_t timespec_handler
+static GncSqlColumnTypeHandler timespec_handler
 	= { load_timespec,
 		add_timespec_col_info_to_list,
 		gnc_sql_add_colname_to_list,
@@ -1631,7 +1631,7 @@
 	(*pList) = g_slist_append( (*pList), value );
 }
 
-static col_type_handler_t date_handler
+static GncSqlColumnTypeHandler date_handler
 	= { load_date,
 		add_date_col_info_to_list,
 		gnc_sql_add_colname_to_list,
@@ -1751,7 +1751,7 @@
 	(*pList) = g_slist_append( (*pList), denom_value );
 }
 
-static col_type_handler_t numeric_handler
+static GncSqlColumnTypeHandler numeric_handler
 	= { load_numeric,
 		add_numeric_col_info_to_list,
 		add_numeric_colname_to_list,
@@ -1761,7 +1761,7 @@
 static GHashTable* g_columnTypeHash = NULL;
 
 void
-gnc_sql_register_col_type_handler( const gchar* colType, const col_type_handler_t* handler )
+gnc_sql_register_col_type_handler( const gchar* colType, const GncSqlColumnTypeHandler* handler )
 {
 	g_return_if_fail( colType != NULL );
 	g_return_if_fail( handler != NULL );
@@ -1774,10 +1774,10 @@
 	DEBUG( "Col type %s registered\n", colType );
 }
 
-static col_type_handler_t*
+static GncSqlColumnTypeHandler*
 get_handler( const GncSqlColumnTableEntry* table_row )
 {
-    col_type_handler_t* pHandler;
+    GncSqlColumnTypeHandler* pHandler;
 
 	g_return_val_if_fail( table_row != NULL, NULL );
 	g_return_val_if_fail( table_row->col_type != NULL, NULL );
@@ -1864,7 +1864,7 @@
 {
     int col;
     QofSetterFunc setter;
-    col_type_handler_t* pHandler;
+    GncSqlColumnTypeHandler* pHandler;
 
 	g_return_if_fail( be != NULL );
 	g_return_if_fail( row != NULL );
@@ -2043,7 +2043,7 @@
 {
     GncSqlStatement* sqlStmt;
     int count;
-    col_type_handler_t* pHandler;
+    GncSqlColumnTypeHandler* pHandler;
 	GSList* list = NULL;
 
 	g_return_val_if_fail( be != NULL, FALSE );
@@ -2109,7 +2109,7 @@
                             const GncSqlColumnTableEntry* table )
 {
 	GSList* list = NULL;
-	col_type_handler_t* pHandler;
+	GncSqlColumnTypeHandler* pHandler;
 	const GncSqlColumnTableEntry* table_row;
 
     for( table_row = table; table_row->col_name != NULL; table_row++ ) {
@@ -2222,7 +2222,7 @@
 
     // Get all col names and all values
 	for( ; table_row->col_name != NULL; table_row++ ) {
-    	col_type_handler_t* pHandler;
+    	GncSqlColumnTypeHandler* pHandler;
 
 		// Add col names to the list
 		pHandler = get_handler( table_row );
@@ -2270,7 +2270,7 @@
 {
 	GncSqlStatement* stmt;
 	GString* sql;
-    col_type_handler_t* pHandler;
+    GncSqlColumnTypeHandler* pHandler;
 	GSList* list = NULL;
 	gchar* sqlbuf;
 
@@ -2334,7 +2334,7 @@
 	g_return_val_if_fail( col_table != NULL, FALSE );
     
     for( ; col_table->col_name != NULL; col_table++ ) {
-        col_type_handler_t* pHandler;
+        GncSqlColumnTypeHandler* pHandler;
 
         pHandler = get_handler( col_table );
         pHandler->add_col_info_to_list_fn( be, col_table, &col_info_list );

Modified: gnucash/trunk/src/backend/sql/gnc-backend-sql.h
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-backend-sql.h	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/backend/sql/gnc-backend-sql.h	2008-08-02 18:57:13 UTC (rev 17450)
@@ -237,7 +237,7 @@
  * @struct GncSqlObjectBackend
  *
  * Struct used to handle a specific engine object type for an SQL backend.
- * This * handler should be registered with qof_object_register_backend().
+ * This handler should be registered with qof_object_register_backend().
  *
  * commit()			- commit an object to the db
  * initial_load()	- load stuff when new db opened
@@ -271,6 +271,9 @@
 
 /**
  * @struct GncSqlColumnInfo
+ *
+ * The GncSqlColumnInfo structure contains information required to create
+ * a column in a table.
  */
 typedef struct {
 	const gchar* name;		/**< Column name */
@@ -299,7 +302,17 @@
  * @struct GncSqlColumnTableEntry
  *
  * The GncSqlColumnTableEntry struct contains all of the information
- * required to copy information between an object and the database.
+ * required to copy information between an object and the database for a
+ * specific object property.
+ *
+ * If an entry contains a gobj_param_name value, this string is used as the
+ * property name for a call to g_object_get() or g_object_set().  If the
+ * gobj_param_name value is NULL but qof_param_name is not NULL, this value
+ * is used as the parameter name for a call to
+ * qof_class_get_parameter_getter().  If both of these values are NULL, getter
+ * and setter are the addresses of routines to return or set the parameter
+ * value, respectively.
+ *
  * The database description for an object consists of an array of
  * GncSqlColumnTableEntry objects, with a final member having col_name == NULL.
  */
@@ -307,10 +320,10 @@
 	const gchar* col_name;	/**< Column name */
 	const gchar* col_type;	/**< Column type */
 	gint size;				/**< Column size in bytes, for string columns */
-#define COL_PKEY	0x01
-#define COL_NNUL	0x02
-#define COL_UNIQUE	0x04
-#define COL_AUTOINC	0x08
+#define COL_PKEY	0x01	/**< The column is a primary key */
+#define COL_NNUL	0x02	/**< The column may not contain a NULL value */
+#define COL_UNIQUE	0x04	/**< The column must contain unique values */
+#define COL_AUTOINC	0x08	/**< The column is an auto-incrementing int */
 	gint flags;				/**< Column flags */
 	const gchar* gobj_param_name; /**< If non-null, g_object param name */
 	const gchar* qof_param_name;  /**< If non-null, qof parameter name */
@@ -336,12 +349,36 @@
                 QofIdTypeConst obj_name, const gpointer pObject,
                 const GncSqlColumnTableEntry* table_row, GSList** pList );
 
+/**
+ * @struct GncSqlColumnTypeHandler
+ *
+ * The GncSqlColumnTypeHandler struct contains pointers to routines to handle
+ * different options for a specific column type.
+ *
+ * A column type maps a property value to one or more columns in the database.
+ */
 typedef struct {
+	/**
+	 * Routine to load a value into an object from the database row.
+	 */
     GNC_SQL_LOAD_FN                 load_fn;
+
+	/**
+	 * Routine to add a GncSqlColumnInfo structure for the column type to a
+	 * GList.
+	 */
     GNC_SQL_ADD_COL_INFO_TO_LIST_FN add_col_info_to_list_fn;
+
+	/**
+	 * Routine to add a column name string for the column type to a GList.
+	 */
     GNC_SQL_ADD_COLNAME_TO_LIST_FN  add_colname_to_list_fn;
+
+	/**
+	 * Routine to add a GValue for the property to a GSList.
+	 */
 	GNC_SQL_ADD_GVALUE_TO_SLIST_FN	add_gvalue_to_slist_fn;
-} col_type_handler_t;
+} GncSqlColumnTypeHandler;
 
 /**
  * Returns the QOF access function for a column.
@@ -502,7 +539,7 @@
  * @param colType Column type
  * @param handler Column handler
  */
-void gnc_sql_register_col_type_handler( const gchar* colType, const col_type_handler_t* handler );
+void gnc_sql_register_col_type_handler( const gchar* colType, const GncSqlColumnTypeHandler* handler );
 
 /**
  * Adds a GValue for an object reference GUID to the end of a GSList.

Modified: gnucash/trunk/src/backend/sql/gnc-commodity-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-commodity-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/backend/sql/gnc-commodity-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -236,7 +236,7 @@
     }
 }
 
-static col_type_handler_t commodity_guid_handler
+static GncSqlColumnTypeHandler commodity_guid_handler
 	= { load_commodity_guid,
 		gnc_sql_add_objectref_guid_col_info_to_list,
 		gnc_sql_add_colname_to_list,

Modified: gnucash/trunk/src/backend/sql/gnc-lots-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-lots-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/backend/sql/gnc-lots-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -221,7 +221,7 @@
     }
 }
 
-static col_type_handler_t lot_guid_handler
+static GncSqlColumnTypeHandler lot_guid_handler
 	= { load_lot_guid,
 		gnc_sql_add_objectref_guid_col_info_to_list,
 		gnc_sql_add_colname_to_list,

Modified: gnucash/trunk/src/backend/sql/gnc-transaction-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-transaction-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/backend/sql/gnc-transaction-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -714,7 +714,7 @@
     }
 }
 
-static col_type_handler_t tx_guid_handler
+static GncSqlColumnTypeHandler tx_guid_handler
 	= { load_tx_guid,
 		gnc_sql_add_objectref_guid_col_info_to_list,
 		gnc_sql_add_colname_to_list,

Modified: gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -197,7 +197,7 @@
     }
 }
 
-static col_type_handler_t address_handler
+static GncSqlColumnTypeHandler address_handler
 	= { load_address,
 		add_address_col_info_to_list,
 		add_address_colname_to_list,

Modified: gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -215,7 +215,7 @@
     }
 }
 
-static col_type_handler_t billterm_guid_handler
+static GncSqlColumnTypeHandler billterm_guid_handler
 	= { load_billterm_guid,
 		gnc_sql_add_objectref_guid_col_info_to_list,
 		gnc_sql_add_colname_to_list,

Modified: gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -261,7 +261,7 @@
     }
 }
 
-static col_type_handler_t invoice_guid_handler
+static GncSqlColumnTypeHandler invoice_guid_handler
 	= { load_invoice_guid,
 		gnc_sql_add_objectref_guid_col_info_to_list,
 		gnc_sql_add_colname_to_list,

Modified: gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -217,7 +217,7 @@
     }
 }
 
-static col_type_handler_t order_guid_handler
+static GncSqlColumnTypeHandler order_guid_handler
 	= { load_order_guid,
 		gnc_sql_add_objectref_guid_col_info_to_list,
 		gnc_sql_add_colname_to_list,

Modified: gnucash/trunk/src/business/business-core/sql/gnc-owner-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-owner-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/business/business-core/sql/gnc-owner-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -269,7 +269,7 @@
 	}
 }
 
-static col_type_handler_t owner_handler
+static GncSqlColumnTypeHandler owner_handler
 	= { load_owner,
 		add_owner_col_info_to_list,
 		add_colname_to_list,

Modified: gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c	2008-08-02 18:49:39 UTC (rev 17449)
+++ gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c	2008-08-02 18:57:13 UTC (rev 17450)
@@ -386,7 +386,7 @@
     }
 }
 
-static col_type_handler_t taxtable_guid_handler
+static GncSqlColumnTypeHandler taxtable_guid_handler
 	= { load_taxtable_guid,
 		gnc_sql_add_objectref_guid_col_info_to_list,
 		gnc_sql_add_colname_to_list,



More information about the gnucash-changes mailing list