B4J Question [jRDC] SELECT column name with special characters from MySQL

aeric

Expert
Licensed User
Longtime User
I created a view with column name in german word and I tried to select the data.
Eg.
SQL:
SELECT
    `Color`,
    `Januar` AS `January`,
    `Februar` AS `February`,
    `März` AS `March`,
    `April` AS `April`,
    `Mai` AS `May`,
    `Juni` AS `June`,
    `Juli` AS `July`,
    `August` AS `August`,
    `September` AS `September`,
    `Oktober` AS `October`,
    `November` AS `November`,
    `Dezember` AS `December`,
    `Total`
FROM view_Color

I get the following error in log:
May I know how I can solve this error?

Edit: For the workaround, I am avoiding special characters in the view. Just want to learn if there is a way to insist using the special characters.
 
Last edited:

Sandman

Expert
Licensed User
Longtime User
I had an issue like this many years ago, in another language, with a table brandnames. After trying everything I could think of from the code, and always failing, I went to the database: In it I created a view, called brandnames_sane_names, which I used in my code instead.

The view did exactly what you showed in your example, and it worked like a charm. Of course, this is only possible if you have access to the database so you can create views in it.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I have another way which is to create a routine (stored procedure or prepared statement) and call it using "Call" keyword in config.properties.

B4X:
# Query 2
sql.select_FabreByFehler = CALL sp_FabreByFehler
 
Upvote 0

Philip Chatzigeorgiadis

Active Member
Licensed User
Longtime User
I am not sure if this helps but when I access fields with greek characters, I have to bracket them - works for sure with SQL Server.
e.g. if the field is ΕΠΙΘΕΤΟ, I access it with SELECT [ΕΠΙΘΕΤΟ] FROM ...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…