[SQL] convert with libpq
Hi I must convert some records from database. I have table named "langset" in unicode database. When I try use command select convert((SELECT "1" from langset where id_langset=5) using utf_8_to_iso_8859_2) in PGadmin, all is ok, sql return 1 record. But where i execute the same command in libpq I got 0 rows: res=PQexec(conn_lokalne,"select convert((SELECT \"1\" from langset where id_langset=5) using utf_8_to_iso_8859_2)"); printf("%s",PQgetvalue(res,0,0)); What is the problem? ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
[SQL] How convert UNICODE
Hello I have 2 databases with same table. First database is in UNICODE, second in SQL_ASCII. 4 columns from first database I must convert to: (first column)iso8859-1, (second column)iso8859-2, (3-th column)iso8859-1, (4 column)iso8859-5. After it I must save these 4 rows in database in SQL_ASCII. How can I do it? It can be using libpq,libpgeasy, Thx. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] How convert UNICODE
Hi New database must be in SQL_ASCII. In old database (UNICODE) are for example 2 columns. Rows from first column I must convert to ISO_8859_2 and insert it to first column in SQL_ASCII database, and rows from second column I must convert to IS0_8859_5 and insert to second column in SQL_ASCII database. On Fri, 17 Nov 2006 13:17:05 -0800, Drew wrote > How about pg_dump the data from your old database, then load it into > your new database which is using UTF8? > > Drew ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [SQL] How convert UNICODE
Hi Yes, but I must convert diffrent columns to diffrent iso-codes. With pg_dump I can only dump all columns from database and these all columns convert only to one iso-code. On Fri, 17 Nov 2006 14:11:25 -0500, Travis Whitton wrote > There might be better ways, but you could dump the data and use the iconv utility. I frequently use it to convert to UTF-8 before loading data. ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [SQL] How convert UNICODE
Hi I must copy rows from local database (UNICODE) to remote database SQL_ASCII (not on local machine) with converting selected columns to iso8859_2 or iso_8859_5. Can I make it with COPY? On Sat, 18 Nov 2006 09:42:14 -0500, Travis Whitton wrote > You can use the postgresql COPY command to dump a single column to a file. Do this for each column you need to convert. From there, use iconv to convert the data. When you're done dumping and converting, use the unix paste command to reassemble the data. If you're not on a unix-based platform, a simple perl script should do the job. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
[SQL] How to check coding
Hi I have a table in SQL_ASCII. Clients with different language versions of Windows can write data in tha table using different coding systems (polish, english, cyrillic). Next i would like to convert each line of given column to UTF8, but each row can use a different coding windows-125*. Who know how can I check coding in this rows with diffrect coding? I tried use iconv and sql command convert, but these commands dont returns any errors and they can convert rows (ex. in windows-1251) from windows-1252 to utf8 whithout any errors, but it is incorrect. For example (in this row data is in windows-1251): SELECT CONVERT((select "2" from langset where id_langset=1),'windows- 1250','UTF8') I got: ĺäńôôô SELECT CONVERT((select "2" from langset where id_langset=1),'windows- 1251','UTF8') I got: едсффф ICONV: iconv -c -f WINDOWS-1250 -t UTF8 afile ôűâŕďń÷˙ěçĺęó iconv -c -f WINDOWS-1251 -t UTF8 a фывапсчямзе ку ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster