There also needs to be an if test for the case that encoding is the empty string -- either that or track down how the locale gets clobbered on a Mac system. By the time this code executes on my mac, locale has been set to "C/En_US/C/C/C".

On Jul 26, 2004, at 10:03 PM, Richard Schilling wrote:

I'm also sending this patch file to this list so it can be considered for adoption.

Richard Schilling


-------- Original Message --------
Subject: Patch suggestion for gnucash 1.8.8 (ports/finance/gnucash) postgres backend.
Date: Mon, 26 Jul 2004 20:00:19 -0700
From: Richard Schilling <[EMAIL PROTECTED]>
Organization: Richard Schilling, MBA
To: [EMAIL PROTECTED]



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




*** 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 ");

_______________________________________________
gnucash-devel mailing list
[EMAIL PROTECTED]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

_______________________________________________ gnucash-devel mailing list [EMAIL PROTECTED] https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to