Adding functions to the PBODB90 initialization file
The PBODB90 initialization file lists the functions for certain
DBMSs that have ODBC drivers. If you need to add a function to the
PBODB90 initialization file for use with your back-end DBMS, you
can do either of the following:
- Existing sections Add the function to the Functions section for your back-end
database if this section exists in the PBODB90 initialization file. - New sections Create new sections for your back-end DBMS in the PBODB90
initialization file and add the function to the newly created Functions
section.
Adding functions to an existing section in the file
If sections for your back-end DBMS already exist in
the PBODB90 initialization file, use the following procedure to
add new functions.
To add functions to an existing section in the
PBODB90 initialization file:
-
Open the PBODB90 initialization file in
one of the following ways:- Use
the File Editor in PowerBuilder. (For instructions, see the User’s Guide
.) - Use any text editor outside PowerBuilder.
- Use
-
Locate
the entry for your back-end DBMS in the DBMS Driver/DBMS Settings
section of the PBODB90 initialization file.For example, here is the PBODB90 initialization file entry
for Adaptive Server Anywhere:1;*********************************************1;DBMS Driver/DBMS Settings see comments at end1;of file1;*********************************************1...1[Adaptive Server Anywhere]1PBSyntax='WATCOM50_SYNTAX'1PBDateTime='STANDARD_DATETIME'1PBFunctions='ASA_FUNCTIONS'1PBDefaultValues='autoincrement,current date,1current time,current timestamp,timestamp,1null,user'1PBDefaultCreate='YES'1PBDefaultAlter='YES'1PBDefaultExpressions='YES'1DelimitIdentifier='YES'1PBDateTimeInvalidInSearch='NO'1PBTimeInvalidInSearch='YES'1PBQualifierIsOwner='NO'1PBSpecialDataTypes='WATCOM_SPECIALDATATYPES'1IdentifierQuoteChar='"'1PBSystemOwner='sys,dbo'1PBUseProcOwner='YES'1SQLSrvrTSName='YES'1SQLSrvrTSQuote='YES'1SQLSrvrTSDelimit='YES'1ForeignKeyDeleteRule='Disallow if Dependent Rows1Exist (RESTRICT),Delete any Dependent Rows1(CASCADE),Set Dependent Columns to NULL1(SET NULL)'1TableListType='GLOBAL TEMPORARY' -
Find the name of the section in the PBODB90 initialization
file that contains function information for your back-end DBMS.To find this section, look for a line similar to the following
in the DBMS Driver/DBMS Settings entry:1PBFunctions='<i>section_name</i>'For example, the following line in the DBMS Driver/DBMS
Settings entry for Adaptive Server Anywhere indicates that the name
of the Functions section is ASA_FUNCTIONS:1PBFunctions='ASA_FUNCTIONS' -
Find the Functions section for your back-end DBMS
in the PBODB90 initialization file.For example, here is the Functions section for Adaptive Server
Anywhere:1;*********************************************1;Functions1;*********************************************1[ASA_FUNCTIONS]1AggrFuncs=avg(x),avg(distinct x),count(x),1count(distinct x),count(*),list(x),1list(distinct x),max(x),max(distinct x),1min(x),min(distinct x),sum(x),sum(distinct x)1Functions=abs(x),acos(x),asin(x),atan(x),1atan2(x,y),ceiling(x),cos(x),cot(x),degrees(x),1exp(x),floor(x),log(x),log10(x),1mod(dividend,divisor),pi(*),power(x,y),1radians(x),rand(),rand(x),1remainder(dividend,divisor),round(x,y),1sign(x),sin(x),sqrt(x),tan(x),1"truncate"(x,y),ascii(x),byte_length(x),1byte_substr(x,y,z),char(x),char_length(x),1charindex(x,y),difference(x,y)insertstr(x,y,z),1lcase(x),left(x,y),length(x), locate(x,y,z),1lower(x),ltrim(x),patindex('x',y),repeat(x,y),1replicate(x,y),right(x,y),rtrim(x),1similar(x,y),soundex(x),space(x),str(x,y,z),1string(x,...),stuff(w,x,y,z),substr(x,y,z),1trim(x),ucase(x),upper(x),date(x),1dateformat(x,y),datename(x,y),day(x),1dayname(x),days(x),dow(x),hour(x),hours(x),1minute(x),minutes(x),minutes(x,y),month(x),1monthname(x),months(x),months(x,y),now(*),1quarter(x),second(x),seconds(x),seconds(x,y),1today(*),weeks(x),weeks(x,y),year(x),years(x),1years(x,y),ymd(x,y,z),dateadd(x,y,z),1datediff(x,y,z),datename(x,y),datepart(x,y),1getdate(),cast(x as y),convert(x,y,z),1hextoint(x),inttohex(x),1connection_property(x,...),datalength(x),1db_id(x),db_name(x),db_property(x),1next_connection(x),next_database(x),1property(x),property_name(x),1property_number(x),property_description(x),1argn(x,y,...),coalesce(x,...),1estimate(x,y,z),estimate_source(x,y,z),1experience_estimate(x,y,z),ifnull(x,y,z),1index_estimate(x,y,z),isnull(x,...),1number(*),plan(x),traceback(*) -
To add a new function, type a comma followed by
the function name at the end of the appropriate function list, as
follows:- Aggregate
functions Add aggregate functions to the end of the AggrFuncs list. - All other functions Add all other functions to the end of the Functions list.
Case sensitivity If the back-end DBMS you are using is case sensitive, be sure
to use the required case when you add the function name.The following example shows a new function for Adaptive Server Anywhere
added at the end of the Functions list:1;*********************************************1;Functions1;*********************************************1[ASA_FUNCTIONS]1AggrFuncs=avg(x),avg(distinct x),count(x),1count(distinct x),count(*),list(x),1list(distinct x),max(x),max(distinct x),1min(x),min(distinct x),sum(x),sum(distinct x)1Functions=abs(x),acos(x),asin(x),atan(x),1atan2(x,y),ceiling(x),cos(x),cot(x),degrees(x),1exp(x),floor(x),log(x),log10(x),1mod(dividend,divisor),pi(*),power(x,y),1radians(x),rand(),rand(x),1...1number(*),plan(x),traceback(*),newfunction() - Aggregate
-
Save your changes to the PBODB90 initialization
file.
Adding functions to a new section in the file
If entries for your back-end DBMS do not exist in
the PBODB90 initialization file, use the following procedure to
create the required sections and add the appropriate functions.
Before you start For more about the settings to supply for
your back-end DBMS in the PBODB90 initialization file, read the
comments at the end of the file.
To add functions to a new section in the PBODB90
initialization file:
-
Open the PBODB90 initialization file in
one of the following ways:- Use
the File Editor in PowerBuilder. (For instructions, see the User’s Guide
.) - Use any text editor outside PowerBuilder.
- Use
-
Edit the DBMS Driver/DBMS Settings section
of the PBODB90 initialization file to add an entry for your back-end
DBMS.
Finding the name The name required to identify the entry for your back-end
DBMS in the DBMS Driver/DBMS Settings section is in the
ODBC initialization file.For information about the name and location
of the ODBC initialization file on your platform, see “How PowerBuilder accesses
the data source”.Make sure that you:
- Follow
the instructions in the comments at the end of the PBODB90 initialization
file. - Use the same syntax as existing entries in the DBMS
Driver/DBMS Settings section of the PBODB90 initialization
file. - Include a section name for PBFunctions.
For example, here is the relevant portion of an entry for
a DB2/2 database:1;***********************************************1;DBMS Driver/DBMS Settings1;***********************************************1[DB2/2]1...1PBFunctions='DB22_FUNCTIONS'1... - Follow
-
Edit the Functions section of the PBODB90 initialization
file to add an entry for your back-end DBMS.Make sure that you:
- Follow
the instructions in the comments at the end of the PBODB90 initialization
file. - Use the same syntax as existing entries in the Functions
section of the PBODB90 initialization file. - Give the Functions section the name that you specified
for PBFunctions in the DBMS Driver/DBMS Settings entry.
For example:
1;***********************************************1;Functions1;***********************************************1[DB22_FUNCTIONS]1AggrFuncs=avg(),count(),list(),max(),min(),sum()1Functions=curdate(),curtime(),hour(), ... - Follow
-
Type a comma followed by the function name at
the end of the appropriate function list, as follows:- Aggregate functions Add aggregate functions to the end of the AggrFuncs list.
- All other functions Add all other functions to the end of the Functions list.
Case sensitivity If the back-end DBMS you are using is case sensitive, be sure
to use the required case when you add the function name.The following example shows (in bold) a new DB2/2
function named substr() added at the end of the
Functions list:1;***********************************************1;Functions1;***********************************************1[DB22_FUNCTIONS]1AggrFuncs=avg(),count(),list(),max(),min(),sum()1Functions=curdate(),curtime(),hour(), <i>substr()</i> -
Save your changes to the PBODB90 initialization
file.