61
Â
Ans
|
How can you update datawindow created from procedure?Â
Â
You need to do so from some other procedure Or through the explicit embaded update statement.
Â
|
62
Ans
|
Can you modify the sql of datawindow runtime and how?
Â
Yes we can modify the sql of the datawindow.
Specifies the SQL SELECT statement for a DataWindow control or DataStore.
Â
Controls
DataWindow controls, DataStore objects, and child DataWindows
Â
Syntax
dwcontrol.SetSQLSelect ( statement )
Â
Argument Description
Â
Â
Dwcontrol       The name of the DataWindow control, DataStore, or child DataWindow for which you want to change the SELECT statement
Â
Statement        A string whose value is the SELECT statement for the DataWindow object. The statement must structurally match the current SELECT statement (that is, it must return the same number of columns, the columns must be the same data type, and the columns must be in the same order)
Â
Return value
Integer. SetSQLSelect returns 1 if it succeeds and -1 if the SELECT statement cannot be changed. If any argument’s value is NULL, SetSQLSelect returns NULL.
Â
Usage
Use SetSQLSelect to dynamically change the SQL SELECT statement for a DataWindow object in a script.
If the DataWindow is updatable, PowerBuilder validates the SELECT statement against the database and DataWindow column specifications when you call the SetSQLSelect function. Each column in the SQL SELECT statement must match the column type in the DataWindow object. The statement is validated only if the DataWindow object is updatable.
Â
You must use the SetTrans or SetTransObject function to set the transaction object before the SetSQLSelect function will execute.
Â
If the new SELECT statement has a different table name in the FROM clause and the DataWindow object is updatable, then PowerBuilder must change the update information for the DataWindow object. PowerBuilder assumes the key columns are in the same positions as in the original definition. The following conditions will make the DataWindow not updatable:
Â
¨          There is more than one table in the FROM clause.
¨          A DataWindow update column is a computed column in the SELECT statement.
Â
If changing the SELECT statement makes the DataWindow object not updatable, the DataWindow control cannot execute an Update function call for the DataWindow object in the future.
Â
Limitations to using SetSQLSelect Use SetSQLSelect only if the data source for the DataWindow object is a SQL SELECT statement without retrieval arguments and you want PowerBuilder to modify the update information for the DataWindow object:
Â
dw_1.Modify(“DataWindow.Table.Select=’select…'”)
Â
Modify will not verify the SELECT statement or change the update information, making it faster but more susceptible to user error. Although you can use Modify when arguments are involved, it is not recommended because of the lack of checking.
Â
|
63
Â
Ans
|
How can you get sql statement of the datawindow objects?
Â
Reports the SQL SELECT statement associated with a DataWindow if its data source is one that accesses an SQL database (such as SQL Select, Quick Select, or Query).
Â
Controls
DataWindow controls, DataStore objects, and child DataWindows
Â
Syntax
dwcontrol.GetSQLSelect ( )
Â
Â
Argument Description
Â
dwcontrol        The name of the DataWindow control, DataStore, or child DataWindow for which you want to obtain the current SELECT statement
Â
Return value
String. Returns the current SQL SELECT statement for dwcontrol. GetSQLSelect returns the empty string (“”) if it cannot return the statement. If dwcontrol is NULL, GetSQLSelect returns NULL.
Â
Usage
Â
Â
When you want to change the SQL SELECT statement for a DataWindow or DataStore during execution, you can use GetSQLSelect to save the current SELECT statement before making the change.
Â
When you define a DataWindow, PowerBuilder stores a PowerBuilder SELECT statement (PBSELECT) with the DataWindow. If a database is connected and SetTransObject has been called for the DataWindow, then GetSQLSelect returns the SQL SELECT statement. Otherwise, GetSQLSelect returns the PBSELECT statement.
Â
You can also use Describe to obtain the SQL SELECT statement. The DataWindow object’s Table.Select property holds the information.
Â
|
64
Â
Ans.
|
How can you update multiple tables in a datawindow?
Â
Â
We can update multiple table by updating one table by calling update function and then calling describe and modify function to set database table and updateable column and reset the modify flag to update next table.
Â
|
65
Â
Ans.
|
How can you set attribute of datawindow?
Â
We can set the attribute of datawindow using modify function as well as using datawindow.object.column.attribute = some valid value. And dot notation.
Â
Â
|
66
Â
Ans.
|
How can you get the attribute of the datawindow?
Â
We can get the attribute of the datawindow by using describe function.
Â
|
67
Â
Ans
|
If you pass only empty string with modify function what will happen?
Â
Modifies a DataWindow object by applying specifications, specified as a list of instructions that change the DataWindow object’s definition. You can change appearance, behavior, and database information for the DataWindow object by changing the values of properties. You can add and remove objects from the DataWindow object by providing specifications for the objects.
Â
For lists and explanations of DataWindow object properties, see the DataWindow Reference.
Â
Controls
DataWindow controls, DataStore objects, and child DataWindows
Â
Syntax
dwcontrol.Modify ( modstring )
Â
Argument Description
Â
Â
dwcontrol        The name of the DataWindow control, DataStore, or child DataWindow you are modifying
Â
modstring       A string whose value is the specifications for the modification. See Usage for appropriate formats
Â
Return value
Â
String. Returns the empty string (“”) if it succeeds and an error message if an error occurs. The error message takes the form “Line n Column n incorrect syntax”. The columns are counted from the beginning of the compiled text of modstring. If any argument’s value is NULL, Modify returns NULL.
Â
Usage
Modify lets you make many of the same settings in a script that you would make in the DataWindow painter. Typical uses for Modify are:
Â
¨          Changing colors, text settings, and other appearance settings of objects
¨          Changing the update status of different tables in the DataWindow so that you can update more than one table
¨          Modifying the WHERE clause of the DataWindow object’s SQL SELECT statement
¨          Turning on Query mode or Prompt For Criteria so users can specify the data they want
¨          Changing the status of Retrieve Only As Needed
¨          Changing the data source of the DataWindow object
Â
¨          Controlling the Print Preview display
¨          Deleting and adding objects (such as lines or bitmaps) in the DataWindow object
Â
Each of these uses is illustrated in the Examples for this function.
Â
You can use three types of statements in modstring to modify a DataWindow object.
Â
CREATE object (settings)Â Â Â Â Â Â Â Â Adds object to the DataWindow object (such as text, computed fields, and bitmaps). A setting is a list of properties and values using the format you see in exported DataWindow syntax. To create an object, you must supply enough information to define it.Object cannot be an OLE object. You cannot add an OLE object to a DataWindow using the Modify function
Â
DESTROY [COLUMN] object    Removes object from the DataWindow object. When object is a column name, specify the keyword COLUMN to remove both the column and the column’s data from the buffer
objectname.property=value       Changes the value of property to value. Properties control the location, color, size, font, and other settings for objectname. When objectname is DataWindow, you can also set properties for database access. The DataWindow Reference has lists of objects in a DataWindow, their properties, and values.Depending on the specific property, value can be:
 ¨ A constant A quoted constant ¨         An expression that consists of a default value followed by a valid DataWindow expression that returns the appropriate data type for the property.
Expressions are described below Object namesÂ
Â
The DataWindow painter automatically gives names to columns and column labels. Other objects that you add to the DataWindow object are named with a cryptic string of numbers unless you give them names. (Describe will report the cryptic names, but you can’t see them in the painter.) To easily describe and modify properties of an object, give the object a name.
Â
Expressions for ModifyÂ
Â
When you specify an expression for a DataWindow property, the expression has the format:
Â
defaultvalue~tDataWindowpainterexpression
Â
Defaultvalue is a value that can be converted to the appropriate data type for the property. It is followed by a tab (~t). DataWindowpainterexpression is an expression that can use any DataWindow painter function. The expression must also evaluate to the appropriate data type for the property. When you are setting a column’s property, the expression is evaluated for each row in the DataWindow, which allows you to vary the display based on the data. A typical expression uses the If function:
Â
‘16777215 ~t If(emp_status=~~’A~~’,255,16777215)’
Â
To use that expression in a modstring, specify the following (entered as a single line):
Â
modstring = “emp_id.Color=’16777215 ~t
Â
If(emp_status=~~’A~~’,255,16777215)'”
Â
Not all properties accept expressions. For details on each property, see the DataWindow Reference.
Â
Quotes and tildesÂ
Â
Because Modify’s argument is a string, which can include other strings, you need to use special syntax to specify quotation marks. To specify that a quotation mark be used within the string rather than match and end a previously opened quote, you can either specify the other style of quote (single quotes nested with double quotes) or precede the quotation mark with a tilde (~). For another level of nesting, the string itself must specify ~”, so you must specify ~~ (which specifies a tilde) followed by ~” (which specifies a quote). For example, another way to type the modstring shown above is (entered as a single line):
Â
modstring = “emp_id.Color=~”16777215 ~t
Â
If(emp_status=~~~”A~~~”,255,16777215)~””
Â
For more information about quotes and tildes, see “Standard data types”.
Â
Building a modstring with variablesÂ
Â
To use variable data in modstring, you can build the string using variables in your program. As you concatenate sections of modstring, make sure quotes are included in the string where necessary. For example, the following code builds a modstring similar to the one above, but the default color value and the two color values in the If function are calculated in the script. Notice how the single quotes around the expression are included in the first and last pieces of the string:
Â
red_amount = Integer(sle_1.Text)
Â
modstring = “emp_id.Color='” + &
Â
String(RGB(red_amount, 255, 255)) + &
Â
“~tIf(emp_status=~~’A~~’,” + &
Â
String(RGB(255, 0, 0)) + &
Â
“,” + &
Â
String(RGB(red_amount, 255, 255)) + &
Â
“)'”
Â
The following is a simpler example without the If function. You don’t need quotes around the value if you are not specifying an expression. Here the String and RGB functions result in a constant value in the resulting modstring:
Â
modstring = “emp_id.Color=” + &
Â
String(RGB(red_amount, 255, 255))
Â
You can set several properties with a single call to Modify by including each property setting in modstring separated by spaces. For example, assume the following is entered on a single line in the script editor:
Â
rtn = dw_1.Modify(“emp_id.Font.Italic=0
Â
oval_1.Background.Mode=0
Â
oval_1.Background.Color=255″)
Â
However, it is easier to understand and debug a script in which each call to Modify sets one property.
Â
Debugging tip If you build your modstring and store it in a variable that is the argument for Modify, you can look at the value of the variable in Debug mode. When Modify’s error message reports a column number, you can count the characters as you look at the compiled modstring.
Â
Modifying a WHERE clause For efficiency, use Modify instead of SetSQLSelect to modify a WHERE clause. Modify is faster because it does not verify the syntax and does not change the update status of the DataWindow object. However, Modify is more susceptible to user error. SetSQLSelect modifies the syntax twice (when the syntax is modified and when the retrieve executes) and affects the update status of the DataWindow object.
Â
PowerBuilder already includes many functions for modifying a DataWindow. Before using Modify, check the list of DataWindow functions in Objects and Controls to see if a function exists for making the change. Many of these functions are listed below in See also.
Â
Modify is for modifying the properties of a DataWindow object. You can set properties of the DataWindow control that contains the object using standard dot notation. For example, to put a border on the control, specify:
Â
Â
|
68
Â
Ans
|
How can we set itemstatus of the datawindows.
Â
Changes the modification status of a row or a column within a row. The modification status determines the type of SQL statement the Update function will generate for the row.
Â
Controls
DataWindow controls, DataStore objects, and child DataWindows
Â
Syntax
dwcontrol.SetItemStatus ( row, column, dwbuffer, status )
Â
Argument Description
Â
dwcontrol        The name of the DataWindow control, DataStore, or child DataWindow in which you want to set the status of an item at a specified row and column
Â
row     A long identifying the row location in which you want to set the status
Â
column The column location in which you want to set the status. Column can be a column number (integer) or a column name (string). To set the status for the row, enter 0 for column
Â
dwbuffer A dwBuffer enumerated data type identifying the DataWindow buffer that contains the row:            ¨PRIMARY! — The data in the primary buffer (the data that has not been deleted or filtered out)
¨DELETE! — The data in the delete buffer (data deleted from the DataWindow object)
¨FILTER! — The data in the filter buffer (data that was filtered out)
Â
status  A dwItemStatus enumerated data type representing the new status:
¨NotModified!¨  DataModified!¨ New!¨   NewModified!For definitions of the values of dwItemStatus, see GetItemStatus
Â
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, SetItemStatus returns NULL.
Â
Usage
How statuses are setÂ
There are four DataWindow item statuses, two of which apply only to rows:
Status  Applies to
Â
New!    Rows
NewModified!   Rows
NotModified!    Rows and columns
DataModified!  Rows and columns
Â
When data is retrieved When data is retrieved into a DataWindow, all rows and columns initially have a status of NotModified!.
Â
After data has changed in a column in a particular row, either because the user changed the data or the data was changed programmatically, such as through the SetItem function, the column status for that column changes to DataModified!.
Once the status for any column in a retrieved row changes to DataModified!, the row status also changes to DataModified!.
Â
When rows are inserted When a row is inserted into a DataWindow, it initially has a row status of New!, and all columns in that row initially have a column status of NotModified!. After data has changed in a column in the row, either because the user changed the data or the data was changed programmatically, such as through the SetItem function, the column status changes to DataModified!. Once the status for any column in the inserted row changes to DataModified!, the row status changes to NewModified!.
Â
When a DataWindow column has a default value, the column’s status does not change to DataModified! until the user makes at least one actual change to a column in that row.
When Update is calledÂ
A row’s status flag determines what SQL command the Update function uses to update the database. INSERT or UPDATE is called depending upon the following row statuses:
Row status       SQL statement generated
NewModified!   INSERT
DataModified!  UPDATE
Â
A column is included in an UPDATE statement only if the following two conditions are met:
¨          The column is on the updateable column list maintained by the DataWindow object
Â
For more information about setting the update characteristics of the DataWindow object, see the PowerBuilder User’s Guide.
¨          The column has a column status of DataModified!
Â
The DataWindow control includes all columns in INSERT statements it generates. If a column has no value, the DataWindow attempts to insert a NULL. This causes a database error if the database does not allow Null’s in that column.
Â
Changing statuses using SetItemStatusÂ
Â
Use SetItemStatus when you want to change the way a row will be updated. Typically, you do this to prevent the default behavior from taking place. For example, you might copy a row from one DataWindow to another. After the user modifies the row, you want to issue an UPDATE statement instead of an INSERT statement.
Â
Changing column status You use SetItemStatus to change the column status from DataModified! To NotModified! Or vice versa.
Change column status when you change row status Changing the row status will change the status of all columns in that row to NotModified!, so if the Update function is called, no SQL update is produced. You must change the status of columns to be updated after you change the row status.
Â
Changing row status Changing row status is a little more complicated. The following table illustrates the effect of changing from one row status to another:
Â
Original status Specified status
Â
New!             NewModified!     DataModified!  NotModified!
New!    –          Yes                       Yes                           No
NewModified!   No       –                Yes              New!
DataModified!  NewModified!         Yes              Yes
NotModified!    Yes                        Yes             Yes –
Â
In the preceding table,
Yes means the change is valid. For example, issuing SetItemStatus on a row that has the status NotModified! to change the status to New! does change the status to New!.
No means that the change is not valid and the status is not changed.
Â
Issuing SetItemStatus to change a row status from NewModified! to NotModified! actually changes the status to New!. Issuing SetItemStatus to change a row status from DataModified! to New! actually changes the status to NewModified!.
Â
Changing a row’s status to NotModified! or New! causes all columns in that row to be assigned a column status of NotModified!. Change the column’s status to DataModified! to ensure that an update results in a SQL UPDATE.
Changing the status of a retrieved row from NotModified! to New! If you change the status of a retrieved row to New! and then make a change to data in a column, all the columns in that row will change status to DataModified! All the columns change status because the Update function generates a SQL INSERT command that includes the changed data as well as the data that already existed in the other columns.
Â
Changing status indirectlyÂ
When you cannot change to the desired status directly, you can usually do it indirectly. For example, change New! to DataModified! To NotModified!.
Resetting status for the whole DataWindow objectÂ
To reset the update status of the entire DataWindow object, use the ResetUpdate function. This sets all status flags to NotModified! Except for New! Status flags, which remain, unchanged.
Â
|
69
Â
Ans
|
What all are the datawinsdow styles and datasources in pb?
Â
Data window styles – grid, group, n-app, label, tabular, cross tab, composite, graph, ole, ritchtext, free form.
Datasource – Query, Quick Select, Stored Procedures, External, SQL Select
|
70
Â
Ans
|
How pb implements oops concept?
Â
Basically OOP s include inheritance, Polymorphism and encapsulation. And pb implement these all through the objects like window, user objects.
|
71
Â
Ans
|
What is overwriting the functions?
Â
Suppose you have a object having one function and you have inherited another object from the existing one and define the same function with same signature the function will get overwrite this is call the function overwriting.
|
74
Â
Ans
|
What is the linkage service in PFC.
Â
The PFC linkage service helps you to create master/detail windows and other types of windows that require coordinated processing.
The linkage service contains the following features:
|Linkage style Controls whether detail DataWindows retrieve rows, filter rows, or scroll to the appropriate row
|Update style Controls how the linkage service updates DataWindows (top-down, bottom-up, top-down then bottom-up, bottom-up then top-down, or a developer-specified custom update)
|Confirm on row change When the master changes rows, this option displays a confirmation dialog if modifications made to detail DataWindows will be lost
|Confirm on delete Displays a confirmation dialog when the user deletes rows
|Cascading key changes The linkage service automatically updates detail DataWindows when you change a key value on the master
|Delete style When you delete a master row, this option specifies whether the linkage service deletes detail rows, discards detail rows, or leaves them alone
|Extended update Allows you to integrate other controls (such as ListViews, TreeViews, and DataStores) into the default save process
The linkage service is completed integrated with n_cst_luw and with the w_master pfc_Save process.
PFC enables the linkage service through the n_cst_dwsrv_linkage user object.
Usage
You can use the linkage service to coordinate any type of processing among DataWindows. However, the most common use is for master/detail processing.
to enable the linkage service:
Â
Call the u_dw of_SetLinkage function:
dw_emplist.of_SetLinkage(TRUE)
U_dw destroys the service automatically when the DataWindow is destroyed.
Â
To use the linkage service to coordinate Master/Detail processing:
Â
1 Enable the linkage service for both the master and detail DataWindows by calling the u_dw of_SetLinkage function, once for each DataWindow:
dw_master.of_SetLinkage(TRUE)
dw_detail.of_SetLinkage(TRUE)
Â
2 Call the u_dw of_SetTransObject function to establish the Transaction object for the master and detail DataWindows:
dw_master.inv_linkage.of_SetTransObject(SQLCA)
Â
3 Link the detail to the master by calling the of_SetMaster function in the detail DataWindow:
dw_detail.inv_linkage.of_SetMaster(dw_master)
Â
4 Register the related columns by calling the of_Register function:
  dw_detail.inv_linkage.of_Register & (“emp_id”,”emp_id”)
Â
5 (Optional) Specify that the service updates DataWindows from the bottom of the linkage chain on up (the  default is to update top down):
dw_detail.inv_linkage.of_SetUpdateStyle & (dw_detail.inv_linkage.BOTTOMUP)
Â
6 Establish the action taken by the detail when a row changes in the master by calling the of_SetStyle function.
This example specifies that the detail DataWindow retrieves a row whenever the master changes:
dw_detail.inv_linkage.of_SetStyle & (dw_detail.inv_linkage.RETRIEVE)
Â
7 Call the master DataWindow’s of_Retrieve function:
IF dw_master.of_Retrieve( ) = -1 THEN
 MessageBox(“Error”,”Retrieve error”)
ELSE
 Dw_master.SetFocus( )
END IF
Previous steps can be in one script
You can code the previous steps in a single event, such as the window Open event.
Â
8 Add retrieval logic to the master DataWindow’s pfc_Retrieve event:
Return this.Retrieve( )
Retrieving rows
If the linkage service refreshes detail rows via retrieval, you only need to code a Retrieve function for the master DataWindow. With the filter and scroll options, you must also code Retrieve functions in detail DataWindows.
Â
To enable confirm on row change (retrieval style only):
Â
1 Call the of_SetUpdateOnRowChange function for the detail DataWindow:
dw_detail.inv_linkage.of_SetUpdateOnRowChange(TRUE)
Â
2 Call the of_SetConfirmOnRowChange function for the detail DataWindow:
dw_detail.inv_linkage.of_SetConfirmOnRowChange &
  (TRUE)
Â
To enable confirm on delete:
1 Call the of_SetUpdateOnRowChange function for the detail DataWindow:
dw_detail.inv_linkage.of_SetUpdateOnRowChange(TRUE)
Â
2 Call the of_SetConfirmOnDelete function for the detail DataWindow:
dw_detail.inv_linkage.of_SetConfirmOnDelete(TRUE)
Â
To enable cascading key changes:
Call the of_SetSyncOnKeyChange function for every DataWindow in the linkage chain:
dw_master.inv_linkage.of_SetSyncOnKeyChange(TRUE)
dw_detail.inv_linkage.of_SetSyncOnKeyChange(TRUE)
vTo specify deletion style:
|Call the of_SetDeleteStyle function for all master DataWindows in the linkage chain:
dw_master.inv_linkage.of_SetDeleteStyle &
  (dw_cust.inv_linkage.DISCARD_ROWS)
Â
To enable extended update:
Call the of_SetOtherSaveObjects function to add other controls to the default save process:
PowerObject lpo_objs[ ]
Â
// This example adds the lv_salesinfo ListView
// to the save process.
lpo_objs[1] = lv_salesinfo
dw_master.inv_linkage.of_SetOtherSaveObjects &
 (lpo_objs)
Â
|
75
Â
Ans.
|
What is the datawindow cashing service in pfc and what is the use of it?
Â
The DataWindow caching service buffers data for DataWindow objects. By keeping rows in memory, the DataWindow caching service helps to reduce database access, optimizing application performance. The DataWindow caching service supports the following data sources:
lDataWindow object (using either data retrieved from the database or data stored with the DataWindow object)
lSQL statement
lDataWindow control
lDataStore control
lRows from an array
lA file
The DataWindow caching service uses PowerBuilder DataStores to buffer data.
PFC enables DataWindow caching through the n_cst_dwcache user object.
PFC code is in ancestor-level objects
This book always refers to extension-level objects (such as n_cst_dwcache). All PFC code is actually in ancestor-level objects (such as pfc_n_cst_dwcache).
Â
Usage
Use DataWindow caching to minimize database access and optimize performance.
Â
To enable DataWindow caching:
Call the n_cst_appmanager of_SetDWCache function:
gnv_app.of_SetDWCache(TRUE)
Â
To use DataWindow caching:
Cache data by calling the of_Register function, passing different arguments depending on the data to be cached:
lTo cache rows retrieved from the database via a DataWindow object, pass an identifier, a Transaction object, the DataWindow object name, and arguments if any
lTo cache rows retrieved from the database via a SQL statement, pass an identifier, a Transaction object, and the SQL statement
lTo cache rows in an array, pass an identifier, the DataWindow object name, and the data
lTo cache rows from a DataWindow control, pass an identifier and the DataWindow control
lTo cache rows from a DataStore, pass an identifier and the DataStore instance
lTo cache rows from a file, pass an identifier and the filename
Â
2 To determine if a DataWindow object is already registered with the caching service, call the of_IsRegistered function, passing the object’s identifier.
Â
3 To access cached data from, call the of_GetRegistered function. This example assumes an ids_datastore instance variable:
gnv_app.inv_dwcache.of_GetRegistered & (“d_emplist”, ids_datastore)
ids_datastore.ShareData(dw_emplist)
Â
4 To reretrieve data for a cached DataWindow, call the of_Refresh function.
Â
5 To stop caching call the of_UnRegister function.
Â
6 (Optional) Disable the DataWindow caching service by calling the n_cst_appmanager of_SetDWCache function:
gnv_app.of_SetDWCache(FALSE)
Â
In most cases, you do not disable DataWindow caching explicitly. PFC destroys n_cst_dwcache automatically when your application shuts down.
Â
|
76
Â
Ans.
|
What is the difference in parameter to functions by value and by reference?
Â
By value means it creates its own copy to work and if we make the changes in any thing it will affect in copy not in actual objects. But parameter by reference means variable keeps the reference of the object and there will not be any copy whatever changes we will do will takes place in the actual objects value.
Â
|
77
Â
Ans.
|
What is the cursor and what are the types of cursor?
Â
Â
Cursor is the pointer, which point to a record and allow us to do row by row manipulations.
Â
A cursor is a symbolic name that is associated with a Transact-SQL select statement through a declaration statement. It consists of the following parts:
Â
cursor result set – the set (table) of rows resulting from the execution of a query associated with the cursor
Â
cursor position – a pointer to one row within the cursor result set
Â
The cursor position indicates the current row of the cursor. You can explicitly modify or delete that row using delete or update statements with a clause naming the cursor. You change the current cursor position through an operation called a fetch. A fetch moves the current cursor position one or more rows down the cursor result set.
Â
A cursor behaves much like a file pointer to a series of file records, where the cursor acts as a pointer to the query results. However, cursors only support forward (or sequential) movement through the query results. Once you fetch several rows, you cannot backtrack through the cursor result set to access them again. This process allows you to traverse the query results row by row, similar to how a programming language can access one file record at a time.
Â
After you declare the cursor, it is in one of two states:
Â
Closed – The cursor result set does not exist, so you cannot read information from it. Cursors are initially in this state. You must explicitly open the cursor before you can use it. Once it is opened, you can explicitly close it when you are finished. SQL Server can implicitly close a cursor for several reasons described later in this chapter.
Â
Open – The rows within the cursor result set are available for reading or updating.
Â
You can close a cursor and then reopen it. Reopening a cursor recreates the cursor result set and positions the cursor right before the first row. This allows you to process through a cursor result set as many times as needed. You can close the cursor at any time; you do not have go through the entire result set.
Â
All cursor operations, like fetching or updating the row, are accomplished in reference to the current cursor position. Updating cursor rows involves changing data in the row or deleting the row completely. You cannot use cursors to insert rows. All updates through a cursor affects the corresponding base tables included in the cursor result set.
Â
|
78
Â
Ans
|
What are different joins?
Â
Joining two or more tables is a process of comparing the data in specified fields and using the comparison results to form a new table from the rows that qualify. A join statement specifies a column from each table, compares the values in those columns row by row, and combines rows with qualifying values into new rows. The comparison is usually for equality-values that match exactly-but other types of joins can be specified. If a join is to have meaningful results, the columns being compared must have similar values-values that are comparable because they have the same or similar datatypes.
Â
The join operation has a jargon all its own. The word “join” is used both as a verb, and as a noun, referring to the operation itself, to the query, or to its results.
Â
There are several varieties of joins-equijoin, natural join, outer join, and so
Â
|
79
Â
Ans.
|
What are the stored procedure what is the use of it?
Â
Stored procedures are collections of SQL statements and control-of-flow language. An execution plan is prepared when a procedure is run, so that subsequent execution is very fast. Stored procedures can:
Â
Take parameters
Â
Call other procedures
Â
Return a status value to a calling procedure or batch to indicate success or failure, and the reason for failure
Â
Return values of parameters to a calling procedure or batch
Â
Be executed on remote SQL Servers
Â
The ability to write stored procedures greatly enhances the power, efficiency, and flexibility of SQL. Compiled procedures dramatically improve the performance of SQL statements and batches. In addition, stored procedures on other SQL Servers can be executed if your server and the remote server are both set up to allow remote logins. You can write triggers on your local SQL Server that execute procedures on a remote server whenever certain events, such as deletions, updates or inserts, take place locally.Â
Â
Stored procedures differ from ordinary SQL statements and from batches of SQL statements in that they are pre-compiled. The first time you run a procedure, SQL Server’s query processor analyzes it and prepares an execution plan that is ultimately stored in a system table . Subsequently, the procedure is executed according to the stored plan. Since most of the query processing work has already been performed, stored procedures execute almost instantaneously.
Â
SQL Server supplies a variety of stored procedures as convenient tools for the user. These stored procedures are called system procedures.Â
Â
You create stored procedures with the create procedure command. To execute a stored procedure, either a system procedure or a user-defined procedure, use the execute command. Or you can use the name of the stored procedure alone, as long as it is the first word of a statement or batch.
Â
The syntax for creating a simple stored procedure, without special features such as parameters, is:
Â
create procedure procedure_name
Â
as SQL_statements
Â
Stored procedures are database objects, and their names must follow the rules for identifiers.
Â
Any number and kind of SQL statements can be included with the exception of create statements.
Â
|
80
Â
Ans:
|
What are the structures?
Â
A structure is a collection of one or more related variables of the same or different data types grouped under a single name. In some languages, such as Pascal and COBOL, structures are called records. Structures allow you to refer to related entities as a unit rather than individually. For example, if you define the user’s ID, address, access level, and a picture (bitmap) of the employee as a structure called user_struct, you can then refer to this collection of variables as user_struct.
Â
There are two kinds of structures:
·Object-level structures, which are associated with a particular type of object such as a window or menu. These structures can always be used in scripts for the object itself. You can also choose to make the structures accessible from other scripts.
Â
Global structures, which are not associated with any object in your application. You can directly reference these structures anywhere in your application.
Â
|
81
Â
Ans
|
What is mean by table mutation?
Â
Â
|
82
Â
Ans
|
What is the difference between delete and truncate statement?
Â
Delete statement can be used to delete specifice no. of records where as truncate will delete all the records at a time. Delete statement make entry in to database log so that it is slower than truncate also you can not get back the records which are truncated but we can in case of delete.
Â
|
83
Â
Ans
|
Can you create multiple transaction objects in pb?
Â
Yes you can create multiple transaction objects using create statement.
Â
|
84
Â
Ans
|
What is two tier and three-tier architecture?
Â
Two tire architecture means there will be only front end and back end and we write our business process in back end or front end. In case of three tires architecture there is one more layer in between in which we write our business processes. Two tires are faster and economical as compare to three tires. If in future some conversion take place or some changes has been taken place in the business process in case of three tire architecture things goes smoothly while in two tire architecture creates complications.
Â
|
85
Ans
|
What is thin layer and thick layer database?
Â
Â
Â
Â
|
86
Ans
|
What is parsing in oracles?
Â
Â
|
87
Â
Ans
|
What are the databases provided with sybase?
Â
There are four-system databases and one sample database when you install the Sybase on your machine they are Master, Model, sybsystemproc, temporary database and the pub2 is the sample database.
Â
|
88
Â
Ans
|
What sql Sybase uses?
Â
Sybase uses T SQL means transact sql which is the extension to SQL.
Â
|
89
Â
Ans
|
What sql oracle uses?
Â
Oracle uses SQL Plus, which is the extension to SQL.
Â
|
90
|
What is the minus of two tables?
Â
Â
|
91
|
How can you get the procedure definitions in oracle?
Â
|
92
|
Write query to find second highest salary?
Â
|
93
|
Write query to get department having max emp.?
Â
|
94
|
What is full and incremental exe.
Â
|
95
Â
Ans :
|
What is machine code exe?
Â
Machine code is nothing but DLL
Â
|
96
Â
Ans :
|
How can you create pbd and dll with exe?
Â
If you select machine code option and select the pbd option for pbls while creating the exe will generate dlls and without selecting machincode you can generates pbd.
Â
|
97
Â
Ans.
Â
|
Can you create single pbd or dll .how?
Â
Yes, by selecting only that pbl.
|
98
Â
Ans.
|
What is the difference bitween pbd and dll?
Â
DLL : 1. It takes much time to create the EXE
          2. Faster than the PBD.
PBDÂ Â 1. It not takes much time to create the EXE
          2. Slower than the DLL
Â
|
99
Â
Ans.:
|
What is PBR and what is the use of it? And how will you create it?
Â
Â
PowerBuilder Resource (PBR) file that includes resources that are assigned dynamically in scripts for the application. The name of each object must exactly match the name used to reference the object in scripts (if the name is fully qualified in the script it must be fully qualified in the PBR file).
Â
|
100
Ans.
|
Can you create exe with out pbd and dll?
Yes
Â
|
101
Â
Ans.
|
What are check in and check out and what is use of it?
Â
Check in – now any user having access to it can use that object.
Check out – now some body is using that object and no body can use that object.
This provides security and control over maintaining versions.
Â
|
102
Ans.
|
Can you update procedure definition through pb?
No.
Â
|
103
Â
Ans.
|
Can you set querymode to datawindow, which you are using in share data? What will happen?
Â
Â
No. if you do so it will raise runtime error.
|
104
Â
Ans.
|
Can you pass parameter to procedure dynamically?
Â
Â
Yes. While executing the procedure dynamically.
|
105
Â
Ans.
|
What will happen if we write script in other event?
Â
Â
Occurs when a system message occurs that is not a PowerBuilder message. You should avoid using it (it slows performance while it checks every Windows message).
Â
|
106
Â
Ans.
|
Difference between Pb And VB?
Â
Pb follows OOPS concept while VB does not. There is a facility called datawindow through which we can present data from database directly which is not in VB.
Â
|
107
Â
Ans.
|
What are the datawindow objects sources types?
Â
1.      Quick Select 2. Sql Select 3. Query 4. External 5. Store Procedure.
Â
|
108
Â
Ans.
|
What for the external datawindow objects are used?
Â
Â
When we have to write the complicated query or joins then we used external datawindow. And basically we use external datawindow for report purpose. If we are not using any DBMS or RDBMS..
Â
|
109
Â
Ans.
|
What is the difference between quick select and sql select?
Â
Â
In the Quick Select dialog box, you can choose columns from one table or from multiple tables if they are joined through foreign keys. You can not sort and group the columns and specify retrieval criteria and you can not add computed column. Which all are possible in sql select.
Â
|
110
Â
Ans.
|
What is function openwithparm and what are the parameters to it?
Â
Opens a window object of a known data type. OpenWithParm displays the window and makes all its properties and controls available to scripts. It also stores a parameter in the system’s Message object.
Â
OpenWithParm ( windowvar, parameter {, parent } )
Â
Windowvar      The name of the window you want to display. You can specify a window object defined in the Window painter (which is a window data type) or a variable of the desired window data type. Open places a reference to the open window in windowvar
Â
Parameter The parameter you want to store in the Message object when the window is opened.
Parameter must have one of these data types: ¨String¨ Numeric ¨ PowerObject.
Â
parent (child and popup windows only) (optional)Â Â Â Â Â Â Â Â Â Â Â The window you want make the parent of the child or popup window you are opening. If you open a child or popup window and omit parent, PowerBuilder associates the window being opened with the currently active window
Â
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, OpenWithParm returns NULL.
Â
|
111
Â
Ans.
|
Whet is the difference between pop up and response window?
Â
Child A window that is dependent on a main window and can only exist within the main (parent) window.
Main : A standalone overlapped window that can be independent of all other windows.
MDI : An MDI frame without a MicroHelp status bar.
MDIHelp : An MDI frame with a MicroHelp status bar.
Popup : A window that displays usually in response to an event within a window, but can exist outside of the window and, in some cases, after the window that opened it is closed.
Response : A window that displays to obtain information from the user and cannot lose focus or be closed until the user responds.
Â
|
112
Â
Ans.
|
Difference between opensheet and open function?
Â
Open: Opens a window object of a known data type. Open displays the window and makes all its properties and controls available to scripts.
Open ( windowvar {, parent } )
Â
OpenSheet : Description
Opens a sheet within an MDI (multiple document interface) frame window and creates a menu item for selecting the sheet on the specified menu.
Â
OpenSheet ( sheetrefvar {, windowtype }, mdiframe {, position {, arrangeopen } } )
Â
Argument Description
Â
Sheetrefvar:     The name of any window variable that is not an MDI frame window. OpenSheet places a reference to the open sheet in sheetrefvar
Â
windowtype (optional):Â A string whose value is the data type of the window you want to open. The data type of windowtype must be the same or a descendant of sheetrefvar
Â
mdiframe :Â The name of an MDI frame window
Â
position (optional):Â Â The number of the menu item (in the menu associated with the sheet) to which you want to append the names of the open sheets. Menu bar menu items are numbered from the left, beginning with 1. The default value of 0 lists the open sheets under the next-to-last menu item.
Â
arrangeopen (optional): A value of the ArrangeOpen enumerated data type specifying how you want the sheet arranged in the MDI frame in relation to other sheets when it is opened:¨    Cascaded! — (Default) Cascade the sheet relative to other open sheets, so that its title bar is below the previously opened sheet¨           Layered! — Layer the sheet so that it fills the frame and covers previously opened sheets¨           Original! — Open the sheet in its original size and cascade it
Â
Returns
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, OpenSheet returns NULL.
Â
|
Â
113
Â
Ans.
Â
|
Â
What is the alternative to store data temporarily?
Â
We can cache the data in the datastore object temporarily.
|
114
Â
Ans.
|
Define datawindow.
Â
You place DataWindow controls in a window or user object and then specify the DataWindow object you want to use within them to display and manipulate data in the window.
Â
A DataWindow object allows users to display, manipulate, and update database or other information. You build DataWindow objects in the DataWindow painter.
Â
It has five datasource and Eleven Styles to display the data.
Â
|
115
Â
Ans.
|
What will happen if you write messagebox in itemfocus change event and why?
Â
Message will display once and then nothing will happen because when we loose the focus from one object to other item focus change never triggers.
Â
|
117
Â
Ans.
|
What are the different type of windows provided in pb?
Â
Child, Main, MDI, MDI help, Popup, Response
|
Â
118
|
Â
What is the difference between pb5 and pb6?
Â
|
119
Â
Ans.
|
What are the different type of datawindow object style?
Â
Composite, Compose, Grid, Graph, Crosstab, N-up, Tabular, Freeform, OLE, Label, RichText
|
120
Â
Ans.
|
What are the events in application objects?
Â
Open, Close,ConnectionBegin,ConnectionEnd,idel,systemerror
Â
|