Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Standard datatypes – PB Docs 2019 – PowerBuilder Library

Standard datatypes – PB Docs 2019

Standard datatypes

The datatypes

The standard datatypes in PowerBuilder are the familiar datatypes
that are used in many programming languages, including char, integer,
decimal, long, and string. In PowerScript, you use these datatypes to
declare variables or arrays.

These are the standard PowerScript datatypes, followed by a
description of each:

Blob

Binary large object. Used to store an unbounded amount of data (for
example, generic binary, image, or large text such as a word-processing
document).

Boolean

Contains true or false.

Byte

8-bit unsigned integers, from 0 to +255.

Using literals

To assign a literal value, use any whole positive number in the
range 0 to 255. The leading plus sign is not required (18 and +18 are the
same). For example:

Char or character

A single Unicode character.

If you have character-based data that you will want to parse in an
application, you might want to define it as an array of type char. Parsing
a char array is easier and faster than parsing strings. If you will be
passing character-based data to external functions, you might want to use
char arrays instead of strings.

For more information about passing character-based data to external
functions, see the section called “Using
external functions”
in Application Techniques. For information about datatype
conversion when assigning strings to chars and vice versa, see String and char datatypes in
PowerBuilder
.

Using literals

To assign a literal value, enclose the character in either single or
double quotation marks. For example:

Date

The date, including the full year (1000 to 3000), the number of the
month (01 to 12), and the day (01 to 31).

Using literals

To assign a literal value, separate the year, month, and day with
hyphens. For example:

DateTime

The date and time in a single datatype, used only for reading and
writing DateTime values from and to a database. To convert DateTime values
to datatypes that you can use in PowerBuilder, use:

  • The Date(datetime) function to convert a DateTime value to a
    PowerBuilder date value after reading from a database

  • The Time(datetime) function to convert a DateTime value to a
    PowerBuilder time value after reading from a database

  • The DateTime (date, time) function to convert a date and
    (optional) time to a DateTime before writing to a DateTime column in a
    database.

PowerBuilder supports microseconds in the database interface for any
DBMS that supports microseconds.

Decimal or Dec

Signed decimal numbers, positive or negative, with up to 28 digits.
You can place the decimal point anywhere within the 28 digits — for
example, 123.456, 0.000000000000000000000001 or
12345678901234.5678901234.

Using literals

To assign a literal value, use any number with a decimal point and
no exponent. The plus sign is optional (95 and +95 are the same). For
numbers between zero and one, the zero to the left of the decimal point is
optional (for example, 0.1 and .1 are the same). For whole numbers, zeros
to the right of the decimal point are optional (32.00, 32.0, and 32. are
all the same). For example:

Double

A signed floating-point number with 15 digits of precision and a
range from 2.2250738585073E-308 to 1.79769313486231E+308, and
-2.2250738585073E-308 to -1.79769313486231E+308.

Integer or Int

16-bit signed integers, from -32768 to +32767.

Using literals

To assign a literal value, use any whole number (positive, negative,
or zero). The leading plus sign is optional (18 and +18 are the same). For
example:

Long

32-bit signed integers, from -2147483648 to +2147483647.

Using literals

Use literals as for integers, but longer numbers are
permitted.

LongLong

64-bit signed integers, from -9223372036854775808 to
9223372036854775807.

Using literals

Use literals as for integers, but longer numbers are
permitted.

Longptr

4 bytes in the 32-bit platform and 8 bytes in the 64-bit
platform.

Using literals

In the 32-bit platform, longptr is the same as long; you can
continue using long wherever longptr is required in 32-bit applications.
In 64-bit applications, however, using long to hold longptr variables will
lead to data truncation from 8 bytes to 4 bytes, or memory corruption if
you pass a long ref variable when a longptr ref is required. If you want
to move to 64-bit, use longptr wherever required. It does no harm to
32-bit.

Real

A signed floating-point number with six digits of precision and a
range from 3.402822E-38 to 3.402822E+38, and -3.402822E-38 to
-3.402822E+38.

Using literals

To assign a literal value, use a decimal value, followed by E,
followed by an integer; no spaces are allowed. The decimal number before
the E follows all the conventions specified above for decimal literals.
The leading plus sign in the exponent (the integer following the E) is
optional (3E5 and 3E+5 are the same). For example:

String

Any string of Unicode characters with variable length (0 to
1073741823).

Most of the character-based data in your application, such as names,
addresses, and so on, will be defined as strings. PowerScript provides
many functions that you can use to manipulate strings, such as a function
to convert characters in a string to uppercase and functions to remove
leading and trailing blanks.

For more information about passing character-based data to external
functions, see the section called “Using
external functions”
in Application Techniques. For information about datatype
conversion when assigning strings to chars and vice versa, see String and char datatypes in
PowerBuilder
.

Using literals

To assign a literal value, enclose as many as 1024 characters in
either single or double quotes, including a string of zero length or an
empty string. For example:

You can embed a quotation mark in a string literal if you enclose
the literal with the other quotation mark. For example, the following
statements result in the string Here’s a string:

You can also use a tilde (~) to embed a quotation mark in a string
literal. For example:

Complex nesting

When you nest a string within a string that is nested in another
string, you can use tildes to tell the parser how to interpret the
quotation marks. Each pass through the parser strips away the outermost
quotes and interprets the character after each tilde as a literal. Two
tildes become one tilde, and tilde-quote becomes the quote alone.

Example 1

This string has two levels of nesting:

The first pass results in:

The second pass results in:

The third pass results in:

Example 2

A more probable example is a string for the Modify function that
sets a DataWindow property. The argument string often requires complex
quotation marks (because you must specify one or more levels of nested
strings). To understand the quotation marks, consider how PowerBuilder
will parse the string. The following string is a possible argument for the
Modify function; it mixes single and double quotes to reduce the number of
tildes:

The double quotes tell PowerBuilder to interpret the argument as a
string. It contains the expression being assigned to the Invert property,
which is also a string, so it must be quoted. The expression itself
includes a nested string, the quoted A. First, PowerBuilder evaluates the
argument for Modify and assigns the single-quoted string to the Invert
property. In this pass through the string, it converts two tildes to one.
The string assigned to Invert becomes:

Finally, PowerBuilder evaluates the property’s expression,
converting tilde-quote to quote, and sets the bitmap’s colors
accordingly.

Example 3

There are many ways to specify quotation marks for a particular set
of nested strings. The following expressions for the Modify function all
have the same end result:

Rules for quotation marks and tildes

When nesting quoted strings, the following rules of thumb might
help:

  • A tilde tells the parser that the next character should be taken
    as a literal, not a string terminator

  • Pairs of single quotes ( ‘ ) can be used in place of pairs of
    tilde double quotes (~”)

  • Pairs of tilde tilde single quotes (~~’) can be used in place of
    pairs of triple tilde double quotes (~~~”)

Time

The time in 24-hour format, including the hour (00 to 23), minute
(00 to 59), second (00 to 59), and fraction of second (up to six digits),
with a range from 00:00:00 to 23:59:59.999999.

PowerBuilder supports microseconds in the database interface for any
DBMS that supports microseconds.

Using literals

The time in 24-hour format, including the hour (00 to 23), minute
(00 to 59), second (00 to 59), and fraction of second (up to six digits),
with a range from 00:00:00 to 23:59:59.999999. You separate parts of the
time with colons — except for the fractions of seconds, which should be
separated by a decimal point. For example:

UnsignedInteger, UnsignedInt, or UInt

16-bit unsigned integers, from 0 to 65535.

UnsignedLong or ULong

32-bit unsigned integers, from 0 to 4294967295.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x