Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 6 of 6 total |
Udating Memo CLOB / BLOB fields via SQL |
Wed, Sep 17 2008 11:27 AM | Permanent Link |
adam | I am just getting started, having worked for ages with DBISAM.
If I want to pass memo-fields back to the table using EDB what is the best way to do it? Note that my memo fields might contain single-quote, double-quote or end-of-line characters. I think the way I did it with DBISAM (roughly) was: aQuery.SQL.Text := 'UPDATE Stories SET Memo = :Memo WHERE ID= 2134'; aParam.Create; aParam.Value := Memo1.Text; aQuery.ParamByName('Memo') := aParam But I can see things work differently with EDB, especially with the addition of this new "Engine" object Adam |
Thu, Sep 18 2008 5:46 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Adam,
<< If I want to pass memo-fields back to the table using EDB what is the best way to do it? >> You can do it any number of ways. << Note that my memo fields might contain single-quote, double-quote or end-of-line characters. >> EDB does not care either way. << I think the way I did it with DBISAM (roughly) was: aQuery.SQL.Text := 'UPDATE Stories SET Memo = :Memo WHERE ID= 2134'; aParam.Create; aParam.Value := Memo1.Text; aQuery.ParamByName('Memo') := aParam >> Do this: with aQuery do begin SQL.Text := 'UPDATE Stories SET Memo = :Memo WHERE ID= 2134'; ParamByName('Memo').Assign(Memo1); ExecSQL; end; << But I can see things work differently with EDB, especially with the addition of this new "Engine" object >> Actually, DBISAM also had an engine object - TDBISAMEngine. The two are very similar in this respect. However, the engine has no direct bearing on the above operation. -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Sep 18 2008 1:32 PM | Permanent Link |
adam | >Do this:
>with aQuery do > begin > SQL.Text := 'UPDATE Stories SET Memo = :Memo WHERE ID= 2134'; > ParamByName('Memo').Assign(Memo1); > ExecSQL; > end; Thank you for this Tim. The thing is I don't know what the CLOB fields will be until I post, so I have to dynamically create params on the Query at run-time I am trying to do it like this: Query.Close; Query.Unprepare; Query.Params.Clear; Query.SQL.Text := aSQLStr; for i := 0 to FieldCount - 1 do begin if (Fields[i].DataType=ftMemo) and (Fields[i].tag=1) then //I am using the tag property on the field to mark if a user has edited it begin Query.Params.Add; Query.Params[Query.ParamCount-1].Name := Fields[i].FieldName; Query.ParamByName(Fields[i].FieldName).Assign(Memo1); end; end; ShowMessage(Query.SQL.Text); //just using this at the moment to see what comes out // Query.ExecSQL; At the moment all that comes out is "UPDATE TableName Set Address = :Address" The value of the memo isn't getting "in" Adam |
Fri, Sep 19 2008 2:45 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | adam
I noticed that a bit ago. I don't know wether its supposed to or not but what you're shown is the "base" sql not the sql with the parameters substituted. Try running it and you'll see it works. Roy Lambert [Team Elevate] |
Fri, Sep 19 2008 4:18 AM | Permanent Link |
adam | D'Oh,
Thanks Roy, I should have actually run it before posting. It does work fine! |
Fri, Sep 19 2008 6:45 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Adam,
<<The thing is I don't know what the CLOB fields will be until I post, so I have to dynamically create params on the Query at run-time >> I'm not sure what you mean by this. The parameters can only be set to what matches the parameters in the SQL, therefore whatever you specify as the SQL is going to determine what parameters are populated (ParamCheck=True), and adding new parameters is incorrect. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, April 27, 2024 at 08:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |