Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jul 2004 20:00:19 -0700
From:      Richard Schilling <rschi@rsmba.biz>
To:        gnome@FreeBSD.org
Subject:   Patch suggestion for gnucash 1.8.8 (ports/finance/gnucash) postgres backend.
Message-ID:  <4105C543.4070207@rsmba.biz>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030601040706010401000702
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit


I have created a patch that you can put into the "files" subdirectory of 
the gnucash port.  It's attached.

Gnucash, when creating a database for the Postgres backend uses the 
value returned from nl_langinfo(CODESET) to build up SQL queries.  In 
particular the value returned from nl_langinfo(CODESET) is used to set 
the encoding in the Postgres database in the following SQL command:

      CREATE DATABASE gnucash_database_name WITH ENCODING 'US-ASCII';

nl_langinfo(CODESET) returns the string "US-ASCII" on my BSD system. 
When US-ASCII is used to build up SQL queries for the Postgres backend, 
Postgres generates an error because "US-ASCII" is not allowed to be used 
as an option in Postgres SQL.

Would you be willing to Patch the gnucash code to substitute US-ASCII 
with SQL_ASCII as it is used?  The effected file is:

work/gnucash-1.8.8/src/backend/postgres/PostgresBackend.c, line 2100.


Thanks.

Richard Schilling
(206) 774-5951




--------------030601040706010401000702
Content-Type: text/plain;
 name="patch-PostgresBackend"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch-PostgresBackend"

*** src/backend/postgres/PostgresBackend.orig	Mon Jul 26 17:17:45 2004
--- src/backend/postgres/PostgresBackend.c	Mon Jul 26 17:33:16 2004
***************
*** 2104,2109 ****
--- 2104,2114 ----
           if (!strcmp (encoding, "ANSI_X3.4-1968"))
             encoding = "SQL_ASCII";
  
+          if (!strcmp(encoding, "US-ASCII"))
+            encoding = "SQL_ASCII";
+ 
+          printf("\nDatabase encoding is: %s.\n", encoding);
+ 
           /* create the database */
           p = be->buff; *p =0;
           p = stpcpy (p, "CREATE DATABASE ");

--------------030601040706010401000702--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4105C543.4070207>