r17234 - gnucash/branches/gda-dev2/src/backend/sql - 1) create_column_info() routine doesn't need to be global
Phil Longstaff
plongstaff at cvs.gnucash.org
Sat Jun 14 20:52:12 EDT 2008
Author: plongstaff
Date: 2008-06-14 20:52:12 -0400 (Sat, 14 Jun 2008)
New Revision: 17234
Trac: http://svn.gnucash.org/trac/changeset/17234
Modified:
gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.c
gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.h
Log:
1) create_column_info() routine doesn't need to be global
2) fix bug where timespec's weren't being loaded properly
Modified: gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.c
===================================================================
--- gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.c 2008-06-14 15:23:34 UTC (rev 17233)
+++ gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.c 2008-06-15 00:52:12 UTC (rev 17234)
@@ -924,8 +924,8 @@
}
}
-GncSqlColumnInfo*
-gnc_sql_create_column_info( const col_cvt_t* table_row, const gchar* type,
+static GncSqlColumnInfo*
+create_column_info( const col_cvt_t* table_row, const gchar* type,
gint size )
{
GncSqlColumnInfo* info;
@@ -977,7 +977,7 @@
g_return_if_fail( table_row != NULL );
g_return_if_fail( pList != NULL );
- info = gnc_sql_create_column_info( table_row,
+ info = create_column_info( table_row,
gnc_sql_connection_get_column_type_name( be->conn,
G_TYPE_STRING, table_row->size ),
table_row->size );
@@ -1064,7 +1064,7 @@
g_return_if_fail( table_row != NULL );
g_return_if_fail( pList != NULL );
- info = gnc_sql_create_column_info( table_row,
+ info = create_column_info( table_row,
gnc_sql_connection_get_column_type_name( be->conn,
G_TYPE_INT, table_row->size ),
0 );
@@ -1143,7 +1143,7 @@
g_return_if_fail( table_row != NULL );
g_return_if_fail( pList != NULL );
- info = gnc_sql_create_column_info( table_row,
+ info = create_column_info( table_row,
gnc_sql_connection_get_column_type_name( be->conn,
G_TYPE_INT, table_row->size ),
0 );
@@ -1216,7 +1216,7 @@
g_return_if_fail( table_row != NULL );
g_return_if_fail( pList != NULL );
- info = gnc_sql_create_column_info( table_row,
+ info = create_column_info( table_row,
gnc_sql_connection_get_column_type_name( be->conn,
G_TYPE_INT64, table_row->size ),
0 );
@@ -1290,7 +1290,7 @@
g_return_if_fail( table_row != NULL );
g_return_if_fail( pList != NULL );
- info = gnc_sql_create_column_info( table_row,
+ info = create_column_info( table_row,
gnc_sql_connection_get_column_type_name( be->conn,
G_TYPE_DOUBLE, table_row->size ),
0 );
@@ -1372,7 +1372,7 @@
g_return_if_fail( table_row != NULL );
g_return_if_fail( pList != NULL );
- info = gnc_sql_create_column_info( table_row, "CHAR", GUID_ENCODING_LENGTH );
+ info = create_column_info( table_row, "CHAR", GUID_ENCODING_LENGTH );
*pList = g_list_append( *pList, info );
}
@@ -1496,9 +1496,9 @@
s[0], s[1], s[2], s[3],
s[4], s[5],
s[6], s[7],
- s[9], s[10],
- s[11], s[12],
- s[13], s[14] );
+ s[8], s[9],
+ s[10], s[11],
+ s[12], s[13] );
ts = gnc_iso8601_to_timespec_gmt( buf );
(*ts_setter)( pObject, ts );
g_free( buf );
@@ -1519,8 +1519,7 @@
g_return_if_fail( table_row != NULL );
g_return_if_fail( pList != NULL );
- info = gnc_sql_create_column_info( table_row,
- "CHAR", TIMESPEC_COL_SIZE );
+ info = create_column_info( table_row, "CHAR", TIMESPEC_COL_SIZE );
*pList = g_list_append( *pList, info );
}
@@ -1623,8 +1622,7 @@
g_return_if_fail( table_row != NULL );
g_return_if_fail( pList != NULL );
- info = gnc_sql_create_column_info( table_row,
- "CHAR", DATE_COL_SIZE );
+ info = create_column_info( table_row, "CHAR", DATE_COL_SIZE );
*pList = g_list_append( *pList, info );
}
Modified: gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.h
===================================================================
--- gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.h 2008-06-14 15:23:34 UTC (rev 17233)
+++ gnucash/branches/gda-dev2/src/backend/sql/gnc-backend-sql.h 2008-06-15 00:52:12 UTC (rev 17234)
@@ -57,6 +57,12 @@
#include <gmodule.h>
typedef struct GncSqlConnection GncSqlConnection;
+
+/**
+ * @struct GncSqlBackend
+ *
+ * Main SQL backend structure.
+ */
struct GncSqlBackend_struct
{
QofBackend be;
@@ -131,6 +137,9 @@
/**
*@struct GncSqlStatement
+ *
+ * Struct which represents an SQL statement. SQL backends must provide a
+ * structure which implements all of the functions.
*/
struct GncSqlStatement
{
@@ -146,18 +155,10 @@
(STMT)->addWhereCond(STMT, TYPENAME, OBJ, COLDESC, VALUE)
/**
- * @struct GncSqlColumnInfo
- */
-typedef struct {
- const gchar* name;
- const gchar* type_name;
- gint size;
- gboolean is_primary_key;
- gboolean null_allowed;
-} GncSqlColumnInfo;
-
-/**
* @struct GncSqlConnection
+ *
+ * Struct which represents the connection to an SQL database. SQL backends
+ * must provide a structure which implements all of the functions.
*/
struct GncSqlConnection
{
@@ -198,6 +199,12 @@
#define gnc_sql_connection_quote_string(CONN,STR) \
(CONN)->quoteString(CONN,STR)
+/**
+ * @struct GncSqlRow
+ *
+ * Struct used to represent a row in the result of an SQL SELECT statement.
+ * SQL backends must provide a structure which implements all of the functions.
+ */
struct GncSqlRow
{
const GValue* (*getValueAtColName)( GncSqlRow*, const gchar* );
@@ -208,9 +215,15 @@
#define gnc_sql_row_dispose(ROW) \
(ROW)->dispose(ROW)
+/**
+ * @struct GncSqlResult
+ *
+ * Struct used to represent the result of an SQL SELECT statement. SQL
+ * backends must provide a structure which implements all of the functions.
+ */
struct GncSqlResult
{
- int (*getNumRows)( GncSqlResult* );
+ gint (*getNumRows)( GncSqlResult* );
GncSqlRow* (*getFirstRow)( GncSqlResult* );
GncSqlRow* (*getNextRow)( GncSqlResult* );
void (*dispose)( GncSqlResult* );
@@ -255,6 +268,17 @@
void (*write)( GncSqlBackend* be );
} GncSqlDataType_t;
+/**
+ * @struct GncSqlColumnInfo
+ */
+typedef struct {
+ const gchar* name;
+ const gchar* type_name;
+ gint size;
+ gboolean is_primary_key;
+ gboolean null_allowed;
+} GncSqlColumnInfo;
+
// Type for conversion of db row to object.
#define CT_STRING "ct_string"
#define CT_GUID "ct_guid"
@@ -311,16 +335,6 @@
} col_type_handler_t;
/**
- * Creates a GncSqlColumnInfo structure for a column.
- *
- * @param table_row DB table column
- * @param type Type name
- * @param size Field size (if string)
- * @return Column info
- */
-GncSqlColumnInfo* gnc_sql_create_column_info( const col_cvt_t* table_row, const gchar* type, gint size );
-
-/**
* Returns the QOF access function for a column.
*
* @param obj_name QOF object type name
More information about the gnucash-changes
mailing list