Board index » delphi » Stored Procedure not finding matching Blob that was already added

Stored Procedure not finding matching Blob that was already added


2005-01-07 05:35:31 AM
delphi45
This is going to take a little explaining...
I have a program whose datamodule contains nested datasets. E.g., I am using TSQLDatasets with a provider, client datasets, and datasources for my data nesting.
I also have a TSQLStoredProcedure connected to my database's stored procedure which searches through records trying to find Blobs with matching data. The table it searches through, we'll call the table "INFO", is the database table that one of the nested datasets represents.
My algorithm goes something like this: I have a new piece of data which I pass into the stored procedure, the stored procedure searches the "INFO" tables' Blobs to find matching data, if matching data isn't found, it returns -1, otherwise, it returns the Primary Key ID of the matching "INFO" record.
If I receive a -1 from the stored procedure, I add a new record to the "INFO" client dataset and I add the new data into the new record's Blob field ( I then apply updates ), otherwise, I use the returned key id for other processing. I may perform this operation with several loops of different new/matching data and the stored procedure consistently finds the matching Blob data even after creating the new record and applying updates. However...
If I have another application ( on my computer or another computer ) that is connected to the same database it will not find the newly created matching Blob data in the "INFO" table anymore. I have been able to replicate this inconsistent behavior as follows: I can create a new application and add to its form an SQLConnection, TSQLDataset, and a TDatabaseProvider, and open the SQLDataset in the new application.
It is only when the TDatabaseProvider is added to the other new application and the Dataset is opened that my program's stored procedure will begin to fail finding the matching Blob. It will only begin working once I close the new application's SQLConnection.
Please help.
I'm using the default properties for the provider except I am cascading deletes and adds, and I have the UpdateWhereKeyOnly for my update mode. I have changed the update mode to where changed and that still didn't work.
I am also using the default parameters for the sqlconnection but I have set commitretaining to false and that doesn't work either.
Thank you.
Brian Thomas
 
 

Re:Stored Procedure not finding matching Blob that was already added

Doesn't anyone have any ideas?
"Brian Thomas" <XXXX@XXXXX.COM>writes:
Quote

This is going to take a little explaining...

I have a program whose datamodule contains nested datasets. E.g., I am using TSQLDatasets with a provider, client datasets, and datasources for my data nesting.

I also have a TSQLStoredProcedure connected to my database's stored procedure which searches through records trying to find Blobs with matching data. The table it searches through, we'll call the table "INFO", is the database table that one of the nested datasets represents.

My algorithm goes something like this: I have a new piece of data which I pass into the stored procedure, the stored procedure searches the "INFO" tables' Blobs to find matching data, if matching data isn't found, it returns -1, otherwise, it returns the Primary Key ID of the matching "INFO" record.

If I receive a -1 from the stored procedure, I add a new record to the "INFO" client dataset and I add the new data into the new record's Blob field ( I then apply updates ), otherwise, I use the returned key id for other processing. I may perform this operation with several loops of different new/matching data and the stored procedure consistently finds the matching Blob data even after creating the new record and applying updates. However...

If I have another application ( on my computer or another computer ) that is connected to the same database it will not find the newly created matching Blob data in the "INFO" table anymore. I have been able to replicate this inconsistent behavior as follows: I can create a new application and add to its form an SQLConnection, TSQLDataset, and a TDatabaseProvider, and open the SQLDataset in the new application.

It is only when the TDatabaseProvider is added to the other new application and the Dataset is opened that my program's stored procedure will begin to fail finding the matching Blob. It will only begin working once I close the new application's SQLConnection.

Please help.

I'm using the default properties for the provider except I am cascading deletes and adds, and I have the UpdateWhereKeyOnly for my update mode. I have changed the update mode to where changed and that still didn't work.

I am also using the default parameters for the sqlconnection but I have set commitretaining to false and that doesn't work either.

Thank you.

Brian Thomas



 

Re:Stored Procedure not finding matching Blob that was already added

After more debugging I have found that the Blobs are in existence after applying updates. What I have found though is that I have a UDF that has an initializes section in it but when the TSQLConnection opens the connection to the database, the initializes section never gets fired. In the initializes I call coinitialize( nil ) because I am using TXMLDocument functionality to read the xml that are in my Blob's and it is not getting called. When an IBX database component connects to the database the initializes section gets called but not when opened by TSQLConnection. Any ideas why?
"Brian Thomas" <XXXX@XXXXX.COM>writes:
Quote

This is going to take a little explaining...

I have a program whose datamodule contains nested datasets. E.g., I am using TSQLDatasets with a provider, client datasets, and datasources for my data nesting.

I also have a TSQLStoredProcedure connected to my database's stored procedure which searches through records trying to find Blobs with matching data. The table it searches through, we'll call the table "INFO", is the database table that one of the nested datasets represents.

My algorithm goes something like this: I have a new piece of data which I pass into the stored procedure, the stored procedure searches the "INFO" tables' Blobs to find matching data, if matching data isn't found, it returns -1, otherwise, it returns the Primary Key ID of the matching "INFO" record.

If I receive a -1 from the stored procedure, I add a new record to the "INFO" client dataset and I add the new data into the new record's Blob field ( I then apply updates ), otherwise, I use the returned key id for other processing. I may perform this operation with several loops of different new/matching data and the stored procedure consistently finds the matching Blob data even after creating the new record and applying updates. However...

If I have another application ( on my computer or another computer ) that is connected to the same database it will not find the newly created matching Blob data in the "INFO" table anymore. I have been able to replicate this inconsistent behavior as follows: I can create a new application and add to its form an SQLConnection, TSQLDataset, and a TDatabaseProvider, and open the SQLDataset in the new application.

It is only when the TDatabaseProvider is added to the other new application and the Dataset is opened that my program's stored procedure will begin to fail finding the matching Blob. It will only begin working once I close the new application's SQLConnection.

Please help.

I'm using the default properties for the provider except I am cascading deletes and adds, and I have the UpdateWhereKeyOnly for my update mode. I have changed the update mode to where changed and that still didn't work.

I am also using the default parameters for the sqlconnection but I have set commitretaining to false and that doesn't work either.

Thank you.

Brian Thomas