blk_props

Description

Sets or retrieves bulk-descriptor structure properties.

Syntax

CS_RETCODE blk_props(blkdesc, action, property,
                  buffer, buflen, outlen)
 
 CS_BLKDESC      *blkdesc;
 CS_INT                 action;
 CS_INT                 property;
 CS_VOID              *buffer;
 CS_INT                 buflen;
 CS_INT               *outlen;

Parameters

blkdesc

A pointer to a CS_BLKDESC structure. A bulk-descriptor structure contains information about a bulk-copy operation. blk_alloc allocates a bulk-descriptor structure.

action

One of the following symbolic constants:

Value of action

blk_props

CS_SET

Sets the value of the property

CS_GET

Retrieves the value of the property

CS_CLEAR

Clears the value of the property by resetting it to its default value

property

A symbolic constant that indicates the property of interest. Table 4-6 lists valid property constants and describes each property.

buffer

If a property value is being set, buffer points to the value to use in setting the property.

If a property value is being retrieved, buffer points to the space in which blk_props will place the requested information.

The C datatype of the value depends on the property. Refer to Table 4-6 for the datatype of the property of interest.

buflen

Generally, buflen is the length, in bytes, of *buffer.

If a property value is being set and the value in *buffer is null-terminated, pass buflen as CS_NULLTERM.

If *buffer is a fixed-length or symbolic value, pass buflen as CS_UNUSED.

outlen

A pointer to an integer variable.

If a property value is being set, outlen is not used and should be passed as NULL.

If a property value is being retrieved and outlen is supplied, blk_props sets *outlen to the length, in bytes, of the requested information.

If the information is larger than buflen bytes, an application can use the value of *outlen to determine how many bytes are needed to hold the information.

Returns

blk_props returns:

Returns

Indicates

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Usage

Table 4-6: Client/Server bulk descriptor properties

Property name

Description

*buffer is

Applies to

Notes

BLK_CONV

Character-set conversion performed by client.

CS_TRUE or CS_FALSE.

IN copies only

To disable character-set conversion on the current server connection, set CS_NOCHARSETCNV_REQD to CS_TRUE. See the ct_con_props section in the Open Client Client-Library/C Reference Manual.

BLK_CUSTOM_CLAUSE

A custom, application-specific SQL clause to add after the existing with clause of the insert bulk command.

A character string containing the custom clause.

IN copies only

Supported only by server versions that support the custom SQL clause. Currently used only by internal products.

BLK_IDENTITY

Whether values for a table’s identity column are specified explicitly for each row to be inserted.

This property cannot be set to CS_TRUE if BLK_IDSTARTNUM has been set for a bulk-copy-in operation.

CS_TRUE or CS_FALSE.

The default is CS_FALSE, which indicates that identity values are either:

  • Computed from the starting value indicated by BLK_IDSTARTNUM, or

  • Computed by Adaptive Server Enterprise as data is inserted, based on existing identity values in the table.

IN copies only

BLK_IDSTARTNUM

The starting value for identity columns in inserted rows. The first inserted row uses this value, and the value is incremented for each subsequent row.

This property cannot be set if BLK_IDENTITY has been set to CS_TRUE for the bulk-copy-in operation.

A CS_NUMERIC variable containing the starting identity value.

There is no default.

IN copies only

BLK_NOAPI_CHK

Whether parameter and error checking for illegal parameter values and state transitions are disabled for Bulk-Library calls.

CS_TRUE or CS_FALSE.

The default is CS_FALSE, which means error checking is performed.

Both IN and OUT copies

BLK_PARTITION

Property to support BCP partitions for BCP_IN and BCP_OUT operations.

A character string containing the name of the partition.

Both IN and OUT copies

BLK_SENSITIVITY_ LBL

Whether a table’s sensitivity column is included in the bulk-copy operation.

CS_TRUE or CS_FALSE (default).

Both IN and OUT copies

Secure Adaptive Server Enterprise only

BLK_SLICENUM

For bulk-copy into a partitioned table. Specifies the partition number that copied rows are inserted to.

A CS_INT variable containing a positive value representing the partition number.

The default is CS_UNUSED, which indicates that Adaptive Server Enterprise will randomly choose a partition number.

IN copies only


BLK_CUSTOM_CLAUSE property

To process a select into existing table statement that inserts rows into a proxy table, Adaptive Server uses the Bulk-Library to generate a bulk-copy operation. However, full logging is not available for regular bulk-copy operations. BLK_CUSTOM_CLAUSE enables Adaptive Server to distinguish between ordinary bulk-copy operations and bulk-copy operations that have resulted from an insert into statement affecting a proxy table. Bulk-copy operations that result from such an insert into statement can then be appended with the custom clause specified by BLK_CUSTOM_CLAUSE. Adaptive Server can detect this clause and perform full logging.

Example

BLK_CUSTOM_CLAUSE is set with blk_props:

blk_props(blkdesc, CS_SET, BLK_CUSTOM_CLAUSE, 
(CS_VOID *)"from select_into", CS_NULLTERM, NULL);

Adaptive Server generates a bulk-copy operation with the specified custom clause appended:

insert bulk mydb.mytable with nodescribe from select_into

where mydb and mytable are the affected database and table.


BLK_IDENTITY property


BLK_NOAPI_CHK property


BLK_SENSITIVITY_LBL property


BLK_PARTITION property

See also

blk_alloc, blk_init