prepare_insert_auto_inc

The prepare_insert_auto_inc method prepares the SQL statement once so that it can be used multiple times when inserting many rows into an auto-increment column of the specified database table.

Method Synopsis

NCP::DBI_Factory::prepare_insert_auto_inc($dbHandle,$tableName, 
$autoIncColumnName, $columnNames)

Parameters

$dbHandle
Specifies the DBI handle returned in a previous call to the createDbHandle method. This handle supplies the context for connecting to the specified NCIM topology database.
$tableName
Specifies the name of the table into which the prepare_insert_auto_inc method prepares the SQL statement to be inserted into multiple rows in the specified columns.
$autoIncColumnName
Specifies the name of the auto-increment column in the specified table.
$columnNames
Specifies a hash of column names.

Description

The prepare_insert_auto_inc method prepares the SQL statement once so that it can be used multiple times when inserting many rows into an auto-increment column of the specified database table. Use this method when inserting many rows into an auto-incremented column.

The returned SQL statement handle should be used with the execute_insert_auto_inc method.

Notes

To ensure that the prepare_insert_auto_inc method can print appropriate messages to a log file, you must have previously specified a log handle (that is, a reference to a file object) by calling the setLogHandle method. Otherwise, the method sends these messages to STDOUT.

Example Usage

The following code example illustrates a typical call to the prepare_insert_auto_inc method:

my $sth = 
NCP::DBI_Factory::prepare_insert_auto_inc($dbh, 
                                          $tableName, 
                                          $autoIncColumnName, @columnNames)
or print "Prepared failed ", $dbh->errstr, "\n";

Returns

Upon completion, the prepare_insert_auto_inc method returns the prepared SQL statement handle.

See Also