Re: [Firebird-devel] varbinary

2022-01-02 Thread Jiří Činčura
> yes, copy/paste from my source
>
>
> class method 
> DBvapausfestit_register_forms.insert_or_update_vapausfestit_register_forms( 
> ID:  not nullable  System.Guid; EVENT_ID:  not nullable  System.Guid; 
> ...

Might be a side effect of introducing new datatypes from Firebird 4, with 
stricter checking (which I think is correct).

You can simply use this 
(https://docs.microsoft.com/en-us/dotnet/api/system.text.encoding.getbytes?view=net-6.0#System_Text_Encoding_GetBytes_System_String_)
 method to get the bytes from string explicitly.

-- 
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] varbinary

2021-12-20 Thread Mark Rotteveel

On 2021-12-20 14:04, Norbert Saint Georges wrote:

Thank you for your two responses.
unfortunately I have a problem with an old project, following the
update of the netprovider 8.5 client.
Several varchar (x) character set bytes are declared there which
crashes on an expected byte [] even though I have been sending it
strings for several months :-)
but ok :-)


That sounds like something to ask about on 
https://groups.google.com/g/firebird-net-provider


Make sure to include the necessary code and the actual error you 
receive.


Mark


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] varbinary

2021-12-20 Thread Norbert Saint Georges

Jirí Cincura a écrit :

update of the netprovider 8.5 client.
Several varchar (x) character set bytes are declared there which 
crashes on an expected byte [] even though I have been sending it 
strings for several months :-)


Do you have an example?


yes, copy/paste from my source


class method 
DBvapausfestit_register_forms.insert_or_update_vapausfestit_register_forms( 
ID:  not nullable  System.Guid; EVENT_ID:  not nullable  System.Guid; 
REGISTER_LANG:  not nullable  System.string; FIRSTNAME:  nullable  
System.string; LASTNAME:  nullable  System.string; FULL_NAME:  nullable 
System.string; EMAIL:  not nullable  System.string; KITS:  nullable  
System.string; PHONE:  not nullable  System.string; COMMENT_COLLATION:  
nullable  System.string; COMMENT_WORK:  nullable  System.string; 
INFORM_EMAIL:  nullable  System.string; FROM_IP:  nullable  
System.string; REGISTER_DATETIME:  nullable  System.DateTime; 
EDIT_FROM_IP:  nullable  System.string; EDIT_DATETIME:  nullable  
System.DateTime; PAY:  nullable  System.string; DELETED:  nullable  
System.string; PASSWD:  nullable  System.string):System.Int32;

Begin
  var sqlCommand: StringBuilder := new StringBuilder;
  sqlCommand.Append('UPDATE or INSERT INTO vapausfestit_register_forms 
( ID, EVENT_ID, REGISTER_LANG, FIRSTNAME, LASTNAME, FULL_NAME, EMAIL, 
KITS, PHONE, COMMENT_COLLATION, COMMENT_WORK, INFORM_EMAIL, FROM_IP, 
REGISTER_DATETIME, EDIT_FROM_IP, EDIT_DATETIME, PAY, DELETED, 
PASSWD)');
  sqlCommand.Append('  VALUES ( @ID, @EVENT_ID, @REGISTER_LANG, 
@FIRSTNAME, @LASTNAME, @FULL_NAME, @EMAIL, @KITS, @PHONE, 
@COMMENT_COLLATION, @COMMENT_WORK, @INFORM_EMAIL, @FROM_IP, 
@REGISTER_DATETIME, @EDIT_FROM_IP, @EDIT_DATETIME, @PAY, @DELETED, 
@PASSWD)');

  sqlCommand.Append('  matching (ID);');
  var arParams: array of FbParameter := new FbParameter[20];
  arParams[0] := new FbParameter('@ID',FbDbType.Guid);
  arParams[0].Direction := ParameterDirection.Input;
  arParams[0].Charset := FbCharset.OCTETS ;
  arParams[0].Value := ID;
  arParams[1] := new FbParameter('@EVENT_ID',FbDbType.Guid);
  arParams[1].Direction := ParameterDirection.Input;
  arParams[1].Charset := FbCharset.OCTETS ;
  arParams[1].Value := EVENT_ID;
  arParams[2] := new FbParameter('@REGISTER_LANG',CHAR(2));
  arParams[2].Direction := ParameterDirection.Input;
  arParams[2].Charset := FbCharset.ISO8859_1 ;
  arParams[2].Value := REGISTER_LANG;
  arParams[3] := new FbParameter('@FIRSTNAME',FbDbType.VarChar, 50);
  arParams[3].Direction := ParameterDirection.Input;
  arParams[3].Charset := FbCharset.ISO8859_1 ;
  if FIRSTNAME <> nil then
  arParams[3].Value := FIRSTNAME;
  arParams[4] := new FbParameter('@LASTNAME',FbDbType.VarChar, 100);
  arParams[4].Direction := ParameterDirection.Input;
  arParams[4].Charset := FbCharset.ISO8859_1 ;
  if LASTNAME <> nil then
  arParams[4].Value := LASTNAME;
  arParams[5] := new FbParameter('@FULL_NAME',FbDbType.VarChar, 200);
  arParams[5].Direction := ParameterDirection.Input;
  arParams[5].Charset := FbCharset.ISO8859_1 ;
  if FULL_NAME <> nil then
  arParams[5].Value := FULL_NAME;
  arParams[6] := new FbParameter('@EMAIL',FbDbType.VarChar, 100);
  arParams[6].Direction := ParameterDirection.Input;
  arParams[6].Charset := FbCharset.ISO8859_1 ;
  arParams[6].Value := EMAIL;
  arParams[7] := new FbParameter('@KITS',FbDbType.VarChar, 100);
  arParams[7].Direction := ParameterDirection.Input;
  arParams[7].Charset := FbCharset.ISO8859_1 ;
  if KITS <> nil then
  arParams[7].Value := KITS;
  arParams[8] := new FbParameter('@PHONE',FbDbType.VarChar, 50);
  arParams[8].Direction := ParameterDirection.Input;
  arParams[8].Charset := FbCharset.ISO8859_1 ;
  arParams[8].Value := PHONE;
  arParams[9] := new 
FbParameter('@COMMENT_COLLATION',FbDbType.VarChar, 8000);

  arParams[9].Direction := ParameterDirection.Input;
  arParams[9].Charset := FbCharset.ISO8859_1 ;
  if COMMENT_COLLATION <> nil then
  arParams[9].Value := COMMENT_COLLATION;
  arParams[10] := new FbParameter('@COMMENT_WORK',FbDbType.VarChar, 
8000);

  arParams[10].Direction := ParameterDirection.Input;
  arParams[10].Charset := FbCharset.ISO8859_1 ;
  if COMMENT_WORK <> nil then
  arParams[10].Value := COMMENT_WORK;
  arParams[11] := new FbParameter('@INFORM_EMAIL',CHAR(1));
  arParams[11].Direction := ParameterDirection.Input;
  arParams[11].Charset := FbCharset.ISO8859_1 ;
  if INFORM_EMAIL <> nil then
  arParams[11].Value := INFORM_EMAIL;
  arParams[12] := new FbParameter('@FROM_IP',FbDbType.VarChar, 16);
  arParams[12].Direction := ParameterDirection.Input;
  arParams[12].Charset := FbCharset.OCTETS ;
   if FROM_IP <> nil then
   arParams[12].Value := FROM_IP;  <---booo
  arParams[13] := new 
FbParameter('@REGISTER_DATETIME',FbDbType.TimeStamp);

  arParams[13].Direction := ParameterDirection.Input;
  if REGISTER_DATETIME <> nil then
  arParams[13].Value := REGISTER_DATETIME;
  arParams[14] := new FbParameter('@EDIT_FROM_IP',FbDbType.VarChar, 
16);

  arParams[14].Direction := 

Re: [Firebird-devel] varbinary

2021-12-20 Thread Jiří Činčura
> update of the netprovider 8.5 client.
> Several varchar (x) character set bytes are declared there which 
> crashes on an expected byte [] even though I have been sending it 
> strings for several months :-)

Do you have an example?

-- 
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] varbinary

2021-12-20 Thread Norbert Saint Georges

Thank you for your two responses.
unfortunately I have a problem with an old project, following the 
update of the netprovider 8.5 client.
Several varchar (x) character set bytes are declared there which 
crashes on an expected byte [] even though I have been sending it 
strings for several months :-)

but ok :-)

--
Norbert Saint Georges
http://tetrasys.fi



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] varbinary

2021-12-20 Thread Mark Rotteveel

On 2021-12-20 12:40, Norbert Saint Georges wrote:

Hello,


a varbinary has a subtype of 1 and not 0 (binary) normal?


You're thinking of BLOB SUB_TYPE, and this is unrelated to BLOB 
SUB_TYPE, as it isn't a BLOB type.


In Firebird 4, VARBINARY is introduced as *an alias* for VARCHAR 
CHARACTER SET OCTETS (and BINARY for CHAR CHARACTER SET OCTETS), and 
"normal" VARCHAR (or CHAR) has sub_type 0. The character set OCTETS has 
id 1, and some parts of Firebird communicate the character set in the 
sub_type field (e.g. of XSQLDA), so to make this backwards compatible, 
the character set id of OCTETS (1) is also used as its 
RDB$FIELD_SUB_TYPE value. In that way, "old" tools handle it correctly 
as (VAR)CHAR CHARACTER SET OCTETS, while Firebird 4.0 tools can identify 
it as (VAR)BINARY.


Mark


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] varbinary

2021-12-20 Thread Dimitry Sibiryakov

Norbert Saint Georges wrote 20.12.2021 12:40:

a varbinary has a subtype of 1 and not 0 (binary) normal?


  Yes. According to README.data_types.txt subtype 1 is what distinguishes 
VARBINARY from VARCHAR.
  Though at API level subtype is returned as 0 because of limitations of engine 
internals.


--
  WBR, SD.


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] varbinary

2021-12-20 Thread Norbert Saint Georges

Hello,


a varbinary has a subtype of 1 and not 0 (binary) normal?

--
Norbert Saint Georges
http://tetrasys.fi



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel