Forum > Other

Issue with global find/replace affecting SQL query

(1/2) > >>

Graham Saint:
Not sure if this counts as a bug but I think it's an issue worth mentioning.
I recently did a global find/replace on all files in  my project. In doing this I accidently renamed a SQL query that was in a data module. For some reason the rename affected the SQL query in the data module's unit source but not in the data module's form view.
So if you viewed the module's form the query was SQL1 but in the unit source it was renamed to SQLX.
The net result of this was that the program crashed with an addressing exception  when it attempted to use one the query's methods.
I'm a bit surprised that the program was able to compile.
Is this a known issue?

af0815:
It is not a issue, if have it renamed by hand. A search and replace only will create mess. The crash is inside the reader, because it found not the renamed component. It was only renamed in source but not in the lfm.

Always use F2 or use Menu Souce->Refactoring->Renemame Identifier.

dseligo:

--- Quote from: af0815 on July 20, 2022, 01:12:30 pm ---It is not a issue, if have it renamed by hand. A search and replace only will create mess. The crash is inside the reader, because it found not the renamed component. It was only renamed in source but not in the lfm.

Always use F2 or use Menu Souce->Refactoring->Renemame Identifier.

--- End quote ---

While I agree that using search and replace will create mess, you are wrong about using F2 and refactoring.
Components on the form aren't updated using F2 - you have to use Object inspector to rename components on the form.

I would like that form components are also renamed with F2, but I don't know if it is intentional like that or a bug.

af0815:

--- Quote from: dseligo on July 20, 2022, 01:27:59 pm ---While I agree that using search and replace will create mess, you are wrong about using F2 and refactoring.
Components on the form aren't updated using F2 - you have to use Object inspector to rename components on the form.

--- End quote ---
sorry, you are right, but it was so an automated task by me

Graham Saint:
I used global find/replace because I had a bunch of type definitions in a low level unit that many other units referenced. As the program grew it became clear that the original names chosen weren't the best and I decided to give them better ones. Doing this by hand would have been a very long process. In hindsight I should have used the "Whole Words Only" option but I didn't think I needed to.
I'd class this as a bug, albeit an obscure one, because throwing the lfm and source out of alignment resulted the program crashing without warning. Maybe the compiler could check for an inconsistency and issue a warning?

Navigation

[0] Message Index

[#] Next page

Go to full version