Re: Stuck on native database functions

2021-07-13 Thread Bob Sneidar via use-livecode
Thanks for the confirmation. On the bright side, I am not likely to forget that again. :-) Bob S > On Jul 13, 2021, at 08:12 , R.H. via use-livecode > wrote: > > @Bob Sneidar > > Hello Bob > > The documentation bug was resolved in the latest version: > https://quality.livecode.com/show_bug

Re: Stuck on native database functions

2021-07-13 Thread R.H. via use-livecode
@Bob Sneidar Hello Bob The documentation bug was resolved in the latest version: https://quality.livecode.com/show_bug.cgi?id=23074 It was also tricky for me until I found out how to quote variables and arrays that point to data when sending data to my mySQL database as the documentation was not

Re: Stuck on native database functions

2021-07-09 Thread Bob Sneidar via use-livecode
Okay, so here's an updated version of my ArrayToSQLITE function. It takes an array, and as the name suggests, converts it to an sqLite database and returns the Database ID. Of note is that it now works with EMBEDDED ARRAYS! If it detects that a key is an array in the supplied array, it will crea

Re: Stuck on native database functions

2021-07-09 Thread Bob Sneidar via use-livecode
Okay I found out what I did wrong. The array variable needs to be enclosed in quotes. I remember now some time in the past looking at that and saying, "Why are their quotes around the array variable? That won't work!" So I removed them and subsequently shot myself in the foot. For the record,

Re: Stuck on native database functions

2021-07-07 Thread Mark Smith via use-livecode
Yes, using the numeric placeholders will do that for you. > On Jul 7, 2021, at 4:43 PM, Terence Heaford via use-livecode > wrote: > > It also seems to do the escaping for you as it handled text containing commas > in the description ___ use-livecod

Re: Stuck on native database functions

2021-07-07 Thread Terence Heaford via use-livecode
It also seems to do the escaping for you as it handled text containing commas in the description All the best Terry > On 7 Jul 2021, at 16:40, Terence Heaford via use-livecode > wrote: > > The routine I have working is > > put "uniqueID,date,type,description,amount,balance,category" into t

Re: Stuck on native database functions

2021-07-07 Thread Terence Heaford via use-livecode
Mark, it certainly helps me. The routine I have working is put "uniqueID,date,type,description,amount,balance,category" into tFields put merge("INSERT INTO [[tAccountName]] ([[tFields]]) VALUES(:1,:2,:3,:4,:5,:6,:7)") into tSQL revExecuteSQL dbGetID(), tSQL, "tValues[uniqueID]", "tValues[date]

Re: Stuck on native database functions

2021-07-07 Thread Mark Smith via use-livecode
Currently I have this working (Content of tSQL :) INSERT into TABLE1 ("complete", "todo", "itemDate", "category", "purgeDate", "dgOrder") values(:1, :2, :3, :4, :5, :6) revExecuteSQL gConnectID, tSQL, "ptheRowA[complete]", "ptheRowA[todo]", "ptheRowA[itemDate]", "ptheRowA[category]", "ptheRowA

Re: Stuck on native database functions

2021-07-07 Thread Terence Heaford via use-livecode
Out of interest and not sure if it is relevant but I have received this error: "table myTable has 8 columns but 7 values were supplied" Yes the table has 8 columns in total but the first column is recID integer primary key autoincrement Surely it should not give this error because I do not prov

Re: Stuck on native database functions

2021-07-07 Thread Terence Heaford via use-livecode
Just tried this method revExecuteSQL myID, "insert into mytable values(:1,:2,:1)", "valueX",”valueY" It did not work put merge("[[quote]][[tUniqueID]][[quote]],[[quote]][[tDate]][[quote]],[[quote]][[tType]][[quote]],[[quote]][[tDescription]][[quote]],[[quote]][[tAmount]][[quote]],[[quote]][[tBa

Re: Stuck on native database functions

2021-07-07 Thread Terence Heaford via use-livecode
I have now tried your method with the tValues array directly and by deconstructing the array as below and it does not work. I have a recollection of not being able to get this to work with an array which is why I did the way I did. All the best Terry put q(tAccountName) into tAccountName pu

Re: Stuck on native database functions

2021-07-06 Thread Terence Heaford via use-livecode
Here’s an example I have been using, not sure whether it will help: function dbAddTransaction tAccountName,tValues put q(tAccountName) into tAccountName put q(tValues["uniqueID"]) into tUniqueID put q(tValues["date"]) into tDate put q(tValues["type"]) into tType put q(tValues["description"])

Re: Stuck on native database functions

2021-07-06 Thread Rick Harrison via use-livecode
Hi Bob, Some quick questions: 1. What version of LiveCode are you using? 2. Are you on Mac or Windows or Linux? 3. Are you using MySQL or PostgreSQL? Have you ever tried using the free version of Valentina Studio to help you with managing your databases? It’s quite nice! Let us know! Rick >

Re: Stuck on native database functions

2021-07-06 Thread Bob Sneidar via use-livecode
So I checked out the lessons. I do not find anything there for using substitutions like :1, :2. I am getting records inserted but with empty data. Really frustrating. I could use literal data, which I tested, and which works, but my real data contains commas, and in the future may contain any

Re: Stuck on native database functions

2021-07-06 Thread Bob Sneidar via use-livecode
Well that won't work. How does it know I want to insert the data in aRecordData? Also I put quotes around the column names but got the same results. Bob S > On Jul 6, 2021, at 16:14 , Devin Asay via use-livecode > wrote: > > revExecuteSQL “aRecordData” > > Not tested, but I’m pretty sure

Re: Stuck on native database functions

2021-07-06 Thread Devin Asay via use-livecode
Bob, A couple of things: You should either be passing variable names, not variable contents, so put your variable names in quotes. revExecuteSQL “tDBID", “tInsertSQL", “tControlName”, etc OR you should be passing the name of an array variable, whose keys are numeric: revExecuteSQL “aRecordDa

Stuck on native database functions

2021-07-06 Thread Bob Sneidar via use-livecode
Hi all. I assemble an SQL statement that looks like this: insert into ObjectProperties (recordid,rect,controlname,owner,visible) VALUES (:1,:2,:3,:4,:5) I then execute this statement: revExecuteSQL tDBID, tInsertSQL, aRecordData I get records but with no data in them. I checked aRecordData