Jump to content
Sign in to follow this  
PenelopeSkye

Find all mentions of the database

Recommended Posts

I created a test database and pointed the connection string to it, and I found 1 other place where the database name is mentioned after searching in all files.

 

Unfortunately although some of the code works to insert into the database, not everything does, and I am thinking that there are other places indicating the database that I am not finding by using the search function.

 

Does anyone know how to find other places where code is pointed to a database or do I need to search through every object?

 

Thanks!

Share this post


Link to post

we use agent ransack for searching things like this, found on: Agent Ransack – Mythicsoft

then search on all *.pas, *.dfm, *.fmx files.

 

But if you smart then you use a TDatamodule, where you put yout connection in/on, and in other units you point to that connection, (maybe nog the connection itself), but ask the datamodule for a new connection instance etc.

 

Share this post


Link to post

if the "text desired" is in "text format (not coded, hex, binary, etc...) then, you can try use the "Search in Files" in Edit menu from Delphi...

  • Text to find =  << your text >>  (not whole world...)
  • Search in ALL FILES in PROJECT...
  • file mask =    (empty  or *.* )
  • dir =   << your project fodler >>

is this?

Edited by programmerdelphi2k

Share this post


Link to post
On 3/27/2023 at 7:51 PM, PenelopeSkye said:

I created a test database and pointed the connection string to it, and I found 1 other place where the database name is mentioned after searching in all files.

 

Unfortunately although some of the code works to insert into the database, not everything does, and I am thinking that there are other places indicating the database that I am not finding by using the search function.

 

Does anyone know how to find other places where code is pointed to a database or do I need to search through every object?

 

Thanks!

Are you working on an older project written by someone else? Which database framework does it use, FireDAC, IBObjects, ADO (dbGo), BDE, some 3rd-party framework?

 

In a properly designed DB app there should be only one place that uses the actual database name: the object handling the database connection/session . All other objects accessing the database should use this connection instance. A possible exception are apps that need to work with the same database from more than one thread, since DB sessions are usually bound to the thread that creates them.

Share this post


Link to post

You can use "grep" command line application (at command prompt).

 

I use that to find reference of something in source directory of Rad Studio.

 

I.e.: serching the word database in all PAS files in every subdirectories. You can repeat with *.DFM to search such reference in the object property.

Quote

grep -i -d "database" *.pas

 

Edited by DelphiUdIT

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×