Forum > Databases
Replace substring in a field and update DB
WJSwanepoel:
I am new to Lazarus and FreePascal and need some help.
I have a small program which opens a SQLite3 database and which does a TSQLQuery on a table in the database:
Select topic_id, cast(data as varchar) as data1 from content; [data is a rtf BLOB]
I now wish to process all records returned by the TSQLQuery where I replace a substring ("19.3.2") of data1 with "19#3#1". I then wish to update the changed record in the query results and on the physical database.
How do I achieve this?
Nicole:
Which component do you use to connect Lazarus to the db?
WJSwanepoel:
Currently I use TSQLConnector.
I Notice there is also one called TSQLite3Connection - is this the better one to use? If so I would still need guidance with how to process records in a query as stated in my post.
Nicole:
Does this help you?
https://wiki.freepascal.org/TSQLite3Connection
As I am working with Firebird, I am not good at other databases.
I use IBX with much comfort, not sure, if it works with SQListe as well.
But I am sure, here are a lot of people around who do know.
In other words: If you have more than one task, perhaps you may post an request for components and tutorials.
WJSwanepoel:
Hi Nicole,
Thanks for the link, it looks promising and I will give it a go.
I gave it a go. The code at that link (https://wiki.freepascal.org/TSQLite3Connection) does not even execute! It fails on exitcode 217.
Navigation
[0] Message Index
[#] Next page