DataValue

parasql.schema. DataValue

The DataValue class wraps an actual database data value and monitors any changes to it. Note that if you change the value of a DataValue object that change will not become visible in the user interface of your application until you call parasql.widget.AbstractWidget#redisplay on the widget or one of its parents.

Constructor

new DataValue(initialValuenullable)

License:
Parameters:
Name Type Attributes Description
initialValue string <nullable>

Optional initial value for this DataValue; the default is null.

Extends

  • Object

Methods

discardChanges()

Discards any changes to this DataValye by setting its current value to its original value.

Description:
  • Discards any changes to this DataValye by setting its current value to its original value.

equals(dataValue) → {boolean}

Parameters:
Name Type Description
dataValue parasql.schema.DataValue
Returns:

true if this DataValue has the same value as the specified DataValue.

Type
boolean

getBlobFileSize() → {number}

Returns:

The size of the blob in bytes.

Type
number

getBlobFilename() → {string}

Returns:

The filename.ext of the original file. Only valid for BLOB fields. To test for NULL values use isNull().

Type
string

getBlobImageServingURL() → (nullable) {string}

Returns:

The public URL for the thumbnail of the image. Supported for image and signature fields only.

Type
string

getBlobObjectName() → {string}

Returns:

The full object name relative to the cloud storage bucket.

Type
string

getBlobSignatureLatitude() → {number}

Returns:

The latitude where the signature was capture. Only valid for signature fields.

Type
number

getBlobSignatureLongitude() → {number}

Returns:

The longitude where the signature was captured. Only valid for signature fields.

Type
number

getBlobTimestamp() → {Date}

Returns:

The timestamp of the original upload.

Type
Date

getBoolean() → {boolean}

Returns:

true or false as represented by this DataValue. To test for NULL values use isNull().

Type
boolean

getDate() → {Date}

Returns:

The date represented by this DataValue; any time component will be set to zero. To test for NULL values use isNull().

Type
Date

getDateTime() → {Date}

Returns:

The datetime represented by this DataValue. To test for NULL values use isNull().

Type
Date

getNumber() → {number}

Returns:

The number represented by this DataValue. To test for NULL values use isNull().

Type
number

getString() → {string}

Returns:

The string representation of this DataValue. To test for NULL values use isNull().

Type
string

getTemporalPlainDate() → {Temporal.PlainDate}

Since:
  • v158
Returns:
Type
Temporal.PlainDate

getTemporalPlainDateTime() → {Temporal.PlainDateTime}

Since:
  • v158
Returns:
Type
Temporal.PlainDateTime

getTemporalPlainTime() → {Temporal.PlainTime}

Since:
  • v158
Returns:
Type
Temporal.PlainTime

getTime() → {Date}

Returns:

The time represented by this DataValue, with its date portion set to the beginning of the epoch. Time resolution is seconds with any milliseconds portion ignored. To test for NULL values use isNull().

Type
Date

isChanged() → {boolean}

Returns:

true if this DataValue has a different current value than its original value.

Type
boolean

isNotNull() → {boolean}

Returns:

true if this DataValue is any value other than SQL NULL.

Type
boolean

isNull() → {boolean}

Returns:

true if this DataValue is set to SQL NULL.

Type
boolean

resetChangeTracker()

Marks this DataValue as not changed by setting its original value to its current value.

Description:
  • Marks this DataValue as not changed by setting its original value to its current value.

setBoolean(flagnon-null)

Parameters:
Name Type Description
flag boolean
Throws:

If flag is not a boolean datatype.

Type
TypeError

setDate(datenon-null)

Parameters:
Name Type Description
date Date

Sets this DataValue to the date portion of the date object; the time portion is ignored.

Throws:

If the date parameter is not a Date object.

Type
TypeError

setDateTime(datetimenon-null)

Parameters:
Name Type Description
datetime Date

A datetime value. Time resolution is seconds with the milliseconds portion truncated.

Throws:

If the datetime parameter is not a Date object.

Type
TypeError

setNull()

Set this DataValue to SQL NULL.

Description:
  • Set this DataValue to SQL NULL.

setNumber(numnon-null)

Parameters:
Name Type Description
num number
Throws:

If num is not a number datatype.

Type
TypeError

setString(strnon-null)

Sets the current value of this object.

Description:
  • Sets the current value of this object.

Parameters:
Name Type Description
str string

If a zero length string is passed it will be treated as SQL NULL.

setTemporalPlainDate(dnon-null)

Since:
  • v158
Parameters:
Name Type Description
d Temporal.PlainDate
Throws:

If d is not a Temporal.PlainDate

Type
TypeError

setTemporalPlainDateTime(dtnon-null)

Since:
  • v158
Parameters:
Name Type Description
dt Temporal.PlainDateTime
Throws:

If dt is not a Temporal.PlainDateTime

Type
TypeError

setTemporalPlainTime(tnon-null)

Since:
  • v158
Parameters:
Name Type Description
t Temporal.PlainTime
Throws:

If t is not a Temporal.PlainTime

Type
TypeError

setTime(timenon-null)

Parameters:
Name Type Description
time Date

Sets this DataValue to the time portion of the date object, with its date portion set to the beginning of the epoch. Time resolution is seconds with the milliseconds portion truncated.

Throws:

If the time parameter is not a Date object.

Type
TypeError

takeValueFrom(dataValuenon-null)

Takes the value of the specified DataValue and assigns it to this DataValue instance.

Description:
  • Takes the value of the specified DataValue and assigns it to this DataValue instance.

Parameters:
Name Type Description
dataValue parasql.schema.DataValue

(static) from(data) → {parasql.schema.DataValue}

Creates a new DataValue instance from a variety of input types.

Description:
  • Creates a new DataValue instance from a variety of input types.

Since:
  • v158
Parameters:
Name Type Description
data parasql.schema.DataValue | string | number | boolean | Date | Temporal.PlainDateTime | Temporal.PlainDate | Temporal.PlainTime | null

The source data to convert.

Throws:

If the provided data parameter is not of a supported type.

Type
TypeError
Returns:

A new instance of DataValue populated with the provided data.

Type
parasql.schema.DataValue