projects
/
pspp-builds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
04392b0
)
Set the dictionary's encoding when reading postgresql data.
author
John Darrington
<john@darrington.wattle.id.au>
Sun, 29 Mar 2009 23:05:22 +0000
(07:05 +0800)
committer
John Darrington
<john@darrington.wattle.id.au>
Sun, 29 Mar 2009 23:05:22 +0000
(07:05 +0800)
src/data/psql-reader.c
patch
|
blob
|
history
diff --git
a/src/data/psql-reader.c
b/src/data/psql-reader.c
index a54b9f8b3888c58320623ea1d53086bc8650a155..f2d5ff282272f48e821c4826d9d60f5158f6bfca 100644
(file)
--- a/
src/data/psql-reader.c
+++ b/
src/data/psql-reader.c
@@
-288,10
+288,22
@@
psql_open_reader (struct psql_read_info *info, struct dictionary **dict)
/* Create the dictionary and populate it */
*dict = r->dict = dict_create ();
/* Create the dictionary and populate it */
*dict = r->dict = dict_create ();
+ {
+ const int enc = PQclientEncoding (r->conn);
+
+ /* According to section 22.2 of the Postgresql manual
+ a value of zero (SQL_ASCII) indicates
+ "a declaration of ignorance about the encoding".
+ Accordingly, we don't set the dictionary's encoding
+ if we find this value.
+ */
+ if ( enc != 0 )
+ dict_set_encoding (r->dict, pg_encoding_to_char (enc));
+ }
+
/*
select count (*) from (select * from medium) stupid_sql_standard;
*/
/*
select count (*) from (select * from medium) stupid_sql_standard;
*/
-
ds_init_cstr (&query,
"BEGIN READ ONLY ISOLATION LEVEL SERIALIZABLE; "
"DECLARE pspp BINARY CURSOR FOR ");
ds_init_cstr (&query,
"BEGIN READ ONLY ISOLATION LEVEL SERIALIZABLE; "
"DECLARE pspp BINARY CURSOR FOR ");