NAME
UnixODBC - Perl extension for unixODBC 2.2.0.
SYNOPSIS
use UnixODBC ':all';
my $evh; # Environment handle
my $cnh; # Connection handle
my $sth; # Statement handle
my $r; # result
my $buf; # Buffer for results
my $buflen; # Size of buffer.
my $rlen; # Length of result.
my $query = 'select * from customers;';
$r = SQLPrepare ($sth, $query, length ($query));
DESCRIPTION
Perl library for unixODBC 2.2.1 API.
API
SQLAllocHandle ($handle_type, $parent_handle, $new_handle)
# Allocate environment handle
$r = &UnixODBC::SQLAllocHandle ($SQL_HANDLE_ENV, $SQL_NULL_HANDLE,
$evh);
# Allocate connection handle
$r = &UnixODBC::SQLAllocHandle ($SQL_HANDLE_DBC, $evh, $cnh);
# Allocate statement handle
$r = &UnixODBC::SQLAllocHandle ($SQL_HANDLE_STMT, $cnh, $sth);
SQLAllocEnv ($evh)
$r = SQLAllocEnv ($evh);
SQLAllocConnect ($evh,$cnh);
$r = SQLAllocConnect ($evh,$cnh);
SQLColAttribute ($sth, $column_number, $attr_selector, $text_attr, $maxsize, $returned_text_length, $numeric_attr);
$r = SQLColAttribute ($sth, $column_number, $attr_selector,
$text_attr, $maxsize, $returned_text_length,
$numeric_attr);
SQLColumnPrivileges ($sth, $catalog_name, $catalog_name_length, $schema_name, $schema_name_length, $table_name, $table_name_length, $column_name, $column_name_length);
$r = SQLColumnPrivileges ($sth, $catalog_name, $catalog_name_length,
$schema_name, $schema_name_length,
$table_name, $table_name_length,
$column_name, $column_name_length);
SQLColumns ($sth, $catalog_name, $catalog_name_length, $schema_name, $schema_name_length, $table_name, $table_name_length,o $column_name, $column_name_length)
$r = SQLColumns ($sth, $catalog_name, $catalog_name_length,
$schema_name, $schema_name_length,
$table_name, $table_name_length,
$column_name, $column_name_length);
SQLConnect ($cnh, $DSN, $DSN_length, $UserName, $UserName_length, $PassWord, $PassWord_length)
$r = SQLConnect ($cnh, $DSN, $DSN_length, $UserName, $UserName_length,
$PassWord, $PassWord_length);
SQLDataSources ($evh, $direction, $DSN, $DSN_max_length, $returned_DSN_length, $drivername, $drivername_max_length, $returned_driver_length )
SQLDescribeCol ($sth, $column_number, $column_name, $max_length, $returned_length, $data_type, $column_size, $decimal_digits, $nullable)
SQLDisconnect ($sth)
SQLDrivers ($evh, $direction, $driver_desc, $max_desc_len, $returned_desc_length, $driver_attributes, $max_attr_length, $returned_attr_length)
SQLError ($evh, $cnh, $sth, $sqlstate, $native_error, $text, $max_len, $text_len)
SQLExecute ($sth)
SQLFetchScroll ($sth, $direction, $row_number)
SQLForeignKeys ($sth, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0)
SQLFreeStmt ($sth, $option)
SQLFreeConnect ($cnh)
SQLFreeHandle ($handle_type, $handle)
SQLGetConnectAttr ($cnh, <attrib>, $buf, $buflen, $rlen)
SQLGetCursorName ($sth, $resultbuffer, 255, $length)
SQLGetData ($sth, $column_number, <sqltype>, $buf, $column_width, $rlen)
SQLGetDiagField ($SQL_HANDLE_DBC, $cnh, 1, $SQL_DIAG_RETURNCODE, $ibuf, 255, $mlen)
SQLGetDiagRec
SQLGetEnvAttr ($evh, <attrib>, $buf, $buflen, $rlen)
SQLGetFunctions ($cnh, $function, $supported)
SQLGetInfo ($cnh, $attr, $buf, $buflen, $rlen)
SQLGetStmtAttr ($sth, $SQL_ATTR_ROW_NUMBER, $resultbuffer, 255, $length)
SQLGetTypeInfo ($sthandle, $SQL_ALL_TYPES)
SQLMoreResults ($sth)
SQLNumResultCols ($sth, $ncols)
SQLPrepare ($sth, $query, length ($query))
SQLPrimaryKeys ($sth, '', 0, '', 0, 'titles', 6)
SQLProcedureColumns ($sth, '', 0, '', 0, '', 0, '', 0)
SQLProcedures ($sth, '', 0, '', 0, '', 0)
SQLRowCount ($sth,$nrows)
SQLSetConnectAttr ($cnh, <attrib>, <value>, <length>)
# deprecated
SQLSetConnectOption
SQLSetCursorName ($sth, $cursorname, length ($cursorname))
SQLSetEnvAttr ($evh, <attrib>, <value>, <length>)
SQLSetPos ($sth, 1, $SQL_POSITION, $SQL_LOCK_NO_CHANGE)
SQLSetScrollOptions($sth, f_concurrency, crow_keyset, crow_rowset)
SQLSetStmtAttr ($sth, $SQL_ATTR_METADATA_ID, '1', length ('1'))
SQLSpecialColumns ($sth, $SQL_ROWVER, '', 0, '', 0, 'titles', 6, $SQL_SCOPE_CURROW, 0)
SQLStatistics ($sth, '', 0, '', 0, 'titles', 6, 1, 1)
SQLTablePrivileges ($sth, $catalog_name, $catalog_name_length, $schema_name, $schema_name_length, $table_name, $table_name_length)
SQLTables ($sth, $catalog_name, $catalog_name_length, $schema_name, $schema_name_length, $table_name, $table_name_length, $column_name, $column_name_length)
dm_log_open ('programname', 'logfilename');
dm_log_close ();
Using UnixODBC.pm with Apache
If SQLGetDiagRec returns an error that it can't locate a library, the Apache environment needs to be configured so that it knows about all of the library directories. If mod_env (part of the standard Apache configuration) is installed, use the SetEnv directive in the httpd.conf file.
For MySQL and MyODBC, this directive in httpd.conf solves the problem:
SetEnv LD_LIBRARY_PATH /lib:/usr/lib:/usr/local/lib:/usr/local/mysql/lib/mysql
EXPORT
Refer to the @EXPORT_OK array in UnixODBC.pm.
TO DO
1. GUI interface for SQLDriverConnect.
2. Implement SQLBrowseConnect with drivers that support it.
3. Implement descriptor handle type and descriptor handle functions in drivers that support it, and functions that depend on descriptor records, like SQLBulkOperations.
4. Implement SQLBindParameter, SQLDescribeParam, SQLNumParams, SQLParamData, SQLPutData, and other parameter functions.
5. Implement SQLBindCol and the functions that depend on it.
AUTHOR
Robert Allan Kiesling <rkiesling@earthlink.net>
SEE ALSO
perl(1), tkdm(1), UnixODBC::BridgeServer(3)
The source code for unixODBC.