MySQL Keyword problem

Questions and answers regarding general SQL and backend databases

MySQL Keyword problem

Postby tkilshaw1553613063 » Mon Apr 15, 2019 7:44 pm

Using Servoy Version: 8.4.0.3402 on Windows 10.

I'm generating Servoy forms using the Solution Model.

When I make a text field using code like this:

Code: Select all
  var oTextField = goJSForm.newTextField( sTblFldName, oCoords.iFieldX, oCoords.iFieldY, giFieldW, giFieldH );


If the value of sTblFldName is a MySQL keyword, such as Security or Status for example, there is no problem. The screen is generated and properly populated.

But when I add a JavaScript variable like:

Code: Select all
var oJSVar = goJSForm.newVariable( sTblFldName, JSVariable.TEXT );


When the form is displayed the following truncated error trace is seen:

Code: Select all
ERROR com.servoy.j2db.util.Debug - there is a keyword with name Security (Form Context: main), JSEvent(type = action, source = Component: <'svy_1073742067' of parent FormUI for FormController[form: main, fs size:0, selected record: null,destroyed:false]>, formName = main, elementName = <no name>, timestamp = 2019-04-15 09:13:13.408,modifiers = 0,x =146,y = 37,data = null)
   at C:\Users\terry.QUANTECH\servoy_workspace\quantech\SnappMXStuff.js:370 (addTextField)


It is hard for me to understand why the TextField is fine but the JavaScript variable has a problem.

I see that there is an option when importing a solution called:

Allow reserved SQL keywords - This option will allow reserved SQL keywords to be used for names in the database


Is there a way to apply that to a solution being developed?

thanks,

Terry
tkilshaw1553613063
 
Posts: 18
Joined: Tue Mar 26, 2019 5:11 pm

Re: MySQL Keyword problem

Postby tkilshaw1553613063 » Mon Apr 15, 2019 8:32 pm

I have tried making a screen that has these other reserved keywords: Engine, Status.

I was able without any problem to create both the TextField and JavaScript variable with a dataProvider value of Engine or of Status. And those are both MySQL Keywords.

Anyone have any thoughts on this?
tkilshaw1553613063
 
Posts: 18
Joined: Tue Mar 26, 2019 5:11 pm

Re: MySQL Keyword problem

Postby tkilshaw1553613063 » Mon Apr 15, 2019 11:30 pm

After more exploration I'm starting to suspect the following, subject to correction by those who actually know what is going on:

1) That the Servoy Developer runs in a mode where it does not give errors for the use of SQL keywords

2) Because "Security" is a Servoy keyword, using that for a JavaScript variable name produces an error.

That still leaves unclear to me what it means to have a screen widget like a TextField with a dataProvider name of MyColumn and a JavaScript variable with a dataProvider name of MyColumn.

I have seen that in example code but nothing in the Servoy Wiki explains what if means or is used for, if anything.

Can anyone shed any light on that?

thanks,

Terry
tkilshaw1553613063
 
Posts: 18
Joined: Tue Mar 26, 2019 5:11 pm

Re: MySQL Keyword problem

Postby Joas » Tue Apr 16, 2019 12:39 pm

tkilshaw1553613063 wrote:That still leaves unclear to me what it means to have a screen widget like a TextField with a dataProvider name of MyColumn and a JavaScript variable with a dataProvider name of MyColumn.

I'm not entirely sure what you want to know, but to use a textfield, it needs to have a data provider. This can be a column from a table, but also a form variable or scope variable.
If a user enters a value in the field, it ends up in the column or variable and vice versa.
Having a textfield without a dataprovider doesn't make much sense, because you can't really get the value if the field was filled.
Joas de Haan
Yield Software Development: Need help on your project?
yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 808
Joined: Mon Mar 20, 2006 4:07 pm
Location: Amersfoort, NL

Re: MySQL Keyword problem

Postby tkilshaw1553613063 » Tue Apr 16, 2019 5:29 pm

Joas,

my thanks again.

Your reply helps a bit and what you have written would certainly be of value in the Wiki.

That still leaves me with horsey and ducky question of, how do you get the value of a TextField that has a column data provider?

Terry
tkilshaw1553613063
 
Posts: 18
Joined: Tue Mar 26, 2019 5:11 pm

Re: MySQL Keyword problem

Postby Joas » Tue Apr 16, 2019 5:56 pm

See my answer here, because it is basically the same question :)
Joas de Haan
Yield Software Development: Need help on your project?
yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 808
Joined: Mon Mar 20, 2006 4:07 pm
Location: Amersfoort, NL


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 2 guests

cron