1
Ans.
|
How can you generate runtime datawindow object?Â
Â
Using syntaxfromsql function to get sqlsyntaxt for the passed sql string and then calling function create
Â
SyntaxFromSQL:
transaction.SyntaxFromSQL ( sqlselect, presentation, err )
Â
Argument Description
Â
Transaction.    The name of a connected transaction object
Â
Sqlselect.        A string whose value is a valid SQL SELECT statement
Â
Presentation.   A string whose value is the default presentation style you want for the DataWindow. The       Â
                         simple format is: Style(Type=presentationstyle)Values for presentationstyle correspond toÂ
                         the styles in the New DataWindow dialog box in the DataWindow painter. Keywords are:Â
                         (Default) TabularGridForm (for freeform)GraphGroupLabelNup. The Usage section lists the
                         keywords you can use in presentation.
Â
err                   A string variable to which PowerBuilder will assign any error messages that occur Return
                         value String. Returns the empty string (“”) if an error occurs. If SyntaxFromSQL fails, err may
                         contain error messages if warnings or soft errors occur (for example, a syntax error). If any
                         argument’s value is NULL, SyntaxFromSQL returns NULL.
Â
Syntax of Create:
dwcontrol.Create ( syntax {, errorbuffer } )
Â
Argument Description
Dwcontrol       The name of the DataWindow control or DataStore in which PowerBuilder will create the new
                         DataWindow object
syntax             A string whose value is the DataWindow source code that will be used to create the
                         DataWindow object
errorbuffer (optional)  The name of a string that will hold any error messages that occur. If you do not
                         specify an error buffer, a message box will display the error messages
Return value
Integer.         Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, Create
                      returns NULL.
|
2
Â
Ans.
|
How can you open a userobject or tabcontrol in a window?
Â
tabcontrolname.OpenTab ( userobjectvar, index )
Â
Argument         Description
Tabcontrolname   The name of the Tab control in which you want to open the user object as a tab page
Userobjectvar       The name of the custom visual user object you want to open as a tab page. You can
                               specify a custom visual user object defined in the User Object painter (which is a user
                               object data type) or a variable of the desired user object data type. Open places a            Â
                               reference to the opened custom visual user object in userobjectvar.
Index                    The number of the tab before which you want to insert the new tab. If index is 0 or greater
                              than the number of tabs, the tab page is inserted at the end
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, OpenTab returns NULL.
Â
windowname.OpenUserObject ( userobjectvar {, x, y } )
Argumen Description
windowname   The name of the window in which you want to open the user object
userobjectvar  The name of the user object you want to display. You can specify a user object defined in the
                         User Object painter (which is a user object data type) or a variable of the desired user object
                         data type. Open places a reference to the opened user object in userobjectvar
x (optional)Â Â Â Â Â Â The x coordinate in PowerBuilder units of the user object within the window’s frame. The
                         default is 0
y (optional)Â Â Â Â Â Â The y coordinate in PowerBuilder units of the user object within the window’s frame. The
                         default is 0
Â
|
3
Â
Ans.
|
What is garbage collection and what are the functions to set and get garbage time limit?
What garbage collection does
The PowerBuilder garbage collection mechanism checks memory automatically for unreferenced and orphaned objects and removes any it finds, thus taking care of most memory leaks. You can use garbage collection to destroy objects instead of explicitly destroying them using the DESTROY statement. This lets you avoid execution-time errors that occur when you destroy an object that was being used by another process or had been passed by reference to a posted event or function.
Â
When garbage collection occurs
Garbage collection occurs:
¨          When a reference is removed from an object A reference to an object is any variable whose value is the object. When the variable goes out of scope, or when it is assigned a differenent value, PowerBuilder removes a reference to the object, counts the remaining references, and destroys the object if no references remain.
¨          When the garbage collection interval is exceeded When PowerBuilder completes the execution of a system-triggered event, it makes a garbage collection pass if the set interval between garbage collection passes has been exceeded. The default interval is 0.5 seconds. The garbage collection pass removes any objects and classes that cannot be referenced, including those containing circular references (otherwise unreferenced objects that reference each other).
Â
Posting events and functions When you post an event or function and pass an object reference, PowerBuilder adds an internal reference to the object to prevent it from being garbage collected between the time of the post and the actual execution of the event or function. This reference is removed when the event or function is executed.
Â
Exceptions to garbage collection
Â
There are a few objects that are prevented from being garbage collected:
¨          Visual objects Any object that is visible on your screen is not garbage collected because when the object is created and displayed on your screen an internal reference is added to the object. When any visual object is closed it is explicitly destroyed.
Â
¨          Timing objects Any Timing object that is currently running is not garbage collected because the Start function for a Timing object adds an internal reference. The Stop function removes the reference.
Â
¨          Shared objects Registered shared objects are not garbage collected because the SharedObjectRegister function adds an internal reference. SharedObjectUnregister removes the internal reference.
Â
Controlling when garbage collection occurs
Â
Garbage collection occurs automatically in PowerBuilder, but you can use the functions GarbageCollect, GarbageCollectGetTimeLimit, and GarbageCollectSetTimeLimit to force immediate garbage collection or to change the interval between reference count checks. By setting the interval between garbage collection passes to a very large number, you can effectively turn off garbage collection.
Â
|
4
Ans
|
Give some example of function overloading?
Messagebox(),Open(),opentab(),openuserobject() etc. all these functions are overloaded because there are more than one function with same name in same class with different number of parameter.
Â
|
5
Ans
|
Can you open a response window with opensheet function?
Yes, we can open a response window with opensheet function but then that window will not work as response.It will work as a main window.So Opening response windows Do not use the OpenSheet function to open a response window
Â
|
6
Ans
|
Can you open more that one response window at the same time.and why?
No, you can not open multiple response windows at the same time because when you open one response window It expects some input from user then only it proceed further.
Â
|
7
Ans
|
You can inherit the user object and window so which one is preferable and why?
User object is preferable because it takes less memory because in memory structure there there are two pool class pool and instance pool. Class pool maintain the class like window ,userobject and instance pool which keeps all instances of the objects. To run a application atleast one window should be open
So always there will be one window class in class pool. But in case of there is no need to keep any user object in class pool when we do not need it.
|
8
Â
Ans
|
What is the return value of describe and modify function?
Â
dwcontrol.Describe ( propertylist )
Argument Description
dwcontrol        The name of the DataWindow control, DataStore, or child DataWindow for which you want
                          information about the structure
propertylist     A string whose value is a blank-separated list of properties or Evaluate functions. For a list of
                         valid properties, see the DataWindow Reference
Return value
Â
String. Returns a string that includes a value for each property or Evaluate function. A newline character (~n) separates the value of each item in propertylist.
If the property list contains an invalid item, Describe returns an exclamation point (!) for that item and ignores the rest of the property list. Describe returns a question mark (?) if there is no value for a property.
When the value of a property contains a question mark (?), the value is returned in quotes so that you can distinguish between it and a property with no value.
Â
If any argument’s value is NULL, Describe returns NULL.
Â
|
9
Â
Ans
|
Can you copy data from one datawindow to other? And how?
Â
Yes, we can copy data from one datawindow to other. To do so we can use function rowscopy.
dwcontrol.RowsCopy (startrow, endrow, copybuffer, targetdw, beforerow, targetbuffer )
Â
Argument Description
dwcontrol The name of a DataWindow control, DataStore, or child DataWindow from which you want to copy
                  rows
startrow      A long whose value is the number of the first row you want to copy
endrow        A long whose value is the number of the last row you want to copy
copybuffer  A value of the dwBuffer enumerated data type specifying the buffer from which you want toÂ
                     copy the rows: ¨Primary!¨Delete!¨Filter!
targetdw      The name of the DataWindow control or DataStore object to which you want to copy the rows.
                     Targetdw can be the same DataWindow (or DataStore) or another DataWindow (or DataStore)
Beforerow   A long specifying the number of the row before which you want to insert the copied rows. To
                     Insert after the last row, use any value that is greater than the number of existing rows
Targetbuffer A value of the dwBuffer enumerated data type specifying the target buffer for the copied rows.
                     Values are: ¨Primary!¨Delete!¨Filter!
Return value
Â
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, RowsCopy returns NULL.
Â
Usage
Â
When you use the RowsCopy function, the status of the rows that are copied to the primary buffer is NewModified!. If you issue an update request, PowerBuilder will send SQL INSERT statements to the DBMS for the new rows.
Â
When you use RowsCopy, data is not automatically retrieved for drop-down DataWindows in the target DataWindow or DataStore, as it is when you call InsertRow. You must explicitly call Retrieve for child DataWindows in the target.
Â
Uses for RowsCopy include:
Â
¨          Making copies of one or more rows so that the users can create new rows based on existing data
¨          Printing a range of rows by copying selected rows to another DataWindow and printing the second DataWindow
Â
Buffer manipulation and query mode A DataWindow cannot be in query mode when you call the RowsCopy function.
|
10
Â
Ans
|
Can you copy data from one buffer to other within the same DataWindow and how?
Â
Yes, we can copy data from one datawindow to other. To do so we can use function rowscopy.
dwcontrol.RowsCopy (startrow, endrow, copybuffer, targetdw, beforerow, targetbuffer )
Argument Description
Â
Dwcontrol The name of a DataWindow control, DataStore, or child DataWindow from which you want to
                   copy rows
Â
startrow    A long whose value is the number of the first row you want to copy endrow. A long whose value
                   is the number of the last row you want to copy
Â
copybuffer A value of the dwBuffer enumerated data type specifying the buffer from which you want to copy
                   the rows: ¨Primary!¨          Delete!¨ Filter!
Â
Targetdw   The name of the DataWindow control or DataStore object to which you want to copy the rows.
                   Targetdw can be the same DataWindow (or DataStore) or another DataWindow (or DataStore)
Â
Beforerow A long specifying the number of the row before which you want to insert the copied rows. To
                   insert after the last row, use any value that is greater than the number of existing rows.
Â
Targetbuffer A value of the dwBuffer enumerated data type specifying the target buffer for the copied rows. Values are: ¨Primary!¨Delete!¨Filter!
Â
Return value
Â
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, RowsCopy returns NULL.
Â
Usage
Â
When you use the RowsCopy function, the status of the rows that are copied to the primary buffer is NewModified!. If you issue an update request, PowerBuilder will send SQL INSERT statements to the DBMS for the new rows.
Â
When you use RowsCopy, data is not automatically retrieved for drop-down DataWindows in the target DataWindow or DataStore, as it is when you call InsertRow. You must explicitly call Retrieve for child DataWindows in the target.
Â
Uses for RowsCopy include:
Â
¨          Making copies of one or more rows so that the users can create new rows based on existing data
¨          Printing a range of rows by copying selected rows to another DataWindow and printing the second
            DataWindow
Â
Buffer manipulation and query mode. A DataWindow cannot be in query mode when you call the Rowcopy function.
|
Â
11
Â
Ans
|
Â
How can you move record from one datawindow to other and one buffer to other?
Â
Yes you can do so using rowsmove function.
Â
dwcontrol.RowsMove ( startrow, endrow, movebuffer, targetdw, beforerow, targetbuffer )
Â
Argument Description
Dwcontrol  The name of a DataWindow control, DataStore, or child DataWindow from which you want to move rows
startrow           A long whose value is the number of the first row you want to move
Â
endrow            A long whose value is the number of the last row you want to move
Â
movebuffer      A value of the dwBuffer enumerated data type specifying the buffer from which you want to move the rows. Values are:¨ Primary! ¨Delete! ¨Filter!
Â
targetdw          The name of the DataWindow control or DataStore to which you want to move the rows. Targetdw can be the same DataWindow control (or DataStore) or a different DataWindow control (or DataStore), but it cannot be a child DataWindow
Â
beforerow        A long specifying the number of the row before which you want to insert the moved rows. To insert after the last row, use any value that is greater than the number of existing rows
Â
targetbuffer     A value of the dwBuffer enumerated data type specifying the target buffer for the moved rows. Values are: ¨Primary!¨Delete!¨Filter!
Â
Return value
Â
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, RowsMove returns NULL.
Â
Usage
When you use RowsMove, the rows have the status NewModified! in the target DataWindow.
Â
If you move rows between buffers in a single DataWindow control or DataStore, PowerBuilder retains knowledge of where the rows came from and their status is changed accordingly. For example, if you move unmodified rows from the primary buffer to the delete buffer, they are marked for deletion. If you move the rows back to the primary buffer, their status returns to NotModified!. Note, however, that if you move rows from one DataWindow control (or DataStore) to another and back again, the rows’ status is NewModified! because they came from a different DataWindow.
Â
When you use RowsMove, data is not automatically retrieved for drop-down DataWindows in the target DataWindow, as it is when you call InsertRow. You must explicitly call Retrieve for child DataWindows in the target.
Â
Uses for RowsMove include:
Â
¨          Moving several rows from the primary buffer to the delete buffer, instead of deleting them one at a time
¨          Moving rows from the delete buffer to the primary buffer, to implement an Undo capability in your application
Â
Buffer manipulation and query mode A DataWindow cannot be in query mode when you call the RowsMove function.
Â
|
Â
12
Â
Ans
|
Â
How can you delete or filter the records with out sending them to buffer?
Â
We can do so by using rowsdiscard function.
dwcontrol RowsDiscard (startrow, endrow, buffer )
Â
Argument Description
Dwcontrol The name of a DataWindow control or child DataWindow from which you want to discard rows
Â
Startrow  A long whose value is the number of the first row you want to discard
Â
Endrow  A long whose value is the number of the last row you want to discard
Â
buffer   A value of the dwBuffer enumerated data type specifying the buffer containing the rows to be discarded. Values are: ¨ Primary!¨Delete!¨Filter!
Â
Return value
Â
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, RowsDiscard returns NULL.
Â
Usage
Â
Use RowsDiscard when your application is finished with some of the rows in a DataWindow control and you don’t want an update to affect the rows in the database. For example, you can discard rows in the delete buffer, which prevents the rows from being deleted when you call Update.
To clear all the rows from a DataWindow control, use Reset.
Â
|
13
Â
Â
Ans
|
If the datawindow update property is false and you applied a delete function to some records what will happen?
Â
In this case deleted rows will not go to the delete buffer. This time delete work as rowsdiscard function
|
14
Â
Ans
|
How can you make sharing of datawindow off?
Â
You can do so using function sharedataoff.
dwcontrol.ShareDataOff ( )
Â
Argument Description
Â
Dwcontrol   The name of the DataWindow control, DataStore, or child DataWindow for which you want to turn off data sharing
Â
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If dwcontrol is NULL, ShareDataOff returns NULL.
Â
Usage
Two or more DataWindow controls (or DataStores) can share data. See ShareData for more information about shared data buffers and primary and secondary DataWindows.
When you call ShareDataOff for a secondary DataWindow, that control no longer contains data, but the primary DataWindow and other secondary controls are not affected. When you call ShareDataOff for the primary DataWindow, all secondary DataWindows are disconnected and no longer contain data.
|
Â
15
Â
Ans
|
Â
What are the restrictions to share data between to datawindow?
Â
dwprimary.ShareData ( dwsecondary )
Â
Argument Description
Â
Dwprimary      The name of the primary DataWindow. The primary DataWindow is the owner of the data. When you destroy this DataWindow, the data disappears. Dwprimary can be a child DataWindow
Â
Dwsecondary  The name of the secondary DataWindow; which is the control dwprimary will share the data with. The secondary DataWindow cannot be a Crosstab DataWindow. It can be a child DataWindow
Â
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is NULL, ShareData returns NULL.
Â
Usage
The columns must be the same for the DataWindow objects in the primary and secondary DataWindow controls, but the SELECT statements may be different. For example, you could share data between DataWindow objects with these SELECT statements:
Â
SELECT dept_id from dept
SELECT dept_id from dept where dept_id = 200
SELECT dept_id from employee
Â
WHERE clause in secondary has no effect The WHERE clause in the DataWindow object in the secondary DataWindow control has no effect on the number of rows returned. The number of rows returned to both DataWindow controls is determined by the WHERE clause in the primary DataWindow object.
Â
You could also share data with a DataWindow object that has a script data source and a column defined to be like the dept_id column.
Â
To share data between a primary DataWindow and more than one secondary DataWindow control, call ShareData for each secondary DataWindow control.
Â
To turn off sharing in a primary or secondary DataWindow, call the ShareDataOff function. When sharing is turned off for the primary DataWindow, the secondary DataWindows are disconnected and the data disappears. However, turning off sharing for a secondary DataWindow does not affect the data in the primary DataWindow or other secondary DataWindows.
Â
When you call functions in either the primary or secondary DataWindow that change the data, PowerBuilder applies them to the primary DataWindow control and all secondary DataWindow controls are affected. For example, when you call any of the following functions for a secondary DataWindow control, PowerBuilder applies it to the primary DataWindow. Therefore, all messages normally associated with the function go to the primary DataWindow control. Such functions include:
Â
DeleteRow
Filter
GetSQLSelect
ImportFile
ImportString
ImportClipboard
InsertRow
ReselectRow
Reset
Retrieve
SetFilter
SetSort
SetSQLSelect
Sort
Update
Â
Computed fields in secondary DataWindow controls A secondary DataWindow control can only have data which is in the primary DataWindow control. If you add a computed field to a secondary control, it will not display when you run the application unless you also add it to the primary control.
Â
Query mode and secondary DataWindows When you are sharing data, you cannot turn on query mode for a secondary DataWindow. Trying to set the QueryMode or QuerySort properties results in an error.
Â
To share data between a DataStore or DataWindow and a RichTextEdit control, use the DataSource function.
Â
Crosstab DataWindows You cannot use ShareData with Crosstab DataWindows.
Â
Distributed applications You cannot share data between a DataWindow control in a client application and a DataStore in a server application.
Â
|
16
Â
Ans
|
What are the four methods of dynamic sql? Describe it.
Â
Dynamic SQL syntax format 1:
Use this format to execute a SQL statement that does not produce a result set and does not require input parameters. You can use this format to execute all forms of Data Definition Language (DDL).
Â
Dynamic SQL Syntax format 2:
Use this format to execute a SQL statement that does not produce a result set but does require input parameters. You can use this format to execute all forms of Data Definition Language (DDL).
Â
Syntax
PREPARE DynamicStagingArea FROM SQLStatement            {USING TransactionObject} ;
Â
EXECUTE DynamicStagingArea USING {ParameterList} ;
Â
Parameter Description
Â
DynamicStagingArea   The name of the DynamicStagingArea (usually SQLSA)If you need a DynamicStagingArea variable other than SQLSA, you must declare it and                                        instantiated it with the CREATE statement before using it
Â
SQLStatement       A string containing a valid SQL statement. The string can be a string constant or a PowerBuilder variable preceded by a colon (such as :mysql). The string must be contained on one line and cannot contain expressionsEnter a question mark (?) for each parameter in the statement. Value substitution is positional; reserved word substitution is not allowed.
Â
TransactionObject (optional)Â Â Â The name of the transaction object that identifies the database ParameterList (optional). A comma-separated list of PowerScript variables. Note that PowerScript variables are preceded by a colon (:)
Â
Usage
To specify a NULL value, use the SetNull function.
Â
Â
Dynamic SQL syntax format 3: Use this format to execute a SQL statement that produces a result set in which the input parameters and result set columns are known at compile time.
Â
Syntax
Â
DECLARE Cursor | Procedure   DYNAMIC CURSOR | PROCEDURE      FOR DynamicStagingArea ;
Â
PREPARE DynamicStagingArea FROM SQLStatement  {USING TransactionObject} ;
Â
OPEN DYNAMIC Cursor           {USING ParameterList} ;
Â
EXECUTE DYNAMIC Procedure {USING ParameterList} ;
Â
FETCH Cursor | Procedure        INTO HostVariableList ;
Â
CLOSE Cursor | Procedure ;
Â
Parameter Description
Â
Cursor or Procedure   The name of the cursor or procedure you want to use
Â
DynamicStagingArea   The name of the DynamicStagingArea (usually SQLSA)If you need a DynamicStagingArea variable other than SQLSA, you must declare it and instantiate it with the CREATE statement before using it.
Â
SQLStatement A string containing a valid SQL SELECT statement The string can be a string constant or a PowerBuilder variable preceded by a colon (such as :mysql). The string must be contained on one line and cannot contain expressions Enter a question mark (?) for each parameter in the statement. Value substitution is positional; reserved word substitution is not allowed.
Â
TransactionObject (optional)Â Â Â The name of the transaction object that identifies the database ParameterList (optional). A comma-separated list of PowerScript variables. Note that PowerScript variables are preceded by a colon (:)
Â
HostVariableList The list of PowerScript variables into which the data values will be retrieved.
Â
Usage
Â
To specify a NULL value, use the SetNull function.
Â
The DECLARE statement is not executable and can be declared globally.
Â
If your DBMS supports formats of FETCH other than the customary (and default) FETCH NEXT, you can specify FETCH FIRST, FETCH PRIOR, or FETCH LAST.
Â
The FETCH and CLOSE statements in Format 3 are the same as in standard embedded SQL.
Â
To declare a global, shared, or instance cursor or procedure, select Global Variables, Instance Variables, or Shared Variables on the Declare menu of the PowerScript painter. To declare a local cursor, click the Paint SQL button in the PainterBar.
Â
For information about global, instance, shared, and local scope, see “Where to declare variables “.
Accessing attribute information When a statement is described into a DynamicDescriptionArea, this information is available to you in the attributes of that DynamicDescriptionArea variable:
Â
Information Attribute
Number of input parameters      NumInputs
Array of input parameter types  InParmType
Number of output parameters   NumOutputs
Array of output parameter types OutParmType
Â
Setting and accessing parameter values The array of input parameter values and the array of output parameter values are also available. You can use the SetDynamicParm function to set the values of an input parameter and the following functions to obtain the value of an output parameter:
Â
GetDynamicDate
GetDynamicDateTime
GetDynamicNumber
GetDynamicString
GetDynamicTime
Â
For information about these functions, see GetDynamicDate, GetDynamicDateTime, GetDynamicNumber, GetDynamicString, and GetDynamicTime.
Â
Parameter values The following enumerated data types are the valid values for the input and output parameter types:
Â
TypeBoolean!
TypeDate!
TypeDateTime!
TypeDecimal!
TypeDouble!
TypeInteger!
TypeLong!
TypeReal!
TypeString!
TypeTime!
TypeUInt!
TypeULong!
TypeUnknown!
Â
Input parameters You can set the type and value of each input parameter found in the PREPARE statement. PowerBuilder populates the SQLDA attribute NumInputs when the DESCRIBE is executed. You can use this value with the SetDynamicParm function to set the type and value of a specific input parameter. The input parameters are optional; but if you use them, you should fill in all the values before executing the OPEN or EXECUTE statement.
Â
Output parameters You can access the type and value of each output parameter found in the PREPARE statement. If the database supports output parameter description, PowerBuilder populates the SQLDA attribute NumOutputs when the DESCRIBE is executed. If the database does not support output parameter description, PowerBuilder populates the SQLDA attribute NumOutputs when the FETCH statement is executed.
Â
You can use the number of output parameters in the NumOutputs attribute in functions to obtain the type of a specific parameter from the output parameter type array in the OutParmType attribute. When you have the type, you can call the appropriate function after the FETCH statement to retrieve the
output value.
|
Â
17
Ans
|
Â
What is the SQLSA?
DynamicStagingArea is a PowerBuilder data type. PowerBuilder uses a variable of this type to store information for use in subsequent statements.
Â
The DynamicStagingArea is the only connection between the execution of a statement and a transaction object and is used internally by PowerBuilder; you cannot access information in the DynamicStagingArea.
Â
PowerBuilder provides a global DynamicStagingArea variable named SQLSA that you can use when you need a DynamicStagingArea variable.
Â
If necessary, you can declare and create additional object variables of the type DynamicStagingArea. These statements declare and create the variable, which must be done before referring to it in a dynamic SQL statement:
Â
DynamicStagingArea dsa_stage1
Â
dsa_stage1 = CREATE DynamicStagingArea
|
Â
18
Ans
|
Â
What is the SQLDA?
DynamicDescriptionArea is a PowerBuilder data type. PowerBuilder uses a variable of this type to store information about the input and output parameters used in Format 4 of dynamic SQL.
Â
PowerBuilder provides a global DynamicDescriptionArea named SQLDA that you can use when you need a DynamicDescriptionArea variable.
Â
If necessary, you can declare and create additional object variables of the type DynamicDescriptionArea. These statements declare and create the variable, which must be done before referring to it in a dynamic SQL statement:
Â
DynamicDescriptionArea dda_desc1
Â
dsa_desc1 = CREATE DynamicDescriptionArea
|
Â
19
Â
Ans
|
Â
What is the deligation?
Â
In service type application architecture we will have requester and service providers in delegation we have association and aggregation . aggregation means the service object can work in association with requester only they can not work independently exa. Sort service, filter service,serch service etc. and Association means service provider can work independently. Exa. String and date objects
|
Â
20
Â
Ans
|
Â
What is the difference between computed column and computed field?
Â
Computed column means the column defined at sql mode through compute option. And computed field means we add control in to your datwindow object from control list.
Â
|
Â
21
Â
Ans
|
Â
How importstring function works what is the argument to it?
Â
Inserts data into a DataWindow control or DataStore from tab-delimited data in a string.
Â
Controls
DataWindow controls, DataStore objects, and child DataWindows
Â
Syntax
dwcontrol.ImportString ( string {, startrow {, endrow {, startcolumn {, endcolumn {, dwstartcolumn } } } } } )
Â
Argument Description
Â
Dwcontrol       The name of the DataWindow control or DataStore to which you want to copy data from the specified string
Â
String  A string from which you want to copy the data. The string should contain tab-delimited columns with one row per line (see Usage)
Â
startrow (optional)Â Â Â Â Â Â Â The number of the starting row of data in the string you want to import. If the first row contains headings that you want to skip, set startrow to 2. The default is 1
Â
endrow (optional)Â Â Â Â Â Â Â Â The number of the last row of data in the string that you want to import. The default is all rows
Â
startcolumn (optional)Â The number of the first column in the string that you want to import. The default is 1
Â
endcolumn (optional)Â Â The number of the last column in the string that you want to import. The default is the rest of the columns
Â
dwstartcolumn (optional)Â Â Â Â Â Â Â Â The number of the first column in the DataWindow control or DataStore object that you want to receive data. The default is 1
Â
ImportString may trigger an ItemError event.
Â
Return value
Long. Returns the number of rows that were imported if it succeeds and one of the following negative integers if an error occurs:
Â
-1Â startrow value supplied is greater than the number of rows in the string
-3Â Invalid argument
-4Â Invalid input
-9 PowerBuilder or the user canceled import because data failed    validation
Â
If any argument’s value is NULL, ImportString returns NULL.
Â
Usage
The format of the string is the same as if the data came from an ASCII file. The string must be formatted in tab-delimited columns and each line must end with a carriage return and a newline character (~r~n). If the string has four tab-delimited columns, one line might look like:
Â
col1_data~t col2_data~t col3_data~t col4_data~r~n
Â
For a DataWindow control or DataStore, the string should consist of rows of data. If the data includes column headings or row labels, set the startrow and startcolumn arguments to skip them. The data types and order of the DataWindow object’s columns must match the columns of data in the string.
Â
The startcolumn and endcolumn arguments control the number of columns imported from the string and the number of columns in the DataWindow that are affected. The dwstartcolumn argument specifies the first DataWindow column to be affected. The following formula calculates the last DataWindow to be affected.
Â
dwstartcolumn + ( endcolumn – startcolumn )
Â
If string data to be assigned to a single row and column has multiple lines (indicated by line ending characters in the import string), you must quote the string data using ~”. Do not use single quotes.
Â
This example of a valid import string assigns multiline values to each row in column 2:
Â
ls_s = &
Â
“1~t~”Mickey~r~nMinnie~r~nGoofy~” ~r~n” + &
           “2~t~”Susan~r~nMary~r~nMarie~” ~r~n” + &
           “3~t~”Chris~r~nBen~r~nMike~” ~r~n” + &
           “4~t~”Mott~r~nBarber~r~nPicard~” “
|
Â
22
Â
Ans
|
Â
What is the import file functions and tell other functions related to it?
Â
Inserts data into a DataWindow control or DataStore from a file. The data can be tab-delimited text or dBase format 2 or 3.
Â
Controls
DataWindow controls, DataStore objects, and child DataWindows
Â
Syntax
Dwcontrol.ImportFile ( filename {, startrow {, endrow {, startcolumn {, endcolumn {, dwstartcolumn } } } } } )
Argument Description
Â
Dwcontrol   The name of the DataWindow control or DataStore to which you want to copy data from the specified file.
Â
Filename      A string whose value is the name of the file from which you want to copy data. The file must be an ASCII, tab-delimited file (TXT) or a dBase format 2 or 3 file (DBF). Specify the file’s full name, which must end in the appropriate extension.If filename is NULL, ImportFile displays the File Open dialog box and allows the user to select a file.
Â
startrow (optional)Â Â Â Â Â Â Â The number of the first row in the file that you want to copy. If the first row contains headings that you want to skip, set startrow to 2. The default is 1
Â
endrow (optional)Â Â Â Â Â Â Â Â The number of the last row in the file that you want to copy. The default is the rest of the rows
Â
startcolumn (optional)Â The number of the first column in the file that you want to copy. The default is 1
Â
endcolumn (optional)Â Â The number of the last column in the file that you want to copy. The default is the rest of the columns
Â
dwstartcolumn (optional)Â The number of the first column in the DataWindow control or DataStore that you want to receive data. The default is 1
Â
ImportFile may trigger an ItemError event.
Â
Return value
Long. Returns the number of rows that were imported if it succeeds and one of the following negative integers if an error occurs:
Â
 0 End of file; too many rows
-1Â No rows
-2Â Empty file
-3Â Invalid argument
-4Â Invalid input
-5Â Could not open the file
-6Â Could not close the file
-7Â Error reading the text
-8Â Not a TXT file
-9Â The user canceled the import
-10 Unsupported dBase file format (not version 2 or 3)
Â
Usage
The file should consist of rows of data. If the file includes column headings or row labels, set the startrow and startcolumn arguments to skip them. The data types and order of the DataWindow object’s columns must match the columns of data in the file.
Â
The startcolumn and endcolumn arguments control the number of columns imported from the file and the number of columns in the DataWindow that are affected. The dwstartcolumn argument specifies the first DataWindow column to be affected. The following formula calculates the last DataWindow to be affected.
Â
Dwstartcolumn + (endcolumn – startcolumn)
Â
To let users select the file to import, specify a NULL string for filename. PowerBuilder displays the Select Import File dialog box. A dropdown listbox lets the user select the type of file to import.
Â
Importing files into the ANSI and Unicode versions of PowerBuilderÂ
Â
The type of file that can be imported using the ImportFile function varies depending on the file’s format and the version of PowerBuilder you are running.
Â
File type File format that can be imported
Â
.TXTÂ Â Â Â Only Unicode files can be imported into the Unicode version of PowerBuilder. Unicode files cannot be imported into the ANSI version of PowerBuilder
.DBFÂ Â Â Â Files created using either the ANSI or Unicode version of PowerBuilder can be imported into both versions
Â
Other file related functions are file exist, file open, file length, file close, file seek, file write, file delete, getfileopenname, getfilesavename.
Â
|
Â
23
Â
Ans
|
Â
What are the arguments in sqlpreview event. When does it get triggered?
Â
Occurs immediately before a SQL statement is submitted to the DBMS. Functions that trigger DBMS activity are Retrieve, Update, and ReselectRow.
Â
Arguments:-
Request SQLPreviewFunction by value (the function that initiated the database activity)Values are:¨
Â
           PreviewFunctionReselectRow! — ReselectRow function
           PreviewFunctionRetrieve! — Retrieve function¨  Â
             PreviewFunctionUpdate! — Update function
Â
Â
sqltype SQLPreviewType by value (the type of SQL statement being sent to the DBMS)Values are:¨
Â
           PreviewDelete! — A DELETE statement¨          Â
            PreviewInsert! — An INSERT statement¨          Â
            PreviewSelect! — A SELECT statement¨          Â
            PreviewUpdate! — An UPDATE statement
Â
sqlsyntax        String by value (the full text of the SQL statement)
Â
buffer  DWBuffer by value (the buffer containing the row involved in the database activity) Values are:¨           Delete! — The delete buffer (data that has been deleted from the DataWindow)¨ Filter! — The filter buffer (data that has been filtered out)¨  Primary! — The primary buffer (data that has not been deleted or filtered out)
row      Long by value (the number of the row involved in the database activity, that is, the row being updated, selected, inserted, or deleted)
Â
Return value
Long. Return code choices (specify in a RETURN statement):
Â
0Â Continue processing
1Â Stop processing
2Â Skip this request and execute the next request
Â
Usage
Â
Obsolete functions Information formerly provided by GetSQLPreview and GetUpdateStatus is available in the arguments sqlsyntax , row, and buffer.
Â
Some uses for the sqlsyntax argument are:
Â
¨          Changing the SQL to be executed (you can get the value of sqlsyntax, modify it, and call SetSQLPreview)
Â
¨          Keeping a record (you can write the SQL statement to a log file)
Â
GetSQLPreview and binding When binding is enabled for your database, the SQL returned in the GetSQLPreview event may not be complete—the input arguments are not replaced with the actual values. For example, when binding is enabled, GetSQLPreview might return the following SQL statement:
Â
INSERT INTO “cust_order” ( “ordnum”, “custnum”,”duedate”, “balance” ) VALUES ( ?, ?, ?, ? )
Â
When binding is disabled, it returns:
Â
INSERT INTO “cust_order” ( “ordnum”, “balance”,”duedate”, “custnum” ) VALUES ( ‘12345’, 900,’3/1/94′, ‘111’ )
Â
If you require the complete SQL statement for logging purposes, you should disable binding in your DBMS.
Â
For more information about binding, see Connecting to Your Database.
Â
If the row that caused the error is in the Filter buffer, you must unfilter it if you want the user to correct the problem.
Reported row number The row number stored in row is the number of the row in the buffer, not the number the row had when it was retrieved into the DataWindow object
|
Â
24
Ans
|
Â
How many triggers are there in oracle and what they are?
There are 11 triggers used in oracle and they are –
1.      On insert,update,delete
Â
2.      Before insert,update,delete
Â
3.      After insert,update,delete
Â
4.      On statement and on row.
Â
|
25
Â
Ans
|
What setposition function does?
Â
For controls in a window, specifies the position of a control in the front-to-back order within a window. For a window, specifies whether it always displays on top of other open windows.
Â
Controls
A control within a window or a window
Syntax
Objectname.SetPosition ( position {, precedingobject } )
Â
Argument Description
Â
Objectname     The name of a control for which you want to specify a location in the front-to-back order within the window, or the name of a window for which you want to specify whether it will always display on top. Objectname cannot be a child window or a sheet.
Â
Position    A SetPosType enumerated data type. The values you can specify depend on whether objectname is a control or a window.
Â
For controls, values are:
¨Behind! — Position objectname behind precedingobject in the order¨  Â
ToTop! — Position objectname on top of all other controls¨      Â
ToBottom! — Position objectname behind all other controls
Â
For windows, values are:¨         Â
TopMost! — Always display objectname on top of all other open windows¨       Â
NoTopMost! — Do not always display objectname on top of all other open windows
Â
precedingobject (optional)Â Â Â Â Â Â The name of the object you want to position objectname behind. Precedingobject is required if position is Behind!
Â
Return value
Integer. Returns 1 when it succeeds and -1 if an error occurs. If any argument’s value is NULL, Set Position returns NULL.
Â
Usage
The front-to-back order for controls determines which control covers another when they overlap. If a control completely covers another control, the control that is in back becomes inaccessible to the user.
When you specify TopMost! for more than one window, the most recently executed SetPosition function controls which window displays on top.
Â
|
26
Â
Ans
|
What are the painters provided in the Power builder?
Â
There are 14 painter in pb. They are –
Application, window, userobject, menu, functions, structure, datawindow, library, project, report, database, table, query, pipeline.
|
27
Â
Ans
|
If the page size is go down or is less what error does Sybase gives?
Â
Low pges size error will come.
Â
|
28
Â
Ans
|
Why the user events are not given on menu?
Â
Events of menu are mapped with windows menu event, which we can not modify through the power builder.
Â
|
29
Â
Ans
Â
|
How the package function in oracle calls in pb?
Â
Through RPC call.
|
30
Â
Ans
|
What is the object coupling?
Â
This is nothing but delegation, which includes aggregation & association.
|
31
Â
Ans
|
What functions we generally used in closequery event and what does it triggers?
Â
Closequery occurs before the close event, so we can give an overriding message whether the user wants to save before closing.
|
32
Â
Ans
|
What is the lookupdisplay function?
Â
 Obtains the display value in the code table associated with the data value in the specified column.
Â
Syntax
LookUpDisplay ( column )
Â
Argument Description
column           The column for which you want the code table display value
Â
Return value
String. Returns the display value when it succeeds and the empty string (“”) if an error occurs.
Â
Usage
If a column has a code table, a buffer stores a value from the data column of the code table, but the user sees a value from the display column. Use LookUpDisplay to get the value the user sees.
Code tables and data values and graphs When a column that is displayed in a graph has a code table, the graph displays the data values of the code table by default. To display the display values, call this function when you define the graph data.
Â
|
33
Â
Ans
|
What the pb.ini does?
Â
When you run power builder it goes through the pb.ini which contains information about the various painters, database profiles and many things and set the properties accordingly . If you make any changes like created new profile the entry for that will be done in pb.ini.
Â
|
34
Â
Ans
|
What for the open event of application object is used.
Â
This event is getting called when the application starts so we can use this event to open first frame window as well as making connection with the database or whatever operations you want to do when the application starts.
|
35
Â
Ans
|
How many events are there in application object and what they are?
Â
There are six event for the application object. They are –
Open, Close, System Error, Idle, Connection Begin, and Connection End.
Â
|
36
Â
Ans
|
From which pb object error and message object are inherited?
Â
PowerObject is the base object for all powerbuilder objects.
Â
|
37
Â
Ans
|
What are the global variables and objects in pb?
Â
Error, Message, SQLCA, SQLSA, SQLDA.
Â
|
38
Â
Ans
|
What all are the graph styles?
Â
Area, Bar, Column, Line, Pie, Scatter, 3D area, 3D Bar, 3D Column, 3D Line, 3D Pie, Stacked Bar, Stacked Column, Solid Bar, Solid Column, Solid Stacked Column, Solid Stacked Bar.
Â
|
39
Â
Ans
|
What all datawindow styles are provided with pb?
Â
Composite, Freeform, N-Up, Tabular, Grid, Group, Label, CrossTab, Graph, OLE, RichText.
Â
|
40
Â
Ans
|
Difference between datawindow and datastores?
Â
A datawindow is a visual object whereas a datastore is a non-visual object. A datawindow cannot be explicitly destroyed while a datastore can be destroyed. A datastore is basically used for background processing in place of cursors.
Â
|
41
Â
Ans
|
What are the difference between datasource and datastores?
Â
A datasource is the method used to populate data into a datawindow. While a datastore is a non visual datawindow.
Â
|
42
Â
Ans
|
How can you get column level and row level item status?
Â
The second parameter to the getItemStatus function decides which status is being asked for. If the second parameter is 0 then a row status is returned whereas if a no .(1,2,3 ..) is given then the status for that column is returned.
Â
Syntax
dwcontrol.GetItemStatus ( row, column, dwbuffer )
Â
Argument Description
Â
dwcontrol        The name of the DataWindow control, DataStore, or child DataWindow in which you want to obtain the status of a row or a column in a row
Â
row     A long identifying the row for which you want the status
Â
column           The column for which you want the status. Column can be a column number (integer) or a column name (string). Specify 0 to get the status of the whole row.
Â
Dwbuffer         A value of the dwBuffer enumerated data type identifying the DataWindow buffer that contains the row:
¨Primary! — The data in the primary buffer (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)
Â
Return value
A value of the dwItemStatus enumerated data type. Returns the status of the item at row, column of dwcontrol in dwbuffer. If column is 0, GetItemStatus returns the status of row. If any argument’s value is NULL, GetItemStatus returns NULL.
Â
Usage
The values of the dwItemStatus enumerated data type are:
Â
¨NotModified! — The information in the row or column is unchanged from what was retrieved.
Â
¨DataModified! — The information in the column or one of the columns in the row has changed since it was retrieved.
Â
¨New! — The row is new but no values have been specified for its columns. (Applies to rows only, not to individual columns.)
Â
¨NewModified! — The row is new, and values have been assigned to its columns. In addition to changes caused by user entry or the SetItem function, a new row gets the status NewModified! when one of its columns has a default value. (Applies to rows only, not to individual columns.)
Â
Use GetItemStatus to understand what SQL statements will be generated for new and changed information when you update the database.
Â
For rows in the primary and filter buffers, Update generates an INSERT statement for rows with NewModified! status. It generates an UPDATE statement for rows with DataModified! status. Only columns with DataModified! Status are included in the UPDATE statement.
Â
For rows in the delete buffer, Update does not generate a DELETE statement for rows whose status was New! or NewModified! Before being moved to the delete buffer.
Â
|
43
Â
Ans
|
What are the item status provided with pb?
Â
There are four ItemStatus. – NotModified!, DataModified!, New!, NewModified!.
Â
|
44
Â
Ans
Â
Â
Â
|
What item status generate update statements?
Â
NewModified & DataModified.
|
45
Â
Ans
|
How can you trap errors in pb?
Â
In the SystemError event, DB Error Event, ItemError Event.
Â
|
46
Â
Ans
|
What is the difference between post event and triggerevent?
Â
Post event is placed at the end of the windows message object queue where as a triggerevent is executed immediately.
TriggerEvent and PostEvent are useful for preventing duplication of code. If two controls perform the same task, you can use PostEvent in one control’s event script to execute the other’s script, instead of repeating the code in two places. For example, if both a button and a menu delete data, the button’s Clicked script can perform the deletion and the menu’s Clicked event script can post an event that runs the button’s Clicked event script.
Â
|
47
Â
Ans
|
What are the difference between event and functions?
Â
A event can be extended but not overrided & overloaded whereas a function can be.Â
If a event is called dynamically then even if the event is not there at runtime it only returns a –1 while in similar case a function will fire an error.
Â
|
48
Â
Ans
Â
|
What are the scope of variables and in which sequence pb search for the variables?
Â
There are four scopes local, shared, global and instance and pb search variables in the same order
|
49
Â
Ans
|
What is the sequence for searching the files in pb applications?
Â
While running application from which directory application is running it will search in that folder and then it follows windows sequence.
Â
|
50
Â
Ans
Â
|
What all functions you can not call in itemchange event and why?
Â
If you call any of the following function in item change event it will go in indefinite loop because these functions call the item change event again. These events are –
Accept text all scroll functions, set row, set column
|
51
Â
Ans
|
What are the return values of item change event?
Â
There are three return values in this event
Occurs when a field in a DataWindow control has been modified and loses focus (for example, the user presses enter, the tab key, or an arrow key or clicks the mouse on another field within the DataWindow). ItemChanged can also occur when the AcceptText or Update function is called for a DataWindow control or DataStore object.
Event ID
Event IDÂ Â Â Â Â Â Â Â Â Â Objects
pbm_dwnitemchange    DataWindow control or DataStore
Arguments
Argument Description
row     Long by value (the number of the row containing the item whose value has been changed)
dwo     DWObject by value (a reference to the column containing the item whose value has been changed.  Â
             Dwo is a reference to the column object, not the name of the column)
data     String by value (the new data the user has specified for the item)
Â
Return value
Long. Return code choices (specify in a RETURN statement):
0Â (Default) Accept the data value
1Â Reject the data value and don’t allow focus to change
2Â Reject the data value but allow the focus to change
Â
Usage
Â
The ItemChanged event does not occur when the DataWindow control itself loses focus. If the user clicks on an Update or Close button, you will need to write a script that calls AcceptText to see if a changed value should be accepted before the button’s action occurs.
Obsolete techniques Information formerly provided by the GetText function is available in the data argument.
Instead of calling SetActionCode, use a RETURN statement with a return code.
Â
|
52
Â
Ans
|
If you want to call update function in itemchange event what cares you need to take?
Â
When you call the update function in item change event we need to accept the value of lastly modified column.but we can not call the accept text function in the item change event so we need to set the value to that column using set text function.
Â
|
53
Â
Ans
|
How can you get values from original buffer?
Â
Gets data whose type is String from the specified buffer of a DataWindow control or DataStore object. You can obtain the data that was originally retrieved and stored in the database from the original buffer, as well as the current value in the primary, delete, or filter buffers.
Â
Controls
Â
DataWindow controls, DataStore objects, and child DataWindows
Â
Syntax
dwcontrol.GetItemString ( row, column {, dwbuffer, originalvalue } )
Â
Argument Description
Â
Dwcontrol The name of the DataWindow control, DataStore, or child DataWindow in which you want to obtain the string data contained in a specific row and column
Â
Row:Â Â Â A long identifying the row location of the data
Â
Column: The column location of the data. The data type of the column must String. Column can be a column number (integer) or a column name (string). To get the contents of a computed field, specify the name of the computed field for column. Computed fields do not have numbers
Â
Dwbuffer: (optional)Â A value of the dwBuffer enumerated data type identifying the DataWindow buffer from which you want to get the data:Â
Primary! — (Default) The data in the primary buffer (data that has not been deleted or filtered out)¨
Delete! — The data in the delete buffer (data deleted from the DataWindow)¨     Â
Filter! — The data in the filter buffer (data that was filtered out)
Â
originalvalue (optional) A Boolean indicating whether you want the original or current values for row and column:
¨True — Return the original values (the values initially retrieved from the database)
¨False — (Default) Return the current valuesIf you specify dwbuffer, you must also specify originalvalue
Â
Return value
String. Returns NULL if the column value is NULL. Returns the empty string (“”) if an error occurs. If any argument’s value is NULL, GetItemString returns NULL.
Â
Usage
Use GetItemString to get information from the DataWindow’s buffers. To find out what the user entered in the current column before that data is accepted, use GetText. In the ItemChanged or ItemError events, use the data argument.
To access a row in the original buffer, specify the buffer that the row currently occupies (primary, delete, or filter) and the number of the row in that buffer. When you specify TRUE for originalvalue, the function gets the original data for that row from the original buffer.
Â
Mismatched data types An execution error occurs when the data type of the DataWindow column does not match the data type of the function, in this case String.
Â
|
54
Â
Ans
|
What all buffers are present in pb?
Â
Basically there are three buffers provided with the pb DataWindows. They are given below –
Primaries buffer, delete buffer, filter buffer. There is one more buffer called as original buffer that is when we retrieve the datawindow data will be in original buffer.
Â
|
55
Â
Ans
|
What are the disadvantages of the triggers?
Â
First major disadvantage is that user will not have any control over process as the trigger fire automatically on
certain operations. Also user can not come to know that some thing has happen on his operation as trigger fire in the background automatically.
Â
|
56
Â
Ans
|
What all are the ddl (data definition language) statements?
Â
All create statement are the ddl. As well as all grant and revoke statements are ddl.
Â
|
57
Â
Ans
|
Can you write commit in triggers and why?
Â
No we can not write commit in trigger because in triggers fire automatically on certain operation. And if two users are using the same application and doing same operation on the operation of one user commit will fire and some invalid data may get save.
Â
|
58
Â
Ans
|
Can you write create statement in procedure?
Â
Yes
|
59
Â
Ans
|
How can you call procedure in pb?
Â
There is a three ways from which you can call procedure in PB.
First is through the embedded sql , second is through the procedure datasource for making datawindow objects and last is using RPC call through the transaction object.
Â
|
60
Â
Ans
|
How can you make datawindow from procedure?
Â
You can do so by using procedure type datasource for creating new datawindow object.
Â
|