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

back_sql: incorrectly binding ulong as a varchar



Hey

With a fairly vanilla setup back-sql would fail because the ? in at_query was being bound as a varchar:

backsql_load_schema_map(): at_query "SELECT
name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u


FROM ldap_attr_mappings WHERE oc_map_id=?"
==>backsql_Prepare()
backsql_Prepare(): driver name="libtdsodbc.so"
<==backsql_Prepare() calling SQLPrepare()
backsql_oc_get_attr_mapping(): executing at_query
"SELECT
name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u


FROM ldap_attr_mappings WHERE oc_map_id=?"
for objectClass "inetOrgPerson"
with param oc_id="1"
backsql_oc_get_attr_mapping(): error executing at_query
"SELECT
name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u


FROM ldap_attr_mappings WHERE oc_map_id=?"
    for objectClass "inetOrgPerson"
    with param oc_id="1"
Return code: -1
   Native error code: 257
   SQL engine state:  37000
   Message:           [unixODBC][FreeTDS][SQL Server]Implicit
conversion from datatype 'VARCHAR' to 'NUMERIC' is not allowed.  Use the
CONVERT function to run this query.

after I added the slapd.conf line:

at_query "SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=convert(integer,?)"

Then the query would run and slapd would no longer crash. However the same kind of error crops up other places where I don't think I can add the convert() call:

-- backsql_get_attr_values(): error executing attribute query "SELECT utahlink..educator.password AS userPassword FROM utahlink..educator WHERE utahlink..educator.teacher_id=?"
Return code: -1
Native error code: 257
SQL engine state: 37000
Message: [unixODBC][FreeTDS][SQL Server]Implicit conversion from datatype 'VARCHAR' to 'NUMERIC' is not allowed. Use the CONVERT function to run this query.


Where do I look to find out why the ? in these queries is binding as a varchar instead of a ulong?

I'm using freetds 0.62.4 (to sybase) and openldap-cvs.

Brad



--
Brad