From: olegmad <ol...@ya...> - 2003-11-12 16:54:13
|
Hello, Carlos! I use such tools as IB Expert (www.ibexpert.com), IB Console and etc. to input data to database. When i post data (text in russian) to database and try fetch that data with fb.net provider - all russian text disappeares (f.e. for text "bebebe <rusian text> tetete" fb.net provider returns "bebebe tetete"). When i post and retrieve data with fb.net provider - it's ok, BUT I can't read this text with IB Expert (IB Console and other tools). May be fb.net provider works wrong with charsets? ---------------- I create database with charset: UNICODE_FSS ---------------- CREATE TABLE "test" ( "unicode_fss" VARCHAR(128), "description" VARCHAR(128) ); ---------------- using System; using System.Data; using FirebirdSql.Data.Firebird; namespace ConsoleApplication { class MainClass { static private readonly string ConnectionString = @"Charset=UNICODE_FSS;Server=80.80.104.12;Database=c:\temp\carlos.gdb;Connec tion Lifetime=15;Dialect=3;User=carlos;Password=carlos;"; static void Main(string[] args) { using (FbConnection connection = new FbConnection(ConnectionString)) { connection.Open(); FbCommand command = new FbCommand("select * from \"test\"", connection); FbDataAdapter dataAdapter = new FbDataAdapter(command); DataTable table = new DataTable(); dataAdapter.Fill(table); foreach (DataRow dataRow in table.Rows) { Console.WriteLine("Text: {0};\t\tDescription: {1}", dataRow[0], dataRow[1]); } } } } } -------------- I add 3 rows to table: 1. I used ib expert 2. I used fb.net provider 3. I used ib console I used for this command: INSERT INTO "test" ("unicode_fss") VALUES ('!!! <russian text> !!!') |
From:
<car...@te...> - 2003-11-12 17:13:02
|
Hello: > When i post and retrieve data with fb.net provider - it's ok, BUT I can't > read this text with IB Expert (IB Console and other tools). > May be fb.net > provider > works wrong with charsets? If i'm not wrong IBexpert doesn't handle ok UNICODE_FSS character set, maybe i'm wrong but i think it has no real support for UNICODE_FSS character set ;) ( i have problem with it some time ago making tests with UNICODE_FSS ) -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: olegmad <ol...@ya...> - 2003-11-12 18:14:42
|
> If i'm not wrong IBexpert doesn't handle ok UNICODE_FSS character set, > maybe i'm wrong but i think it has no real support for UNICODE_FSS > character set ;) ( i have problem with it some time ago making tests > with UNICODE_FSS ) You right!!! IB Expert can't changes charset :( Hi used windows default charset when post data in database. Greate thanks! |
From: olegmad <ol...@ya...> - 2003-11-13 09:38:44
|
Hi, again! Here my new problem :) ------------------ Database charset: UNICODE_FSS I create table: CREATE TABLE "test" ( "unicode_fss" VARCHAR(128) CHARACTER SET UNICODE_FSS, "win1251" VARCHAR(128) CHARACTER SET WIN1251 ); when i use connection string: "charset=UNICODE_FSS; blablabla..." and try run that code: --- command = new FbCommand("insert into \"test\" (\"unicode_fss\") VALUES ('<russian text>')", connection, transaction); // in VALUE i use russian text command.ExecuteNonQuery(); command = new FbCommand("insert into \"test\" (\"win1251\") VALUES ('<russian text>')", connection, transaction); // in VALUE i use russian text command.ExecuteNonQuery(); And now, when i try fetch data: command = new FbCommand("select * from \"test\"", connection, transaction); FbDataAdapter dataAdapter = new FbDataAdapter(command); DataTable table = new DataTable(); dataAdapter.Fill(table); ----------------- I receive two rows: First row contains:. | <russian text> | DbNull | Second row contains: | DbNull | <russian unreadable text> | ------------------ And now, if i change connection string: "charset=WIN1251; blablabla..." and fetch data again: I receive two rows: First row contains: | <russian unreadable text> | DbNull | Second row contains: | DbNull | <russian text> | ------------------- So, when i insert data in database - all conversion realize correcly, but when i select from base - fb.net provider conversion all text data in charset which i type in connection string. But my fields have diffrent charset. Thanks. |
From:
<car...@te...> - 2003-11-13 09:56:16
|
Hello: > But my fields have diffrent charset. Ok, i'm going to try to review it, just one question are you using beta 3/4 or a previous one?? -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: olegmad <ol...@ya...> - 2003-11-13 14:06:45
|
> Ok, i'm going to try to review it, just one question are you using beta > 3/4 or a previous one?? i using fb.net provider beta 4 for firebird 1.5 |
From:
<car...@te...> - 2003-11-13 11:01:37
|
Hello: > --- > command = new FbCommand("insert into \"test\" (\"unicode_fss\") VALUES > ('<russian text>')", connection, transaction); // in VALUE i use russian > text > command.ExecuteNonQuery(); > > command = new FbCommand("insert into \"test\" (\"win1251\") VALUES > ('<russian text>')", connection, transaction); // in VALUE i use russian > text > > command.ExecuteNonQuery(); Can you try using parametrized querys, please ?? Anything like this : string sql = "insert into \"test\" (\"unicode_fss\") values (@unicodeValue)"; FbCommand unicode_insert = new FbCommand(sql, connection); unicode_insert.Parameters.Add("@unicodeValue", FbDbType.VarChar).Value = "áóíéú"; unicode_insert.ExecuteNonQuery(); unicode_insert.Dispose(); sql = "insert into \"test\" (\"win1251\") values (@win1251Value)"; FbCommand win1251_insert = new FbCommand(sql, connection); win1251_insert.Parameters.Add("@win1251Value", FbDbType.VarChar).Value = "áóíéú"; win1251_insert.ExecuteNonQuery(); win1251_insert.Dispose(); This needs to handle correctly the character set of each field. -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: olegmad <ol...@ya...> - 2003-11-13 14:15:32
|
> Can you try using parametrized querys, please ?? Anything like this : > > string sql = "insert into \"test\" (\"unicode_fss\") values > (@unicodeValue)"; > FbCommand unicode_insert = new FbCommand(sql, connection); > unicode_insert.Parameters.Add("@unicodeValue", FbDbType.VarChar).Value = > "áóíéú"; > unicode_insert.ExecuteNonQuery(); > unicode_insert.Dispose(); > > sql = "insert into \"test\" (\"win1251\") values (@win1251Value)"; > FbCommand win1251_insert = new FbCommand(sql, connection); > win1251_insert.Parameters.Add("@win1251Value", FbDbType.VarChar).Value = > "áóíéú"; > win1251_insert.ExecuteNonQuery(); > win1251_insert.Dispose(); > > > This needs to handle correctly the character set of each field. I try, but when i using parametrized querys - i can't post text data in fields this diffrent charset. My code sample: ------------- class MainClass { static private readonly string ConnectionString = @"Charset=UNICODE_FSS;Server=80.80.104.12;Database=c:\temp\carlos.gdb;Connec tion Lifetime=15;Dialect=3;User=carlos;Password=carlos;"; static void Main(string[] args) { using (FbConnection connection = new FbConnection(ConnectionString)) { connection.Open(); FbTransaction transaction = connection.BeginTransaction(); FbCommand command; command = new FbCommand("insert into \"test\" (\"unicode_fss\") VALUES (@my_param)", connection, transaction); command.Parameters.Add("@my_param", FbDbType.VarChar).Value = "????????"; command.ExecuteNonQuery(); command = new FbCommand("insert into \"test\" (\"win1251\") VALUES (@my_param)", connection, transaction); command.Parameters.Add("@my_param", FbDbType.VarChar).Value = "????????"; command.ExecuteNonQuery(); // Exception HERE !!!! transaction.Commit(); } } } ----------------- Exception: Cannot transliterate character between character sets |
From:
<car...@te...> - 2003-11-13 16:00:41
|
Hello: > Exception: > > Cannot transliterate character between character sets It's working fine for me, here is my test database: SET SQL DIALECT 3; SET NAMES UNICODE_FSS; CREATE DATABASE 'LOCALHOST:c:\test.gdb' USER 'SYSDBA' PASSWORD 'masterkey' PAGE_SIZE 4096 DEFAULT CHARACTER SET UNICODE_FSS; CREATE TABLE "test" ( "unicode_fss" VARCHAR(128) CHARACTER SET UNICODE_FSS, "win1251" VARCHAR(128) CHARACTER SET WIN1251 ); And here is my C# code: string connectionString = @"Database=D:\TEST.GDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Server=localhost;" + "Port=3050;" + "Dialect=3;" + "Charset=UNICODE_FSS;" + "pooling=false;" + "Role=;"; FbConnection connection = new FbConnection(connectionString); connection.Open(); FbTransaction transaction = connection.BeginTransaction(); string sql = "insert into \"test\" (\"unicode_fss\", \"win1251\") values (@unicodeValue, @win1251)"; FbCommand unicode_insert = new FbCommand(sql, connection, transaction); unicode_insert.Parameters.Add("@unicodeValue", FbDbType.VarChar).Value = "áéíóú"; unicode_insert.Parameters.Add("@win1251", FbDbType.VarChar).Value = "áéíóú"; unicode_insert.ExecuteNonQuery(); transaction.Commit(); connection.Close(); -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: olegmad <ol...@ya...> - 2003-11-14 06:11:01
|
> It's working fine for me I try execute you code. Sorry, but it's don't work for me :((( I can't understand why this happened. I catch eception in line: unicode_insert.ExecuteNonQuery(); Here my stack: Unhandled Exception: FirebirdSql.Data.Firebird.FbException: arithmetic exception, numeric overflow, or string truncation Cannot transliterate character between character sets ---> FirebirdSql.Data.Firebird.Gds.GdsException: Exception of type FirebirdSql.Data.Firebird.Gds.GdsException was thrown. at FirebirdSql.Data.Firebird.Gds.GdsAttachment.ReadStatusVector() at FirebirdSql.Data.Firebird.Gds.GdsAttachment.ReceiveResponse() at FirebirdSql.Data.Firebird.Gds.GdsStatement.execute(Boolean isSP) at FirebirdSql.Data.Firebird.FbCommand.InternalExecute() at FirebirdSql.Data.Firebird.FbCommand.ExecuteNonQuery() --- End of inner exception stack trace --- at FirebirdSql.Data.Firebird.FbCommand.ExecuteNonQuery() at ConsoleApplication.MainClass.Main(String[] args) in c:\vss\consoleapplication3\class1.cs:line 33 |
From:
<car...@te...> - 2003-11-14 07:55:26
|
Hello: > I try execute you code. > Sorry, but it's don't work for me :((( > I can't understand why this happened. Don't worry, can you try to debug FbCommand.parseParameters() and see what is the encoding being used for each parameter in the line: Encoding encoding = gdsParams.SqlVar[i].Encoding; -- Best regards Carlos Guzmán Álvarez Vigo-Spain P.S: I'm using Firebird 1.5 RC 7 for test this. |
From: olegmad <ol...@ya...> - 2003-11-14 11:39:51
|
> Don't worry, can you try to debug FbCommand.parseParameters() and see > what is the encoding being used for each parameter in the line: > > Encoding encoding = gdsParams.SqlVar[i].Encoding; when i = 0; EncodingName = Unicode (UTF-8); when i = 1; EncodingName = Cyrillic (Windows); |
From:
<car...@te...> - 2003-11-14 10:29:57
|
Hello: > I try execute you code. > Sorry, but it's don't work for me :((( > I can't understand why this happened. I have done a change in the GDS implementation for send the subtype for char and varchar fields in trh blr description, i want to know if withis the sample works for you before make the commit in the CVS (and i want to run the nunit test too before commit it :)), can i send to you a compiled dll ?? if yes, which version of the .net framework are you using ?? -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: olegmad <ol...@ya...> - 2003-11-14 11:32:09
|
> I have done a change in the GDS implementation for send the subtype for > char and varchar fields in trh blr description, i want to know if withis > the sample works for you before make the commit in the CVS (and i want > to run the nunit test too before commit it :)), can i send to you a > compiled dll ?? if yes, which version of the .net framework are you using ?? Yes! :) i using .net framework 1.1 Thank you! |
From:
<car...@te...> - 2003-11-14 12:57:09
|
Hello: > Yes! :) > > i using .net framework 1.1 The email is being rejected, i ave sent it to < oelgmad at yandex.ru > is this correct email ?? :) -- Best regards Carlos Guzmán álvarez Vigo-Spain |
From: olegmad <ol...@ya...> - 2003-11-14 15:13:38
|
> I have done a change in the GDS implementation for send the subtype for > char and varchar fields in trh blr description, i want to know if withis > the sample works for you before make the commit in the CVS (and i want > to run the nunit test too before commit it :)), can i send to you a > compiled dll ?? if yes, which version of the .net framework are you using ?? I receive your dll. Thanks again. I execute code sample, but problem still exist. I catch same exception with same stack trace :( What can I do, to help you ??? |
From:
<car...@te...> - 2003-11-14 15:21:00
|
Hello: > I receive your dll. Thanks again. > I execute code sample, but problem still exist. I catch same exception > with > same stack trace :( > > What can I do, to help you ??? I got the same exception as you only when i connect to the database with charset that is not the same as the database charset, but i think you are doing this ok. When i use for connect the same charset as the database, has all runs fine for me ( in this case UNICODE_FSS ). -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: olegmad <ol...@ya...> - 2003-11-14 16:21:29
|
>I got the same exception as you only when i connect to the database with >charset that is not the same as the database charset, but i think you >are doing this ok. > >When i use for connect the same charset as the database, has all runs >fine for me ( in this case UNICODE_FSS ). I using your code sample (and i create database as you), but it doesn't work, when i post russian text. :(( |
From:
<car...@te...> - 2003-11-14 16:33:30
|
Hello: > I using your code sample (and i create database as you), but it doesn't > work, when i post russian text. Huuummm ... can you send a sample to my private email using russian text ?? -- Best regards Carlos Guzmán Álvarez Vigo-Spain |