I'm not sure, because of UNICODE charset, it should be (it's out of my knowledge) but AFAIK, varchar fields never kept trailing spaces
Thierry Julien Ferraro a écrit : > > Hello, > > I’ve got a strange behavior with the provider. The trailing space of a > string are trimmed. > > Let me give you an sample : > > CREATE TABLE "Item" ( > > OID INTEGER NOT NULL, > > "Code" VARCHAR(100) CHARACTER SET UNICODE_FSS, > > "OptimisticLockField" INTEGER, > > "GCRecord" INTEGER, > > /* Keys */ > > CONSTRAINT "PK_Item" > > PRIMARY KEY (OID) > > ); > > private static string InsertWithFirebirdProvider() > > { > > // insert a record with a trailing space > > using (FbConnection connection = CreateAndOpenConnection()) > > using (FbCommand command = new FbCommand(GetQueryInsert(), connection)) > > command.ExecuteNonQuery(); > > // read the inserted record > > // the trailing space is trimmed !!! > > using (FbConnection connection = CreateAndOpenConnection()) > > using (FbCommand command = new FbCommand(GetQueryRead(), connection)) > > { > > object firebirdCode = command.ExecuteScalar(); > > if (firebirdCode != null) > > return (string)firebirdCode; > > else > > return String.Empty; > > } > > } > > private static string GetQueryInsert() > > { > > StringBuilder query = new StringBuilder(); > > query.AppendLine("insert into \"Item\" (\"OID\", \"Code\", > \"OptimisticLockField\", \"GCRecord\")"); > > query.AppendLine("values (GEN_ID(\"sq_Item\", 1), 'AAA ', 0, null)"); > > return query.ToString(); > > } > > private static string GetQueryRead() > > { > > StringBuilder query = new StringBuilder(); > > query.AppendLine("select \"Code\""); > > query.AppendLine("from \"Item\""); > > query.AppendLine("where \"OID\" = (select max(\"OID\") from \"Item\")"); > > return query.ToString(); > > } > > private void button1_Click(object sender, RoutedEventArgs e) > > { > > string firebirdCode = InsertWithFirebirdProvider(); > > StringBuilder message = new StringBuilder(); > > if (firebirdCode == "AAA ") > > message.AppendLine("The code is correct"); > > else if (firebirdCode == "AAA") > > message.AppendLine("The written code was <AAA >. It's now <AAA>. The > trailing space is missing !"); > > else > > message.AppendFormat("The written code was <AAA >. It's now <{0}> > !{1}", firebirdCode, Environment.NewLine); > > MessageBox.Show(message.ToString()); > > } > > As you can see, I insert a record with a value containing a space as > the last character. I can see in the database that it was inserted > correctly with the trailing space. > > The ExecuteScalar() method returns the Code field without the trailing > space. Did I do something wrong ? > > TIA > > Julien > > Julien Ferraro - WilLow > > [EMAIL PROTECTED] - 0692 28 85 43 - Fax : 0262 24 98 85 > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ------------------------------------------------------------------------ > > _______________________________________________ > Firebird-net-provider mailing list > Firebird-net-provider@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider