Skip to content
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

Importing a library with an error #1

Open
Evgeniy-LOR opened this issue Nov 21, 2022 · 2 comments
Open

Importing a library with an error #1

Evgeniy-LOR opened this issue Nov 21, 2022 · 2 comments
Assignees

Comments

@Evgeniy-LOR
Copy link

Greetings, dear. I, like you, adore Gawk. The task is to work with the database (sqlite3). Found you) Compiled without errors, the library appeared. But when importing to Gawk, here is such an error. Can you recommend something? Thanks.
gawk: character search error: /usr/local/lib/gawk/odbc.so: undefined character: SQLAllocHandle
OS Devuan, kernel 6.0.6
GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)

@ccervini
Copy link
Contributor

Hi Evgeniy,
Sorry for the long delay.
Is this still an issue ?
It looks here that odbc.so is complaining about some character. Indeed, your statement "INSERT INTO db values(1, 'data_sensor','temp: 67С')" has an invisible character before the C.
I copied/pasted that value in a test table in sqllite3 and it did not cause any error:
stmt = "INSERT INTO countries values(100, 'Evgeniy','temp: 67С') # displayed as 67� if the C is deleted;
ret = ODBC_execute(cursor, stmt)
Result:
| 1|100 |Evgeniy |temp: 67С|

I guess the temperature to insert is 67℃. I tried this too:
stmt = "INSERT INTO countries values(101, 'Evgeniy','temp: 67�DC')" # i.e. 67 degrees Celsius i.e. Unicode Character �DC (U+2103)
ret = ODBC_execute(cursor, stmt)
Result:
| 1|101 |Evgeniy |temp: 67℃|
No error here either, and the UTF-8 character was stored, retrieved and displayed correctly in the console.
I'm using the vi editor to introduce the temperature and it is OK as long as one does not try to move the cursor past the 67C sequence... The console displays UTF-8 as expected.
If you work in a console, you can try redirecting the screen to some X-Windows server (e.g. on another linux with a running desktop GUI) and using a graphical, UTF-8 enabled editor such as mousepad so those characters get displayed correctly.
One thing you can try is removing the 67C string altogether and see if the insertion works.
Cheers.
Cesare

@ccervini
Copy link
Contributor

ccervini commented May 16, 2023

I just thought of something that could be related: maybe the column you are inserting into is not wide enough because of the extra-bytes used by that special character's encoding. This is why Oracle RDBMS allows to specify the character semantics when defining a table's column (cf. NLS_LENGTH_SEMANTICS: either char or byte).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants