Pipeline Extension |
Ver. 1.00 Contributed by Savoulidis Iordanis |
What
Why
Generally, the pipeline object works with only one transaction pair and only one pipeline object. I tried to give the programmer the ability to overcome this, with some kind of black box solution. You might think of this user object, as a medium for replicating data across databases !
First of all here are the benefits of the user object:
- The programmer can register/unregister more than one pair of transaction objects into the uo.
- In each pair, he can assign more than one pipeline objects to be executed. The number of pipeline objects in each pair, can vary.
- Optionally, he can assign pictures (frames) to be animated while the pipeline objects are executed.
- He also can assign the buttons that will handle the starting/pausing/stopping/skipping the transfer procedure. If he pauses the transfer, he can also restart it from the pipeline on which it was stopped.
THE IMPLEMENTATION
Note: All scripts use the PFC N_TR transaction object, and all controls on the window, must be PFC controls.
- Inherited from PFC_N_PL user oject.
- Added some instance variables:
- The most importand instance variable, is a structure array (istr_transfer[]) variable that holds the source (itr_source) and target (itr_target) transaction objects, and the array (is_pipeobject[]) of the pipeline objects that will be executed for each pair of transactions.
- Other variables include the buttons that will be used to handle the starting, stopping, pausing, repairing or skipping the pipelines.
- Added the following USER EVENTS (some of them provide arguments. Don't miss them):
- pfc_procedurestarted
(run at the beginning of the procedure)- pfc_procedurepaused
(run when the pause button is pressed)- pfc_procedurestopped
(run when the stop button is pressed)- pfc_procedureended
(run at the end of the procedure if it ends normally)- pfc_sourceconnected
(run when the source trans connects)- pfc_sourcedisconnected
(run when the source trans disconnects)- pfc_targetconnected
(run when the target trans is connects)- pfc_targetdisconnected
(run when the target trans disconnects)- pfc_transferstarted
(run for each pair of transaction objs, when starting to execute its pipeline objects - Outer loop)- pfc_transferended
(run when all the pipelines in the registered transfer-pair, are ended normally)- pfc_transferskipped
(run when the user skips the current transaction pair, and goes to the next one)- pfc_piperepairing
(run when the pipeline is being repaired)- pfc_pipeskipped
(run when the user skips the current pipeline, and goes to the next one)- pfc_pipeerror
(run when the execution of the pipeline, produces an error- pfc_pipeend
(run when the pipeline has finishes normally)These events are executed from inside the uo functions and the programmer can extend them, to provide response from the uo to the user (eg. log the action in a file as in the example provided, etc).
- Added the following FUNCTIONS:
- public function integerof_Register ( n_tr atr_source, n_tr atr_target, string as_pipeobject[])
- public function integerof_Unregister (ref n_tr atr_source, ref n_tr atr_target)
- public function integerof_GetRegisteredCount ()
- public subroutineof_GetCurrRegistered (ref us_transfer astr_transfer)
- public function integerof_GetCurrTransferNumber ()
- public function integerof_GetCurrPipeNumber ()
- public function integerof_GetCurrPipeCount ()
- protected function integer of_ConnectSourceTarget ()
- protected subroutine of_DisconnectSourceTarget ()
- public function integerof_SetBmp (ref string as_bmps[])
- public function integerof_GetBmpCount ()
- public function stringof_ConvertError (integer ai_error)
- public subroutineof_Start ()
- public subroutineof_Stop ()
- public subroutineof_Pause ()
- public function integerof_Repair ()
- public function integerof_SkipPipe ()
- public function integerof_SkipTransfer ()
- public subroutineof_SetFeedback (ref u_st ast_source, ref u_st ast_target, ref u_st ast_rows_read, ref u_st ast_rows_written, ref u_st ast_rows_in_errors, ref u_st ast_status, ref u_cb acb_start_transfer, ref u_cb acb_stop_tranfer, ref u_cb acb_pause_tranfer, ref u_cb acb_repair_transfer, ref u_p ap_bmp, ref u_dw adw_errors)
- protected function integer of_CancelTransfer (integer ai_stop)
SAMPLE USAGE
<Open event of a window> // declares the arrays of pictures to be animated, and pipe objects to be set in the // transaction pairsstring ls_bmps[] = {"trans00.bmp","trans01.bmp","trans02.bmp","trans03.bmp","trans04.bmp"}string ls_pipes1[] = {"p_1","p_2","p_3"}string ls_pipes2[] = {"p_1","p_2"}
// create the transaction objects to be registered in pairs inside the new pipeline objectitr_source1 = CREATE n_tritr_source1.DBMS = "ODBC"itr_source1.DBParm = "ConnectString='DSN=Powersoft Demo DB V6;UID=dba;PWD=sql'"itr_source1.of_SetName("PSDEMODB1")itr_source2 = CREATE n_tritr_source2.DBMS = "ODBC"itr_source2.DBParm = "ConnectString='DSN=Powersoft Demo DB V6;UID=dba;PWD=sql'"itr_source2.of_SetName("PSDEMODB2")itr_target1 = CREATE n_tritr_target1.DBMS = "ODBC"itr_target1.DBParm = "ConnectString='DSN=SQL Anywhere 5.0 Sample;UID=dba;PWD=sql'"itr_target1.of_SetName("SQL Anywhere 5.0 Sample 1")itr_target2 = CREATE n_tritr_target2.DBMS = "ODBC"itr_target2.DBParm = "ConnectString='DSN=SQL Anywhere 5.0 Sample;UID=dba;PWD=sql'"itr_target2.of_SetName("SQL Anywhere 5.0 Sample 2")
// Create the object (n_pipeline_sample is inherited from the N_PIPELINE I provide)inv_pipeline = CREATE n_pipeline_sample
// Optional. Sets the array of picture frames for animationsinv_pipeline.of_SetBmp(ls_bmps)
// Optional (but better exist). Sets the controls for user interaction. Explained by position:// U_ST controls to display source/target transactions, rows read, rows written,// rows in error, status bar,// U_CB controls to start, stop, repair, skip transfer, skip pipeline,// U_P control for the animation,// U_DW control for displaying the errorsinv_pipeline.of_SetFeedback(st_source, st_target, st_read,st_written,st_inerror,st_status, &cb_start,cb_stop,cb_pause,cb_repair, cb_skip_transfer, cb_skip_pipeline, &p_animate, &dw_errors)
// basic code neededinv_pipeline.of_Register(itr_source1, itr_target1, ls_pipes1)inv_pipeline.of_Register(itr_source1, itr_target2, ls_pipes2)inv_pipeline.of_Register(itr_source2, itr_target2, ls_pipes2)
<clicked event for start button> <clicked event for stop button> inv_pipeline.of_Start() inv_pipeline.of_Stop()
<clicked event for pause button> <clicked event for Skip transfer button> inv_pipeline.of_Pause() inv_pipeline.of_SkipTransfer()
<clicked event for repair button> <clicked event for Skip pipe button> inv_pipeline.of_Repair() inv_pipeline.of_SkipPipe()
The object functions, handle the enabling/disabling of the controls at the right moment, to prevent errors from user interaction In conclusion, the programmer must inherit from the N_PIPELINE uo, instead of the N_PL.
Also, DO NOT use the pipeline's pipeend event from now on. Use the pfc_pipeend event instead.
Download the | About the extension contributor |
Revision History | ||
10/27/1998 | Initial Revision | Ver. 1.00 |
Interested in contributing material to this web site? Send an email to submit@pfcguide.com, but don't forget to check the contribution guidelines first.
For information or suggestions about this web site please contact webmaster@pfcguide.com
PFCGuide is
sponsored by Dynamic Technology Group.
The information on this site is provided for advice only and not to be considered a
contract or a liability against Dynamic
Technology Group.