Skip to content

freebcp makes same table structure query twice #648

@mmcnabb-vms

Description

@mmcnabb-vms

Using Branch-1_5 (0f7966), MSVC & Windows 11.

A connection established to SAP ASE 16.0 using freebcp sends the following query twice in a row during the login process:

SET FMTONLY ON select * from my_database.dbo.my_table SET FMTONLY OFF

The response received to this query is exactly identical in both cases.

SAP SDK's bcp sends select * from my_database.dbo.my_table where 1=2 instead, and only once.

The process works correctly but there is an optimization opportunity to be had by only sending the query once. Checking the source code, the two calls arise from:

  • tds_bcp_init(), in bulk.c, uses the result to set up bcpinfo->bindinfo
  • file_character() and file_native() in freebcp.c use the result to obtain the column formats in order to pack/unpack the row data.

Would it be feasible for freebcp.c to read the information it needs out of bindinfo's column data, instead of repeating the query?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions