Full_Name: Daniil Harun Version: 2.4.26 OS: FreeBSD, Linux URL: Submission from: (NULL) (80.85.151.246) OpenLDAP does not save the attribute "jpegphoto" in the sql database. Use back-sql, unixodbc and postgresql database. The reason for the problem of the use of the data type SQL_VARCHAR instead of SQL_LONGVARBINARY. slapd debug output: backsql_modify_internal(): adding new values for attribute "jpegPhoto" backsql_modify_internal(): arg(2)=1 backsql_modify_internal(): arg(1)="����"; executing "UPDATE personal SET jpegphoto=? WHERE id=?" backsql_modify_internal(): add_proc execution failed (rc=-1, prc=0) Return code: -1 nativeErrCode=7 SQLengineState=22021 msg="ERROR: invalid byte sequence for encoding "UTF8": 0xff; Error while executing the query" SQL tracing is enabled: [ODBC][23880][1313994179.641693][SQLPrepare.c][196] Entry: Statement = 0x293eae00 SQL = [UPDATE personal SET jpegphoto=? WHERE id=?][length = 42 (SQL_NTS)] [ODBC][23880][1313994179.641791][SQLPrepare.c][371] Exit:[SQL_SUCCESS] [ODBC][23880][1313994179.641886][SQLBindParameter.c][217] Entry: Statement = 0x293eae00 Param Number = 2 Param Type = 1 C Type = -27 SQL_C_UBIGINT SQL Type = 4 SQL_INTEGER Col Def = 0 Scale = 0 Rgb Value = 0xbf1fc7a4 Value Max = 0 StrLen Or Ind = 0x0 [ODBC][23880][1313994179.641988][SQLBindParameter.c][397] Exit:[SQL_SUCCESS] [ODBC][23880][1313994179.642182][SQLBindParamet[ODBC][23880][1313994179.641693][SQLPrepare.c][196] Entry: Statement = 0x293eae00 SQL = [UPDATE personal SET jpegphoto=? WHERE id=?][length = 42 (SQL_NTS)] [ODBC][23880][1313994179.641791][SQLPrepare.c][371] Exit:[SQL_SUCCESS] [ODBC][23880][1313994179.641886][SQLBindParameter.c][217] Entry: Statement = 0x293eae00 Param Number = 2 Param Type = 1 C Type = -27 SQL_C_UBIGINT SQL Type = 4 SQL_INTEGER Col Def = 0 Scale = 0 Rgb Value = 0xbf1fc7a4 Value Max = 0 StrLen Or Ind = 0x0 [ODBC][23880][1313994179.641988][SQLBindParameter.c][397] Exit:[SQL_SUCCESS] [ODBC][23880][1313994179.642182][SQLBindParameter.c][217] Entry: Statement = 0x293eae00 Param Number = 1 Param Type = 1 C Type = 1 SQL_C_CHAR SQL Type = 12 SQL_VARCHAR Col Def = 2790 Scale = 0 Rgb Value = 0x29529700 Value Max = 2790 StrLen Or Ind = 0x0 [ODBC][23880][1313994179.642284][SQLBindParameter.c][397] Exit:[SQL_SUCCESS] [ODBC][23880][1313994179.642741][SQLExecute.c][187] Entry: Statement = 0x293eae00 [ODBC][23880][1313994179.645733][SQLExecute.c][348] Exit:[SQL_ERROR] DIAG [22021] ERROR: invalid byte sequence for encoding "UTF8": 0xff; Error while executing the query er.c][217] Entry: Statement = 0x293eae00 Param Number = 1 Param Type = 1 C Type = 1 SQL_C_CHAR SQL Type = 12 SQL_VARCHAR Col Def = 2790 Scale = 0 Rgb Value = 0x29529700 Value Max = 2790 StrLen Or Ind = 0x0 [ODBC][23880][1313994179.642284][SQLBindParameter.c][397] Exit:[SQL_SUCCESS] [ODBC][23880][1313994179.642741][SQLExecute.c][187] Entry: Statement = 0x293eae00 [ODBC][23880][1313994179.645733][SQLExecute.c][348] Exit:[SQL_ERROR] DIAG [22021] ERROR: invalid byte sequence for encoding "UTF8": 0xff; Error while executing the query OpenLDAP uses the wrong data - types SQL_C_CHAR,SQL_VARCHAR instead of SQL_C_BINARY,SQL_LONGVARBINARY. How to make use of the correct data types?
back-sql calls backsql_BindParamBerVal(), which indeed considers the data as SQL_C_CHAR, SQL_VARCHAR. A binary variant can be easily defined, but back-sql will need to know what attribute values need to be treated as binaries. A general approach to this requires to modify the attribute mapping, to add a "type" flag. p.
changed notes moved from Incoming to Software Bugs
> back-sql calls backsql_BindParamBerVal(), which indeed considers the data as > SQL_C_CHAR, SQL_VARCHAR. A binary variant can be easily defined, but back-sql > will need to know what attribute values need to be treated as binaries. A > general approach to this requires to modify the attribute mapping, to add a > "type" flag. > > p. > I have carefully read the documentation (man slapd-sql) but could not find how to modify the attribute mapping and add a "type" flag.
> >> back-sql calls backsql_BindParamBerVal(), which indeed considers the >> data as >> SQL_C_CHAR, SQL_VARCHAR. A binary variant can be easily defined, but >> back-sql >> will need to know what attribute values need to be treated as binaries. >> A >> general approach to this requires to modify the attribute mapping, to >> add a >> "type" flag. >> >> p. >> > I have carefully read the documentation (man slapd-sql) but could not > find how to modify the attribute mapping and add a "type" flag. I meant: modify the code. Since back-sql is basically unmaintained (any volunteers out there?) this feature won't likely be added, not to mention the fact that it would break all existing installations. p.
changed state Open to Suspended
back-sql