THE META-HTML LANGUAGE REFERENCE MANUAL

[TOC]

Manual Page Viewer

Name: SQL::DATABASE-SAVE-PACKAGE

Section: Generic Sql Interface


Synopsis:

    <sql::database-save-package DBVAR KEY PACKAGE &key [TABLE=TABLENAME] [KEYNAME=FIELDNAME]

Description:

    Save the variables in PACKAGE associated with the value KEY in column KEYNAME in the table TABLENAME of the database referenced by DBVAR.

    This only saves variables which have names matching existing table column names. Package prefixes are stripped from the variables, and the symbol name is used as the column name to store the data. Symbol names and column names are treated in a case-insensitive manner.

    The implementation is to first attempt to do a SQL INSERT into the table, and if that fails to try a UPDATE query, with KEYNAME = KEY.

    Example: Say we want to save some information about employee Kate Mulgrew, in a table of employees, which has a primary key field named "id", and we want to save this record with id=103:

     <set-var record::name="Kate Mulgrew" record::age=45
              record::salary=34000 record::dept=travel>
    
     <set-var saved? =
        <sql::database-save-package db 103 record table=employees keyname=id>>
     

    If a variable in the package you are saving corresponds to a column with a numeric field type, and the value of the variable is the empty string, the system will attempt to store a NULL value into this field of the record. If the table does not support NULL values on that column, the operation will fail.

Edit Pointer
Function Index
Variable Index
Variable Editor


The META-HTML Reference Manual V2.0 Copyright © 1995, 1998, Brian J. Fox
Found a bug? Send mail to bug-manual@metahtml.org