Re: Stuck on native database functions
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"]) into tDescription put q(tValues["amount"]) into tAmount put q(tValues["balance"]) into tBalance put q(tValues["category"]) into tCategory put "uniqueID,date,type,description,amount,balance,category" into tFields put merge("[[tUniqueID]],[[tDate]],[[tType]],[[tDescription]],[[tAmount]],[[tBalance]],[[tCategory]]")into tValues put merge("INSERT INTO [[tAccountName]] ([[tFields]]) VALUES([[tValues]])") into tSQL revExecuteSQL dbGetID(), tSQL put the result into tErr return tErr end dbAddTransaction - function dbEscapeSqlite tText replace "'" with "''" in tText return tText end dbEscapeSqlite --- function q tText return "'" & dbEscapeSqlite(tText) & "'" end q --- > On 7 Jul 2021, at 00:06, Bob Sneidar via use-livecode > wrote: > > 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 and it has all > 5 columns as keys and data in each of them. > > I am at a complete loss. I was sure this was working before, now it is not. > > Bob S > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Stuck on native database functions
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 > On Jul 6, 2021, at 7:51 PM, Bob Sneidar via use-livecode > wrote: > > 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 number of special > characters that I will have to escape. Not my idea of fun. > > I was hoping to do a "quickie" implementation but it seems I will have to run > this through sqlYoga like everything else I do these days. > > Bob S > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Stuck on native database functions
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 number of special characters that I will have to escape. Not my idea of fun. I was hoping to do a "quickie" implementation but it seems I will have to run this through sqlYoga like everything else I do these days. Bob S > On Jul 6, 2021, at 16:26 , Bob Sneidar via use-livecode > wrote: > > 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 if you sort these things it will start to >> work for you. >> >> - Devin > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Stuck on native database functions
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 if you sort these things it will start to > work for you. > > - Devin ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Stuck on native database functions
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 “aRecordData” Not tested, but I’m pretty sure if you sort these things it will start to work for you. - Devin > On Jul 6, 2021, at 5:06 PM, Bob Sneidar via use-livecode > wrote: > > 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 and it has all > 5 columns as keys and data in each of them. > > I am at a complete loss. I was sure this was working before, now it is not. > > Bob S > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode Devin Asay Director Office of Digital Humanities Brigham Young University ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Stuck on native database functions
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 and it has all 5 columns as keys and data in each of them. I am at a complete loss. I was sure this was working before, now it is not. Bob S ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: [ANN] Release 9.6.3 RC-1
Panos: > LiveCode 9.6.3 RC-1 comes with more than 60 changes Thanks, I will aim to do some rc1 testing this week and next week. Best wishes, Curry Kenworthy Custom Software Development "Better Methods, Better Results" LiveCode Training and Consulting http://livecodeconsulting.com/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode