[Date Prev][Date Next] [Chronological] [Thread] [Top]

back-sql with binary values from mysql DBs (ITS#3113)



Full_Name: Babak Nasri
Version: 2.2.10
OS: linux 2.4.22  on debian dist
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (213.61.157.73)


Returning binary values from a mysql table bound to openldap back-sql through
iODBC the type was lost somewhere and the value was treated hexdumped as
string.

Work around I deployed in my installation was some minor changes in entry_id.c
->  backsql_get_attr_vals and sql-wrap.c -> backsql_BindRowAsStrings.

In BindRowAsString I just changed the colname before binding the col using
SQLBindCol:
   if ( col_type == SQL_LONGVARCHAR || col_type == SQL_LONGVARBINARY) {
       ber_str2bv( strcat(colname,";binary"), 0, 1, &row->col_names[ i - 1 ] );
       ....


And In backsql_get_attr_vals I checked back for having that phrase in colname
and converted the hexdump string to the corresponding binary value
(hex_to_bytes) just before calling 	backsql_entry_addattr.

This has shown up to be a work around for that issue but I am not sure if it
applies to general thread to be considered in the head.