Don't use a servername as static text in your methods.

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

Don't use a servername as static text in your methods.

Postby jcompagner » Tue May 02, 2006 3:47 pm

I see always a lot of things like this:

var dataset = databaseManager.getDataSetByQuery('mydatabaseserver',query, args, maxReturnedRows);

this completely breaks portability because you suddenly really need to have the same servername everywhere.. Always use controller.getServerName() if possible

var dataset = databaseManager.getDataSetByQuery(controller.getServerName(),query, args, maxReturnedRows);

if this is somehow not possible for what every reason then still do something like this:

var dataset = databaseManager.getDataSetByQuery(globals.myservername,query, args, maxReturnedRows);

and configure youre global in a startup script (so it is only done in one place)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Return to How To

Who is online

Users browsing this forum: No registered users and 8 guests

cron