Home page  
Help >
ddlWriteEx() - write records (parameterized)
Version 7.11
ddlWriteEx() - write records (parameterized) ddlWriteEx() - write records (parameterized)

Prototype:
   void ddlWriteEx(
      CONTROL *ctl,
      char *OptnStr,
      char *ArgList,
      ...);

Permitted values in OptnStr:
   /Cn - write n records; default is 1
   /R  - do not clear target collection before operation
   /S  - do not structure new records

Form of ArgList:
      <cx> <table-name> <field1> <op> <value1> ...
Where: <cx> is the name of the collection
<TableName> is the ASCII name of the desired table in the database.
<field1> is the first field to be written
<op> is "=" or "IS"
<value1> is a literal value to be assigned to <field1>
Any value may be replaced by a token that indicates that a pointer to the value is in the next parameter. Variables are not permitted in ddlWriteEx() expressions.
The permissible tokens and their corresponding argument types are:
   %b - BYTE data field of proper length
   %nnnnb - BYTE data field of length nnnn
   %nnnnb - BLOB [length = nnnn]
   %d - 16 bit int*
   %ld - 32 bit int*
   %lu - unsigned 32 bit int*
   %hd - 64 bit int*
   %hu - unsigned 64 bit int*
   %f - float (32 bit)*
   %lf - double (64 bit)*
   %s - char* (null terminated string)
            for BYTE datatype, string is in the form 0xnnnnnnn ...

For example:

   {
      float x=123.00;
      double y=321.00;
      ddlWriteEx(&ctl,"/","a customers x = %f y = %lf",&x,&y);
   }

Description:
ddlWriteEx() creates one or more records in a specified table. All fields specified in the list are set to the assigned values. All other fields are set to the default value based on their data type:
   X()                      - ascii blanks
   N()                      - all zeroes
   BYTE()                   - all binary zeroes
   DATE                     - ascii blanks
   DATETIME                 - binary zero
   LOGICAL                  - false
   All binary integer types - binary zero
   All binary float types   - binary zero

If a target collection <cx> is specified, the collection <cx> <TableName> is cleared before the write operation begins. Then, for each record written, its recno is stored in the collection.

If the /R option is specified, the target collection is not cleared, enabling an effective OR of recno's from successive write operations.

The default format for the target value of a DATE field is the default template 'mm/dd/yyyy', 'mm-dd-yyyy' or 'mm.dd.yyyy'.

The default format for the target value of a DATETIME field is the default template 'mm/dd/yyyy hh:nn:ss.ttt', 'mm-dd-yyyy hh:nn:ss.ttt' or 'mm.dd.yyyy hh:nn:ss.ttt'.

The default format for the target value of a DateTimeEx or TIME field is the default template as specified in the Default Templates section.

In all cases, the default template can be overridden with a format override; or it can be modified with the ddlMode() DATEFORM function.

The query value for a BYTE field is expressed as a hex character string in the form 0xnnnnnnn ...

Notes:
The parameterized forms for BYTE data type are:
      %s - with the corresponding string parameter in the form 0xnnnnnnn ...
      %b - with the corresponding byte parameter being the required size;
      %nnnnb - with the corresponding byte parameter being nnnn bytes;
If the Change Callback is defined [Ref. ddlSetChangeCb()], the callback is called with each record image after the specified values have been stored but before the record has been rewritten.

Values returned in Control Structure:
Control.Ans1 Number of records written
Control.Ans2 Record number of the first record written

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.