設為首頁收藏本站

艾歐踢論壇

 找回密碼
 立即註冊

QQ登錄

只需一步,快速開始

搜索
熱搜: 活動 交友 discuz
查看: 723|回復: 0
打印 上一主題 下一主題

Centura Important Questions:

[複製鏈接]
跳轉到指定樓層
樓主
發表於 2017-9-6 13:06:12 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
  • What      is the different between SqlPrepare       & SqlPrepareAndExecute ?
  • How      many types of SQLWindows Functions & what are there ?
  • How      many types of Windows Messages are there and what are there ?
  • How      many types of SQL Error Handling are there and what are there ?
  • What      are the Types of Classes in Centura ?
  • What      are the window Types of Objects in Centura ?
  • What      are the System Variables in Centura ?
  • What      is the different between .APL & .APD ?
  • What      is Scalable Application Language (SAL) ?
  • What      is the different between SAL & SAM ?
  • What      is the different between Internal & External Function ?
  • What      is the Command Line Arguments in centura ?
  • How      many ways we will use Variables in SQL Statements ?
  • What      are the Types of inheritance in centura ?
  • What      are the classes Types of Objects ?
  • What      is the different between SalSendMessage() & SalPostMessage() ?
  • What      is the different between SAM_Create & SAM_CreateComplete
  • What      are different Modal Dialog box ?
  • What      are the different between SAM_Close & SAM_Destroy ?
  • What are the Types of table windows ?
  • How many ways u      can populate the records in table window ?
  • What are      different Constants for populating the table window in SalTblPopulate ?
  • What are the      Calling Window Functions ?
  • How can u create      a popup menu dynamically at runtime ?
  • What      is the different between Dialog box and Form window ?
  • What      are the Isolation levels in centura ?
  • I call SqlPrepare and SqlExecute, but data fields      are not being populated.      ?
  • What is the different between SAM_KillFocus and SAM_SetFocus      ?
  • What is the different between SqlPrepareAndExecute      and SqlImmediate ?
  • How to open a file in centura ?

ANSWERS


1. SqlPrepare:- Compiles a SQL statement for execution. Compiling includes:
Checking the syntax of the SQL statement.
Checking the system catalog.
Processing a SELECT statement's INTO clause.
SqlPrepareAndExecute :-  Compiles and executes a SQL statement. Compiling
includes:
Checking the syntax of the SQL statement.
                            Checking the system catalog.
                                          Processing a SELECT statement's INTO clause.
2.    Centura functions are special command words used for writing the Centura actions (procedures) that are executed at runtime.
There are three types of functions in Centura:
List of Functions
Internal Functions
External Functions
3.   There are three types of messages:
Windows Messages (WM_*)
Scalable Application Messages (SAM_*)
Programmer Assigned Messages (PAM_*)
Window Messages(WM_*):- Microsoft Windows messages are defined in WINDOWS.H. These messages have a WM_ prefix, such as WM_Close or WM_Paint. You can process these messages in Centura applications; to do this, you need the Microsoft Windows SDK.
Scalable Application Messages (SAM_*):- Centura has its own set of messages, prefixed by 'SAM_' (Scalable Application Messages).
They take the form of:
Number: SAM_* = WM_USER + (a number)
Programmer Assigned Messages (PAM_*) :- Programmer Assigned Messages (PAM_*) are constants defined in the User section of Constants in Global Declarations.
The constants you define with the PM_* or PAM_* prefix appear automatically in the Coding Assistant dialog box.
4.  All Sql* functions (except for SqlError) return TRUE if successful or FALSE if not successful. If a function fails, an application uses:
Centura default error handling
Application-defined error handling (optional)
Default SQL Error Handling :- If you do nothing to handle SQL errors, Centura uses its default error handling; it displays a dialog box with information about the error. In the dialog box, the user can choose to:
Continue to run the application. The Sql* function that caused the error returns FALSE.
End the application.
Application-Defined SQL Error Handling :- To code your own SQL error handling:
  • Use      the When SqlError statement in      any actions section to handle errors on a local level
  • Use SAM_SqlError handling in the      Application Actions section to handle errors on a global level
5.  Centura has three types of classes:
Functional classes
Window classes
General window classes
Functional Classes :- A functional class supplies behavior through its functions. You use functional classes to:
  • Create      user-defined variables
  • Define      behavior that is shared by more than one window class
A functional class can be:
  • A      base class of another functional class
  • A      base class of a window class
  • Derived      from another functional class, but not from a window class
If behavior needs to be shared by more than one window type, you can place the behavior in a functional class and then derive window classes from that functional class. The derived classes inherit the common behavior as well as behavior appropriate to their window type.
Window Classes :- There is a class for each standard window type. A window class can be:
  • A      base class only of the same window class type. For example, a data field      class can be the base class only of another data field class.
  • Derived      from another window class of the same type or from a functional class.
General Window Classes :- With general window classes, you can create classes with both message actions and functions that you can use with any type of window. A general window class is like a functional class, except that it has a message actions section:
General Window Class:
Description:
Derived From
Class Variables
Instance Variables
Functions
Message Actions
These are the inheritance rules for general window classes:
  • A      general window class can be a base class of any window class, including      other general window classes.
  • A      general window class can be derived from functional classes or another      general window class.
  • Multiple      inheritance is supported.
  • A      general window class cannot be a base class of a functional class.
You cannot create an instance of a general window class. You can only use a general window class as a base class of a concrete window class.
6. In Centura there are three types of objects: top-level objects, child objects, and menus. Menus are not typical child objects because you can not create them from the Controls toolbar or the Tools menu.
Top-Level Objects                                                     Child Objects
Dialog Box                                                                   Background Text
Form Window                                                              Check Box
MDI Window                                                               Combo Box
Custom Control
Table Window              
Data Field
Frame
Menus            
Group Box
Cascading Menus                                                         Line
Menu Column                                                               List Box
Menu Items                                                                  Multiline Text Field
Menu Row                                                                   Option Button
Menu Separator                                                           Picture
Pop-up Menus                                                             Push Button
Radio Button
Scroll Bar (Horizontal)
Scroll Bar (Vertical)
Table Window
Table Window Column
7.     
  • hWndForm      nArgCount
  • hWndItem      strArgArray
  • hWndMDI
  • hWndNULL      SqlDatabase
SqlUser
  • lParam      SqlPassword
  • wParam      SqlResultSet
SqlInMessage
  • MyValue      SqlOutMessage
SqlNoRecovery
SqlIsolationLevel
8.  Include libraries let you:
  • Share      application components in more than one application
  • Share      application components with other developers
An include library is a collection of Centura objects such as form windows, dialog boxes, or class definitions that are shared by more than one application. You edit include libraries in the same way as an application.
You maintain components for an include library in a single source file. This means that you only need to change one source file to change a component used in many applications.
An include library only contains components that you use in other applications. An include library contains a set of related outline items. An item is anything that you can copy to the Clipboard.
Dynalibs libraries:- A dynalib is a compiled Centura SQLWindows module with functions and objects that other applications can dynamically load at runtime.
A dynalib is different from an include library:
With an include library, you share source code at designtime. All items in the include library are available in the including application.
With an dynalib, you share compiled code at runtime. Only the interface to objects and functions are available to an application that uses a dynalib.
The advantages using a dynalib are:
·        Modular Design. You can split an application into separate modules (dynalibs), with each module dedicated to a single purpose. You can also create nested dynalibs.
·        Reduced Footprint. You need less disk space to deploy a group of applications when they share code in common libraries.
·        Modular Upgrades. You can recompile a library after an application is in production without recompiling the application.
·        Source Code Security. You can distribute libraries developed in SAL without revealing the source.
Faster Compiles. You do not need to compile dynalibs every time you compile the application. Unlike an include library, the code in a dynalib is not recompiled when you compile the application. This means that using dynalibs can reduce the time required to compile an application.
  • Scalable Application Language      :- Scalable Application Language (SAL) is a procedural language used      for writing Centura actions (procedures) that you want your application to      execute when events take place.
You add SAL statements to:
·        The Application Actions section of an outline.
·        The Actions section of an Internal Function.
·        The Menu Actions section of a menu item.
·        The Message Actions section of an object.
10. Scalable Application Language :- Scalable Application Language (SAL) is a procedural language used for writing Centura actions (procedures) that you want your application to execute when events take place.
Scalable Application Messages (SAM) :- Centura has its own set of messages, prefixed by 'SAM_' (Scalable Application Messages).
They take the form of:
Number: SAM_* = WM_USER + (a number)
Some SAM messages are all built on top of the WM_USER constant. WM_USER is the constant upper boundary of all Windows Messages provided by Microsoft. This means that if you add WM_USER + 1 then you get a number that will not be used as the constant for any other Windows message.
These take the form of:
Number SAM_* = WM_*
Other SAM messages are equal to a WM_* message. Such as SAM_Click which is the same as WM_LBUTTONDOWN.
11. Internal Functions :- Internal functions are programmer-defined function calls that you write in SAL. You declare internal functions in an application outline's Global Declarations Internal Functions section. You can access these functions from anywhere in the application.
The formal declaration consists of:
  • Function      Name
  • Description
  • Return      Value
  • Parameters
  • Static      Variables
  • Local      variables
  • Actions
External Functions:- External functions are written in C or assembly language and are included in Windows dynamic link libraries (DLLs).
You declare external functions in the Global Declarations External Functions section of an application's outline.
These functions must use the FAR PASCAL calling convention and they must be EXPORTED from the library (using ordinal numbers).
12. Command Line Arguments – Applications :-  Command line arguments allow you to pass information to an application. In Centura, you can specify command line arguments:
  • On      the File Run dialog box's Command Line.
  • When      you call the SalLoadApp or SalLoadAppAndWait function.
  • The      Command Line field in Windows' Program Item Properties dialog box.
For example, if you have two applications (app1 and app2) that connect to the same database and app1 calls app2, you may find it useful to pass the information required in a normal login procedure (database name, user name, and password) from app1 to app2. This enables app2 to connect to the database and allows the user to bypass the login procedure that would normally be required when opening app2.
13. Variables in SQL Statements :- You use variables in SQL statements in two ways:
  • To      bind program data to a SQL statement. When used this way, they are called      ‘bind variables’.
  • To      provide a location to store retrieved output. The INTO clause of a SELECT      statement specifies the location where Centura places the query data.      Variables in an INTO clause are called ‘into variables’.
When a variable appears in a SQL statement, it must be prefixed by a colon (.
14. Class Inheritance :- You can define classes in terms of other classes. One class inherits behavior from one or more other classes. There are two types of inheritance:
Single inheritance
Multiple inheritance
Single Inheritance
  • With      single inheritance, you derive a class from another class called the base      class. The word single in single inheritance means that a class has only      one direct base class.
  • Multiple      levels of inheritance are allowed. In other words, you can use inheritance      to create a class hierarchy.
Multiple Inheritance
  • With      multiple inheritance, a class has more than one direct base class.
15. Class Types of Objects :- Centura has three types of objects:
Standard window objects
User-defined window objects
User-defined variables (UDVs)
Standard window objects :- Standard window objects are the window objects which experienced Centura programmers already know. You use classes and inheritance to create two types of user-defined objects:
  • Visual      objects are user-defined windows.
  • A      non-visual object is a user-defined variable.
User-Defined Windows :- You create a user-defined window as an instance of a window class: You customize the window's behavior through its class definition. A user-defined window object is like a standard window object because it:
·        Has visual attributes (you can see it, unless it is hidden or invisible)
·        Is associated with a window handle that identifies it
·        Can receive Windows messages and SAM_* messages
User-Defined Variables :- You create a user-defined variable as an instance of a functional class: User-defined variables are non-graphic objects. User-defined variables are different from other variables because the only way you can access a user-defined variable is through functions defined in its class. These functions are the user-defined variable's public interface. You can place a user-defined variable in any variables section in the outline. A user-defined variable:
  • Does      not have a handle like a user-defined window
  • Cannot      respond to messages
  • Has no      value and cannot be used in an expression.
16. SalSendMsg() :- Sends the specified message to a window. SalSendMsg does not return until the processing for the message is complete.
SalPostMsg() :- Posts the specified message to a window by adding nMsg to hWndReceiver's message queue.
Messages can be posted or sent:
• Posted (queued) messages are placed in an application's message queue. If
there are other messages in the application's queue, the object does not
receive the message until the application processes the messages ahead of it.
• Sent (nonqueued) messages are sent to an object directly. You send a
nonqueued message when you want the application to do something
immediately.
SalPostMsg queues the message and returns immediately. SalSendMsg sends the
message directly to an object and returns only after the receiver processes the
message.
17. SAM_Create :-   SAM_Create is sent to a top-level window (dialog box, form window, or table window) and then to all of its children after they are created, but before they are made visible. It is also sent to an MDI window.
For example, Centura follow these steps to create a form window that has data fields:
  • Create      the form window.
  • Create      each of its data fields.
  • After      Centura creates all the windows, but before making them visible, Centura      sends SAM_Create to the objects in this order:
  • The      form window.
  • Each      of the form's data fields.
After Centura sends the SAM_Create messages, Centura makes the form window and data fields visible.
By processing the SAM_Create message, an application can perform initialization tasks. Typical initialization tasks include setting data field values and populating table windows and list boxes with data from a database.            
SAM_CreateComplete :- Centura sends SAM_CreateComplete to windows with contents (top-level windows and child table windows) after creating the window's children and displaying the window (and its children).
For example, suppose you create a form window with a data field and a child table window. The child table window has one column. The following happens:
  • The      form window is created.
  • The      data field is created.
  • The      child table window is created.
  • The      child table window's column is created.
Once all this is done, Centura sends a SAM_Create message to the top-level window and all of its children. Next, Centura makes the form window and its children visible. Finally, Centura sends a SAM_CreateComplete message to the child table window, and then to the form window (the top-level window).
By processing the SAM_CreateComplete message, you can do initialization tasks that depend on the state or contents of child windows. You can also use SAM_CreateComplete to wait to do initialization tasks until after a top-level window (and its children) has become visible.
18. Dialog Box :- You can use dialog boxes to let the user enter data, or to display warning or error messages. You can place child objects such as data fields, pushbuttons, and background text in a dialog box
A dialog box is like a form window, but it cannot be resized at runtime, it does not have a menu, and it does not have minimize and maximize push buttons. Also, you cannot create a dialog box automatically when the application starts. You must call SalCreateWindow or SalModalDialog to create a dialog box.
There are three types of dialog boxes: modeless, modal, and system modal.
  • Modeless:      A modeless dialog box does not suspend application processing. The user      can switch from the dialog box to another window in the application or to      a window in a different application.
You create a modeless dialog box with SalCreateWindow and close it with SalDestroyWindow.
  • Modal:      A modal dialog box suspends application processing until the user closes      the dialog box. The user cannot switch from the dialog box to another      window in the application. However, the user can switch to a window in a      different application.
You create a modal dialog box with SalModalDialog and close it with SalEndDialog.
  • System      Modal: A system modal dialog box suspends processing of the entire system      until the user closes he dialog box. The user cannot switch between the      dialog box and another window in the application or to a window in a      different application.
You create a system modal dialog box with SalModalDialog and close it with SalEndDialog.
19. SAM_Close :- SAM_Close is sent to a dialog box, a form window, MDI window, or a top-level table window when you choose the Close command from a window's system menu or when you double-click on the window's system menu.
SAM_Close is sent to an application to notify the application that you are attempting to close a window. By processing the SAM_Close message, an application can check the form window or table window to see if there is data that needs to be saved to the data source.
SAM_Destroy :- SAM_Destroy is sent to a top-level window (dialog box, form window, or table window) and then to all of its children just before the windows are destroyed. SAM_Destroy messages are sent after SAM_Close has been sent to the top-level window. For example, if a form window has data fields, Centura sends the messages to the objects in this order:
  • SAM_Close      to the form window.
  • SAM_Destroy      to the form window.
  • SAM_Destroy      to each of the form window's child windows.
After all of the SAM_Destroy messages are sent, the top-level and child windows are destroyed.
20. Types of Table Windows :- A table window can be:
• A top-level window
• A child of a form or dialog box
Both types of table windows refer to the entire window as a single entity.
Top-level window :- Top-level table windows have the same features as form windows (title, menu, and icon).
Child Window :- A child table window is a child of a form window or dialog box. A child tablewindow is like a top-level window, but it does not have a menu, title, system menu,icon, toolbar, or status bar. Also, a child table window is not resizable and does not
have minimize and maximize push buttons. A child table window is created and
destroyed along with its parent.
21. Populating a Table Window :- You can populate a table windows in two ways:
SalTblPopulate (simple technique), which populates a table window with a
result of a database query
SalTblSetRange (advanced technique), which populates a table window with
data from any source
For the advanced technique, the data for a table window can come from one or more
of the following sources:
• Database tables
• Flatfiles
• Arrays
• Variables
• Constants
Populating with SalTblPopulate (simple technique)
The example below tells SalTblPopulate to populate the visible rows in the table
window and then populate additional rows as the user scrolls:
Call SalTblPopulate( tblCompanyInfo, hSqlA, '',TBL_FillNormal )
In order, the parameters are:
• Table window handle.
• Sql Handle.
• SELECT statement. If you have already prepared the SELECT statement,
specify an empty string (' '). If you have not prepared the SELECT statement,
specify it in this parameter.
• A constant that specifies how to populate the table:
Populating with SalTblSetRange (advanced technique)
The table range is the number of rows in the table window. The table range can be
smaller or larger than the number of rows visible on the screen.
Set the table range by calling SalTblSetRange:
SalTblSetRange( hWndTbl, 0, nMaximum )
In order, the parameters are:
• Table window handle
• The lower bound of the table range
• The higher bound of the table range
To create an empty table window, set the second and third parameters to 0 and -1:
SalTblSetRange( hWndTbl, 0, -1 )
To set a dynamic table range, set the second and third parameters to 0 and
TBL_MaxRow:
SalTblSetRange( hWndTbl, 0, TBL_MaxRow )
A dynamic table range has some important features that are discussed in a separate
section.
When you call SalTblSetRange, SQLWindows sends one SAM_FetchRow message
for each visible row in the table window. The application does two things to process
SAM_FetchRow messages:
• Gets the data from the source
• Assigns the data values to the table window columns
When the user scrolls in a table window and a row needs to be displayed that is not
currently in the cache, SQLWindows sends a SAM_FetchRow message to the table
window for each row.
22. SalTblPopulate :- How to populate the table window. Specify one of these values:


    • TBL_FillAll
    • TBL_FillAllBackground
    • TBL_FillNormal
  • TBL_FillAll :- The SalTblPopulate function uses this constant to populate an entire table window at once.
TBL_FillAllBackground :- The SalTblPopulate function uses this constant to populate the visible portion of a table window first, then return control to the application and continue fetching rows in the background.
Centura fetches subsequent rows at a rate of one row every 1/4 of a second. Once all rows have been fetched, the table window receives a SAM_FetchDone message.
TBL_FillNormal :- The SalTblPopulate function uses this constant to populate only the visible portion of a table window. Centura populates the rest of the table window as you scroll and bring new rows into view.
23. Calling Window Functions :-
Unqualified reference :- Only call a window function with an unqualified reference in:
• The window object that defines the function
• A child window contained in the window, regardless of its depth of nesting
Use the same syntax that you use to call an internal function:
Call WindowFunction( parameters )
Object-qualified reference :- To call a window function defined by a child of the current window, use an objectqualified reference that qualifies the function name with the object name of the child:
Call childWndName.WndFunc( parameters )
You can also use this syntax to call a function:
• Defined in the current window
• Defined in a window unrelated to the current window if the window name is
a top-level window or MDI window and only one instance has been created
• Defined or inherited by the object's class, if the named object is an instance
of a class
Fully object-qualified reference :- From outside a window, you can use a fully object-qualified reference. Specify a window handle:
Call hWnd.objectName.WndFunc( parameters )
You can use this type of qualification to call a function for a window with multiple
instances.
Late-bound fully class-qualified reference :- Use this syntax when the object identified by the handle is one of the following:
• An instance of the specified class (cls in the example below)
• An instance of a class derived from the specified class
For example:
Call hWnd.cls..function( parms )
24. Creating popup menus dynamically at runtime :- You can create popup menus dynamically anywhere on the screen at runtime with SalTrackPopupMenu:
SalTrackPopupMenu( hWnd, strMenuName, Flags, nX, nY )
The parameters are:
hWnd The window handle for a top-level window that processes messages that the popup menu sends
strMenuName A named menu defined in one of the following:
• The Named Menus section of hWnd
• The Named Menus section of hWnd's MDI window parent
• The Named Menus section of Global Declarations
nFlags How to display the popup menu. You can combine these flags
using the “|” operator:
TPM_CursorX Display the menu at the location of the
mouse cursor instead of nX
TPM_CursorY Display the menu at the location of the
mouse cursor instead of nY
TPM_LeftButton The user can click items in the menu
with the left button (default)
TPM_RightButton The user can click items in the menu
with the right button
TPM_LeftAlign Left-align the menu with its horizontal
screen coordinate
TPM_CenterAlign Center-align the menu with its
horizontal screen coordinate
TPM_RightAlign Right-align the menu with its horizontal
screen coordinate
nX, nY The location of the menu in screen coordinates
Example
This example creates an Edit popup menu when the user clicks the mouse button. The
menu appears where the mouse is positioned when the user clicks.
On SAM_Click
Call SalTrackPopupMenu( hWndForm, 'menuEdit', TPM_CursorX | TPM_CursorY | TPM_CenterAlign, 0, 0 )

25.  A dialog box is like a form window, but it cannot be resized at runtime, it does not have a menu, and it does not have minimize and maximize push buttons. Also, you cannot create a dialog box automatically when the application starts. You must call SalCreateWindow or SalModalDialog to create a dialog box.
26. The isolation level controls the effect that changes made by one user have on another
user accessing the same tables. SQLBase has these isolation levels:
• Read Repeatability (RR) (default)
• Cursor Stability (CS)
• Read Only (RO)
• Release Locks (RL)
27. SqlPrepare compiles the SELECT statement and SqlExecute executes the query,
but does not populate the data fields. To populate the data fields, you must call
SqlFetchRow or SqlFetchNext.
SalTblPopulate and SalListPopulate perform all three functions. SqlPrepareAndExecute
combines the SqlPrepare and SqlExecute in one function.
28. When the focus changes, SQLWindows first sends SAM_KillFocus to a table
window and then SAM_SetFocus:
• The wParam of SAM_KillFocus is the window handle of the column getting
the focus and the lParam is the row number getting the focus
• The wParam of SAM_SetFocus is the window handle of the column losing
the focus and the lParam is the row number losing the focus
SQLWindows sends SAM_KillFocus to the column losing the focus and SAM_SetFocus to the column getting the focus.
29.  SqlImmediate :- Prepares and executes a SQL statement.
SqlImmediate actually performs a SqlConnect, a SqlPrepare, a SqlExecute, and for SELECT statements, a SqlFetchNext. The first time you call SqlImmediate, Centura performs all of these functions. On later calls, SqlConnect is not performed if not needed.
SqlPrepareAndExecute :- Compiles and executes a SQL statement. Compiling includes:
Checking the syntax of the SQL statement.
Checking the system catalog.
Processing a SELECT statement's INTO clause.
30. Use this data type to identify an open file. When you open or create a file,
SQLWindows returns a file handle. You then use the file handle to identify the file.
Example
Variables
File Handle: hFile
...
Set bOk = SalFilePutStr( hFile, strOneLine )
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 轉播轉播 分享分享 分享淘帖
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

小黑屋|Archiver|手機版|艾歐踢創新工坊    

GMT+8, 2024-5-17 02:38 , Processed in 0.245034 second(s), 18 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表