Skip to Content.
Sympa Menu

freetds - [freetds] slapd-back-sql binding integer as varchar

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brad Midgley <bmidgley AT xmission.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] slapd-back-sql binding integer as varchar
  • Date: Wed, 25 Aug 2004 15:18:56 -0600

Hey

With a fairly vanilla setup back-sql would fail because the ? in
at_query was being bound as a varchar where it's being used as an int. I can modify the config to add convert(integer,?) wherever it gets bound but there is a bug somewhere, right?

Before the hack:

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 can't add
the convert() call without modifying the source to openldap:

-- 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 12.0) and openldap-2.2.15. Also running redhat packages: unixODBC-2.2.8-2.3.0.2, unixODBC-devel-2.2.8-2.3.0.2

thanks for any tips
--
Brad




Archive powered by MHonArc 2.6.24.

Top of Page