Changing Analysis - Resyncing Queries

Startbeitrag von Alan Evans am 25.10.2013 09:21

Hi,

I'm not sure if this is something I'm not aware of or if it's just a problem with WinDev?

I've got some INSERT queries written, I make a change on my analysis, adding some more fields, do an analysis recompile, choose the Sync Project with Analysis, but still my INSERT queries are missing the new fields? No matter what I do, I cannot get the queries to have the new fields applied. I know I can re-write the queries, but that is a massive pain in the a*se !! Is there something I'm not doing here, any help given gratefully received !

Thanks

Alan

Antworten:

Hi Alan,

Queries have to be updated by you.
There's no way WX can know which items you want to include in your queries.
On the other hand, the support for data structure modifications could be better.
Inconsistencies between data description and queries are not automatically picked up by the compiler. You need to open a query, right click it to see if the option "consistency with the analysis" is un-grayed.
Also, I believe that the "Static audit" of the project will detect such inconsistencies.
But again, items added to a file will not automatically be added to queries.

Regards,
Piet

von Piet van Zanten - am 25.10.2013 11:26
Hi Piet,

Thanks for the reply, I'll try having a look at what you suggested. Although I agree that WX cannot know what 'new' items I want on my query, it's very frustrating that I'm unable to simply open the query up, (in the case of an Insert query), and just select the new fields to apply. Instead I have to effectively re-code the query from scratch, unless I open it up as SQL Code and make the alterations like that.

Regards
Alan

von Alan Evans - am 25.10.2013 15:49
Alan, nasty old bug.
Which version of WX are you using? V18 already, so still a bug?

von Arie - am 25.10.2013 16:08
Hi Alan,

Do you mean that if you select the query tab the new items don't show in the list?
That would definitely be a bug.
Perhaps the old routine of deleting the .cpl directory can fix it.
You say you use many update queries, this makes me wonder why?
I use only a few update queries, e.g. to set a flag in a file.
For normal updates the hModify command is recommended by PCSoft.
That is why probably not many WXers use update queries in such a manner and it has not been reported and/or fixed yet.

Regards,
Piet

von Piet van Zanten - am 26.10.2013 08:44
Hi,

I've been reading this thread and was about to reply when Piet posted just what I was about to say.

I'd also ask why so many queries? I only ever use queries to populate table controls and for reports. I never use anything other than SELECT in my queries because, as Piet states, the HModify, HAdd (etc) commands are the recommended way to go.

von DarrenF - am 26.10.2013 10:16
Depends what you are needing to do.

For single updates then HModify, HAdd, HDelete are fine but if you need to update large numbers of records the an update query is far far more efficient as
a. it only requires a single line of code.
b. runs on the server.
c. is what sql databases are designed to do.

This assumes that the data is correctly indexed of course.

I have illustrated to a number of people using a data set of just 250 records.
Increase this to 1000 - WD takes a lot longer, update query shows no difference.

Just my 2 euros worth

von DerekT - am 26.10.2013 13:34
Hi Derek

I agree that it is much faster... However, it is also a WAY LESS controlled process, with basically no possibility to put in place any error management code to speak of... When you loop and do a hmodify, you can process automatically any error for one specific record... Not so with a modify query.

Furthermore, for the life of me, I can't remember the last time I had to modify a flag (or anything else) in hundreds of records at the same time... I would say that 99% of the applications I have been writing are not using such logic... Lots of reading, a little writing, and hadd/hmodify/hdelete perfect for that

Best regards

von Fabrice Harari - am 26.10.2013 14:49
Hi All,

I use the Update queries because the tables we use have a LOT of fields to be updated in. I take Fabrice's point about the error control however, and it's a valid one. Perhaps I'd be better off biting the bullet and just writing HMODIFY commands.......especially with a new problem that has occurred several times now over the course of the last two weeks. This is where the condition for an UPDATE query has been lost, resulting in ALL records in a table being updated!!
I've taken a screen shot showing where the UPDATE query has a condition set, as in fieldname is equal to a certain value, but then when you edit the query the actual criteria, as in equals , less than, etc..... is missing, resulting in the selection condition never being applied and all records being updated with the same values! Thank God this is just on a development box! PCSoft need to stop adding on X number of features and get the existing code working correctly !

BTW, if anyone can tell me how to just paste an image into this, I'd be grateful. Note that I'm working off a laptop, not a server at this moment in time, so the Image URL option isn't really applicable.

Regards
Alan

von Alan Evans - am 27.10.2013 14:57
Alan
Thankfully I have not suffered the issue of query conditions going MIA.
You say this is 'development' - are you making changes to DB tables - adding columns, changing positions etc.
WD never takes this into account (see a recent post on this subject)

In my case I always know how many records I need the update query to process and always use tranaction processing.
My safeguard is to run another query (COUNT) following the update and if the values do not match then I roll-back the whole process

von DerekT - am 27.10.2013 17:05
Hi Derek,

I'm currently running the program just in development, but it WILL be going to a production box. If it replicated the same actions there as it has done in development, I'd be in big trouble !!

Are you running against Hyperfile tables? I'm using MS-SQL tables as that's the client's native database, I'm not sure how easy it is to set up transactional processing against those tables without having to faff around with HExecuteSQL commands? Needless to say, I've nw change my Update queries to pure HReadseek - Hmodify procedures now, I'd dare not risk another incident like that using queries.

Regards

Alan

von Alan Evans - am 27.10.2013 18:31
Alan
Yes, I am using HF C/S

For other transaction processing you need to look at SQLTransaction, SQLExec etc. in the Help

I have not used this method against MSSQL but did some time ago us it on a MySQL DB without any issues.
You would of course need to write the queries by hand.

von DerekT - am 28.10.2013 12:24
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.