Can a parameter safely be removed from a Delphi TADOCommand at runtime - delphi

My Delphi 2006 TADOCommand has it's
CommandText (including parameters),
Prepared (True),
ParamCheck (True)
properties all set at design time.
Is there a way for me to go about deleting some of it's Parameters at run time, without having to change the CommandText to accomodate these changes. This is desireable in the case that some of the table columns that the parameters reference do not need updating/inserting.
I'm thinking of something along the lines of
TADOCommand.Parameters.ParamByName('MyParam').SafelyRemove;
Many Thanks,
Duncan

Each item in Parameters collection corresponds to parameter marker in the command text. It is like API to this marker. Removing items from Parameters will not remove the corresponding marker. If you does not need to touch some field in your command text, then you have to modify command text and remove corresponding parameter marker.
When command text is prepared, the DBMS has built command execution plan and allocated some resources, required for command execution. If you will change the command text, then DBMS has to build new command execution plan.
Kind of that ...

Because parameters placeholders (:PARAMn) are embedded in the SQL text, I don't see how you can add or remove parameters without changing CommandText. You would have a mismatch.

In case when the command text is dynamic-updateble i usually working with params like this: *Parameters.Clear; Parameters.ParseSQL(ADOCommand.CommandText, true); * it will automatically create parameter list with correct parameters names.

Related

Is there a way to view / edit the definition of a computed variable after it has been created?

I have created some new computed variables in SPSS. I would like to be able to view the definitions (to check for errors) and possibly edit them after the fact. I cannot find a way to do this or find any advice on the internet.
I can see the definitions in the saved syntax file but there does not seem to be a way to pull the definitions up and view them from the SAV file itself.
Note that this is NOT the same thing as recoding a variable - I want to be able to bring up something like the new variable dialog box for an existing computed variable, view the definition and, if necessary, edit it.
Double-click on the relevant output in your .SAV file.
Select, copy, and paste the COMPUTE statement to a Syntax file.
Edit the COMPUTE statement as desired.
Add the command EXECUTE. after the COMPUTE statement.
Select this block of code.
Click on the 'play' button in the ribbon (or, select Run > Run Selected).
This will recompute the variable.
CAUTION: When you run COMPUTE from syntax, you don't get the warning asking if you want to replace the existing variable.

Default array content in build process

I have added a new argument into the argument-list, which should have default values.
It is declared as a System.String[] but I can't figure out how to give it values. Giving values through Queue new Build works fine, but it is time taking to type in all values each time.
I guess it's pretty simple but I just can't figure out how the Syntax is working while editing a build process.
Thanks in Advance
You need to add it to Metadata and change the item of View this parameter when dropdownlist in Process Parameter metadata editor (e.g. Only while editing a definition).
You also can specify default value of that parameter when edit build process template, such as {"str1","str2"}.
There is a similar thread: How to put build process parameters into categories in TFS?

Is there a way to avoid the target table in informatica (powercenter)?

In informatica mapping design, there must be a target table, but in my design, I only use informatica to call store procedures, and after they were called, all work has been done, so I don't need a target table to be inserted or updated.
I used a non-exist table as the target table, and one nonsense field as the input port(cause there must be at least one input port!), then unchecked or the option(insert, update,delete) in the session configuration, so that the informatica would not generated DML SQL statements, avoiding "no table" errors.
But then informatica treat the input row as reject row and try to write it into a bad file. And cause I unchecked the insert option, the session log showed that there was an error that it couldn't be insert into the bad file!
Strangely, this error never showed in the monitor, and all session run successfully! It only appeared in informatica's meta table.
Is there a better way to avoid this problem, although it has no effect to my result? Is there a possibility to use a non-exist table and do nothing to it (include reject the input rows)?
Use a filter transformation just before the target and put filter condition 'FALSE'
No rows will go to the target
I had run into this same issue when i wanted to just execute a stored procedure and nothing else.
I solved this by creating a dummy source object that had one port and a dummy target with one port of the same datatype. In the source qualifier I added a SQL statement select 1 from dual (since it's Oracle).
I then added a filter object that was set to false. Then I connected the single port from the source/qualifier through the filter and finally to the target.
When the mapping is run, the source qualifier will return 1 row of one value, this will pass through to the filter but nothing will come out of the filter because the filter is set to false. This mapping will always be successful and valid because all ports are connected a nothing makes it to the "dummy" target thus no bad file logs or failure, etc.
Let me know if you need any clarification and I can update this answer.
No, you always need a target for the mapping to be valid. But I would rather work with a flat file target instead of a database table, you'll have much less work to do.
If you're on Linux / Unix, you can even route the file to /dev/null (use folder:/dev/, file:null) so the file is not actually written to the filesystem.
And using one dummy port is the right way. As you have said, you need at least one port, even if you don't really use it.
As odd as this may sound (Unix systems): neither source, nor target need to exist.
Source (flat file): /dev/null, column DUMMY
Target (flat file): /dev/null, column DUMMY
And you don't need to use any databases for the session to succeed, nor use any filters. It runs.

AS400-CRTCMD Localization. Is it possible to change language at run time?

I am actually converting all DDS files to use MSGID instead of plain text. I can now change the display language of the application just by choosing the right library with the MSGF in French, English, ...
But for the commands, it seems that CRTCMD needs a language file at compile time (with PMTFILE) and uses theses strings to generate the command. I could eventually delete the MSGF but the command will display the texts.
What I want to achieve is using the same *CMD object and be able to change the language when needed at run time.
**Edit: assuming a currently supported release, 6.1 or higher...
I think you want to use *DYNAMIC on the CRTCMD PMTFILE() parameter
*DYNAMIC
When the command is prompted, prompt text messages
will be dynamically retrieved from the message file
specified for this parameter using the message
identifiers stored in the *CMD object when the command
was created. The message identifier specified for the
PROMPT or CHOICE parameter on a CMD, PARM, QUAL, or
ELEM command definition statement must be found in the prompt text
message file when the command is being prompted.
So something like
CRTCMD CMD(MYLIB/MYCMD) PGM(MYLIB/MYPGM) SRCFILE(MYLIB/QCMDSRC)
SRCMBR(MYCMD) PMTFILE(*LIBL/MYMSGF *DYNAMIC)

How do I change the Build number format parameter while queuing a build

I am using Visual Studio Online for Source Control and Build processes. I created a new build definition using the TfvcContinuousDeploymentTemplate.12.xaml. When Queuing a new build from within VS I have the chance to change some parameters, but I can't change the Build number format. What determines what shows up on that parameter list and how can I make sure the Build number format appears there?
My suggestion is to investigate modifying the build template to:
1) Take a custom input value, which I believe you can change on each invocation of the build; and
2) Finding the appropriate step to interrogate the existing Build Number and modify it based on this input.
This should get you started:
http://msdn.microsoft.com/en-us/library/dd647551.aspx
Alternatively, you could remove the Build Number Activity in its entirety and substitute your own – but I don’t think these measures are warranted in this case. This would get you started down that trail:
http://blogs.msdn.com/b/willbar/archive/2010/01/21/generating-custom-build-number-in-tfs-build-2010.aspx
HTH –
jlo
To show the property you have to edit the template, expand the arguments, search for Metadata and click on the ellipse towards the right of the row. Find the property you want, in my case it is BuildNumberFormat and change the View this parameter when: Always show the parameter

Resources