B4J Question jRDC2 - "Include"

LucaMs

Expert
Licensed User
Longtime User
I must confess that I haven't looked on the site, as currently I'm just curious, I don't have a VPS or similar.

In the tutorial about jRDC2 it is said that it is an excellent alternative to PHP and I agree; but is it mandatory to write all queries in the config.properties file? A feature similar to PHP's Include would be very useful. Being a middle-server developed by Erel and being he brilliant (genius!), he could also invent something equally effective, such as being able to embed libraries instead of text (I don't know, right now I need at least two more coffees to wake up ?).
 

Magma

Expert
Licensed User
Longtime User
I must confess that I haven't looked on the site, as currently I'm just curious, I don't have a VPS or similar.

In the tutorial about jRDC2 it is said that it is an excellent alternative to PHP and I agree; but is it mandatory to write all queries in the config.properties file? A feature similar to PHP's Include would be very useful. Being a middle-server developed by Erel and being he brilliant (genius!), he could also invent something equally effective, such as being able to embed libraries instead of text (I don't know, right now I need at least two more coffees to wake up ?).
Well... I really can't understand... what exactly do you mean ?

I think that writting all queries needed in config.properties for security reasons... and for pemissions to clients...
It is easy to pass a string a string request (even with httpjob and then response json or text)... but with this way you can have more security and set limits at clients...

otherwise: what stops a client connected successfully to delete the whole database...

if you ask me what I preferer... I prefer to have custom - request -string every time...

---
 
Last edited:
Upvote 0

Magma

Expert
Licensed User
Longtime User
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
that would probably need at stand-alone carry a compiler too :) ......and from the other hand.. PHP is a scripting language
jRDC runs/executes a script, the one written in the config.properties file.
Erel could make the server include other text files in that file, containing sql queries; I think it's not difficult but I don't know if it's already possible, I haven't looked.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
I see..

You mean at config.properties (text file)

having for example:
INCLUDE01=c:\test1\config2.inc
...
INCLUDE02=c:\test1\config3.inc
....
and in config2.inc, config3.inc:

having some extra sql queries

right ?

If that you want... after readmap... you can check map keys for containing INCLUDE and run some extra readmap - then append those keys/values in one map
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
If you want to use a separate file to store the SQL queries, the answer is YES.

This is how I made Web API Server (version 1).

I use queries-mysql.ini to stores the queries.

Just put it inside Objects folder.

You can stop the server, edit this file and run the server again.

The queries are loaded when the server restarted.

You don't need to compile the jar again.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
If you want to use a separate file to store the SQL queries, the answer is YES.

This is how I made Web API Server (version 1).

I use queries-mysql.ini to stores the queries.

Just put it inside Objects folder.

You can stop the server, edit this file and run the server again.

The queries are loaded when the server restarted.

You don't need to compile the jar again.
But jRDC2 only reads config.properties (and only executes queries in it).
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
But jRDC2 only reads config.properties (and only executes queries in it).
There are several mods out on the forum that may point you in the right direction. Config.properties can by dynamic. I thought I also seen one where the SQL statements are themselves in a table of an SQL DB. Now and then I pitch in when I see some sort of demand for a feature.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Why jump through hoops since Erel will most likely simply be able to make the server (jRDC2) include the text files, perhaps with a particular extension, .rdc for example, and run it all?!
I might take a swing at this over the weekend (if you have enough patience for that timeframe). Of course, anyone else is welcome to beat me to it if they want. You could also try a Wish and see what happens...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I didn't understand that answer for the simple reason that... I thought that jRDC was a jar, that the source code was not available! :confused: (Downloaded right now).
jRDC2 like many other projects shared in this forum is written in B4X so you can modify it. Simple as that. If you put any files in Files tab then it become asset files inside the jar which is readonly. If you put any files to Objects folder then it will not be readonly.
 
Upvote 0
Top