revDatabaseColumnNames: revdberr,syntax error"

Creating desktop or client-server database solutions?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am
Location: Genoa- Italy

revDatabaseColumnNames: revdberr,syntax error"

Post by francof » Thu Mar 10, 2016 11:26 am

Hi all,
right from the dictionary:
get revDatabaseColumnNames(tConnectionId, "myTable")

I tried this

Code: Select all

get revDatabaseColumnNames(connID, "tcurtab")
connID have a valid connection number
tcurtab contain a valid table name
and also in this line:

Code: Select all

put revDatabaseColumnNames(connID, curtab ) into titoli 
tried without double quotes
I got error: " card "Data": execution error at line n/a (External handler: exception) near "revdberr,syntax error" "

where I wrong?

best
franco

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: revDatabaseColumnNames: revdberr,syntax error"

Post by Simon » Thu Mar 10, 2016 12:17 pm

Hi Franco,
Is connID a global variable?
My first guess.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am
Location: Genoa- Italy

Re: revDatabaseColumnNames: revdberr,syntax error"

Post by francof » Thu Mar 10, 2016 5:17 pm

ciao Simon,

connID is a custom property of the stack, and a temp variable also:

Code: Select all

...
put the connID of this stack   into connID
   if connID is not empty then
      #recuperiamo le colonne
      --get revDatabaseColumnNames(connID, "curtab")
      put revDatabaseColumnNames(connID, curtab ) into titoli
...   
I am testing the code found here http://livecodeshare.runrev.com/stack/7 ... administer

franco

SparkOut
Posts: 2067
Joined: Sun Sep 23, 2007 4:58 pm

Re: revDatabaseColumnNames: revdberr,syntax error"

Post by SparkOut » Fri Mar 11, 2016 8:04 am

Where tcurtab is a variable containing the table name it should not be quoted, the query will be looking for a table literally named "tcurtab". (Your first example).

If the table name literally is "curtab" then it should be in quotes ( your second example).

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am
Location: Genoa- Italy

Re: revDatabaseColumnNames: revdberr,syntax error"

Post by francof » Fri Mar 11, 2016 5:09 pm

SparkOut wrote:Where tcurtab is a variable containing the table name it should not be quoted, the query will be looking for a table literally named "tcurtab". (Your first example).

If the table name literally is "curtab" then it should be in quotes ( your second example).
Hi,
so in the exemple of the dictionary:
get revDatabaseColumnNames(tConnectionId, "myTable")
myTable is a constant?

here the original code who give error:

Code: Select all

on aggiornatabella   
   put the label of button tabelle into curtab
   #puliamo la tabella
   set the dgData of group "tabellona" to empty
   #connessione
   put the connID of this stack   into connID       
   if connID is not empty then
      #recuperiamo le colonne
      put revDatabaseColumnNames(connID, curtab ) into titoli      
      replace "," with return in titoli
      #aggiungiamo il rowid della riga per rendere unica la selezione
      put  "rowid" & return before titoli
      set the dgProp["columns"]  of group "tabellona" to titoli      
      #recuperiamo i dati      
      put "SELECT rowid,* FROM " & curtab  into tSQL 
      ##old way to populate datagrid
      ##put revDataFromQuery(tab,return,connID,tSQL) into tRecords
      ##set the dgtext of group "tabellona" to tRecords
      ##new way
      put revQueryDatabase( connID, tSQL) into theCursor
      ConvertSQLCursorToArray theCursor, theDataGridArray
      set the dgData of group "tabellona" to theDataGridArray      
      revCloseCursor theCursor
      ##
      set the dgColumnWidth["rowid"] of group "tabellona" to 30      
      set the dgColumnTooltip["rowid"] of group "tabellona" to "This is internal, it doesn't exist"
      set the dgColumnLabel["rowid"] of group "tabellona" to " " #se metti empty, usa il nome
   end if         
end aggiornatabella
Downloadable here http://livecodeshare.runrev.com/stack/7 ... administer

best
franco

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: revDatabaseColumnNames: revdberr,syntax error"

Post by quailcreek » Sat Mar 12, 2016 5:17 pm

I would suggest not using the same variable name in both places.

Code: Select all

put the connID of this stack into connID

Code: Select all

put the uConnID of this stack into tConnID
Tom
MacBook Pro OS Mojave 10.14

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am
Location: Genoa- Italy

Re: revDatabaseColumnNames: revdberr,syntax error"

Post by francof » Sun Mar 13, 2016 12:31 pm

quailcreek wrote:I would suggest not using the same variable name in both places.

Code: Select all

put the connID of this stack into connID

Code: Select all

put the uConnID of this stack into tConnID
Hi Tom
I've changed the names as you suggested but error still remain.

ciao
franco

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: revDatabaseColumnNames: revdberr,syntax error"

Post by quailcreek » Sun Mar 13, 2016 5:48 pm

Take out the comma after rowid and the *.

Code: Select all

put "SELECT rowid,* FROM " & curtab  into tSQL

Code: Select all

put "SELECT rowid FROM " & curtab  into tSQL
Also, it's a good idea to quote literals.

Code: Select all

put the label of button "tabelle" into curtab
Tom
MacBook Pro OS Mojave 10.14

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am
Location: Genoa- Italy

Re: revDatabaseColumnNames: revdberr,syntax error"

Post by francof » Sun Mar 13, 2016 7:22 pm

once again error at same line

Code: Select all

put revDatabaseColumnNames (tConnID, curtab ) into titoli
do you have tried to download the complete code? and if yes do it works for you?
quailcreek wrote: ...
Also, it's a good idea to quote literals.

Code: Select all

put the label of button "tabelle" into curtab
I always do this. in this case I haven't controlled the whole code.

best
franco

Post Reply

Return to “Databases”