New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
return by descriptor UDF char parametr trunc for 1/4 of it`s len if UDF set paramdsc->dsc_sub_type to UTF8 [CORE5983] #6235
Comments
Modified by: Segey Khalyutin (notesoft)summary: return by descriptor UDF varchar parametr trunc for 1/4 of it`s len if UD8 set paramdsc->dsc_sub_type to UTF8 => return by descriptor UDF varchar parametr trunc for 1/4 of it`s len if UDF set paramdsc->dsc_sub_type to UTF8 |
Commented by: @asfernandes Please post minimal UDF source code, SQL declaration and how do you observe the problem with an ISQL script. So far my tests using sNvl from FB code doesn't reproduce the problem. |
Commented by: Segey Khalyutin (notesoft) main.cpp =============================================== /* #include "main.h" int main(int argc, char** argv) /* declare external function test_of_dsc_sub_type */
main.h================================================= /* /* #ifndef FBUDF_H #ifdef __cplusplus #include <ibase.h> #ifdef WINDOWS NM_IMPORT void* ib_util_malloc(long); #define MAX(a, b) (a > b) ? a : b const int nm_int64_digit_count = 21; NM_EXPORT void testof_dsc_sub_type(paramdsc* param, paramdsc* result); #ifdef __cplusplus #endif /* FBUDF_H */ script.sql =================================== connect 'd:\database\my_database.fdb' user 'SYSDBA' password 'masterkey'; declare external function test_of_dsc_sub_type select test_of_dsc_sub_type(0), test_of_dsc_sub_type(4) from RDB$DATABASE ^ commit work ^ result ====================================== C:\WINDOWS\system32>"C:\Program Files (x86)\Firebird\Firebird_3_0\isql" -i D:\source\NOTEMATRIX\FBSQL\test\script.sql TEST_OF_DSC_SUB_TYPE TEST_OF_DSC_SUB_TYPE |
Commented by: @asfernandes Why are you returning CHAR (dtype_text) instead of VARCHAR (dtype_varying), if the metadata declares VARCHAR? |
Commented by: Segey Khalyutin (notesoft) dtype_text is easy to use and I`m expected on firebird typcast mechanism Realy, we`a prepared structure like paramdsc in java client application, convert any cursors data in one BLOB (like len:value;len:value;... structure), put in DB by stored procedure and extract individual cursor.record.field data from BLOB by UDF... We are implement this mechanism for transmit any relation cursors data by long-ping intranet and replicate logical group of cursors data,,, I`m corrected bug example. ===================== #include "main.h" int main(int argc, char** argv)
/* declare external function test_of_dsc_sub_type */
/**
========================== connect 'd:\database\my_database.fdb' user 'SYSDBA' password 'masterkey'; declare external function test_of_dsc_sub_type declare external function test_of_dsc_sub_type_var select test_of_dsc_sub_type(0), test_of_dsc_sub_type(4) from RDB$DATABASE ^ ======================================== :\WINDOWS\system32>"C:\Program Files (x86)\Firebird\Firebird_3_0\isql" -i D:\source\NOTEMATRIX\FBSQL\test\script.sql TEST_OF_DSC_SUB_TYPE TEST_OF_DSC_SUB_TYPE TEST_OF_DSC_SUB_TYPE_VAR TEST_OF_DSC_SUB_TYPE_VAR |
Modified by: Segey Khalyutin (notesoft)priority: Trivial [ 5 ] => Major [ 3 ] |
Modified by: Segey Khalyutin (notesoft)summary: return by descriptor UDF varchar parametr trunc for 1/4 of it`s len if UDF set paramdsc->dsc_sub_type to UTF8 => return by descriptor UDF char parametr trunc for 1/4 of it`s len if UDF set paramdsc->dsc_sub_type to UTF8 |
Commented by: Segey Khalyutin (notesoft) On WIN WI-T4.0.0.1434 Firebird 4.0 Beta 1 x64 error reproduce too. |
Submitted by: Segey Khalyutin (notesoft)
database default charset is UTF8
in UDF i`m set paramdsc->dsc_sub_type to UTF8 like this:
when UDF is return parametr to stored ptocedure the value len trunc for 1/4 of it`s len
value in UDF '123-123-123-123' has '123-' in stored procedure/
if i`m set paramdsc->dsc_sub_type = 0 return value id normal '123-123-123-123' as needed
Query:
NO bug in engine, I`m mast set paramdsc->dsc_sub_type = 0; in UDF for UTF8 strings
or
trunc for 1/4 is bug in engine, I`m mast set paramdsc->dsc_sub_type = (short) ((collation) << 8 | (charset));
or
I`m don`t understood something...
The text was updated successfully, but these errors were encountered: