B4J Question RDC Database Access and Stored Functions

GuyBooth

Active Member
Licensed User
Longtime User
I have a database that, along with the data tables, contains a couple of stored functions. Access to these functions with VB6 was part of the cmd string - eg in the following, the stored function is sfArticle:
B4X:
cmdSelectPerformers = "SELECT DISTINCT Performers,sfArticle(Performers) AS FPerformers FROM primarygroups ORDER BY FPerformers;"

Running this is B4J yields this error in the log:
B4X:
java.sql.SQLSyntaxErrorException: (conn=511) FUNCTION sfArticle does not exist

Is there a way to access my stored functions?
 

keirS

Well-Known Member
Licensed User
Longtime User
Exactly as shown in my first post. But it's not a procedure - it's a (stored) User Defined Function function.
Edit: Just looking into the link you have in your post ...

Is this MS SQL Server? If so you have to specify the schema name for the function. So probably dbo.sfArticle by default.
 
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
Is this MS SQL Server? If so you have to specify the schema name for the function. So probably dbo.sfArticle by default.
No, it's MariaDB … but you pointed me in the right direction!
It works with very little change, and I was looking for solutions in all the wrong places!
My database is MariaDB running on a Synology NAS. The database name (schema) is "NAS1_MusicBase" and this statement works:
B4X:
"SELECT DISTINCT Performers, NAS1_MusicBase.sfArticle(Performers) AS FPerformers FROM NAS1_MusicBase.primarygroups ORDER BY FPerformers;"

Thank you for your wisdom!
 
Upvote 0

keirS

Well-Known Member
Licensed User
Longtime User

Ah OK. It was the terminology that confused me. A UDF in MySQL/MariaDB is a global function usually written in C++. In SQL server a UDF is the equivalent of a stored function in MariaDB/MySQL.... Glad you got it sorted.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…