Main Page Modules Compound List File List Compound Members File Members Related Pages

# Configuration
[LibTDS API]

Handle reading of configuration. More...

## Functions

TDSCONNECTINFO * | tds_read_config_info (TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)

tds_read_config_info() will fill the tds connect_info structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values

void | tds_fix_connect (TDSCONNECTINFO *connect_info)
| Fix configuration after reading it.
int | tds_read_conf_file (TDSCONNECTINFO *connect_info, const char *server)
| Read configuration info for given server return 0 on error.
int | tds_read_conf_section (FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param)
| Read a section of configuration file (INI style file).
void | tds_config_verstr (const char *tdsver, TDSCONNECTINFO *connect_info)
| Set TDS version from given string.
int | tds_set_interfaces_file_loc (const char *interf)
| Set the full name of interface file.
void | tds_lookup_host (const char *servername, char *ip)
| Given a servername and port name or number, lookup the hostname and service.
const TDS_COMPILETIME_SETTINGS * | tds_get_compiletime_settings (void)
| Return a structure capturing the compile-time settings provided to the configure script.

## Detailed Description

Handle reading of configuration.

## Function Documentation

void tds_config_verstr | ( | const char * | tdsver,
|  | TDSCONNECTINFO * | connect_info
| ) |

Set TDS version from given string.

Parameters:

  tdsver | tds string version
  connect_info | where to store information

void tds_fix_connect | ( | TDSCONNECTINFO * | connect_info | ) |

| Fix configuration after reading it. Currently this read some environment variables and replace some options.

void tds_lookup_host | ( | const char * | servername,
|  | char * | ip
| ) |

| Given a servername and port name or number, lookup the hostname and service. The server ip will be stored in the string 'servername' in dotted-decimal notation. The service port number will be stored in string form in the 'port' parameter. If we can't determine both the IP address and port number then 'ip' and 'port' will be set to empty strings.

int tds_read_conf_file | ( | TDSCONNECTINFO * | connect_info,
|  | const char * | server
| ) |

Read configuration info for given server return 0 on error.

Parameters:

  connect_info | where to store configuration
  server | section of file configuration that hold configuration for a server

int tds_read_conf_section | ( | FILE * | in,
|  | const char * | section,
|  | TDSCONFPARSE | tds_conf_parse,
|  | void * | param
| ) |

Read a section of configuration file (INI style file).

Parameters:

  in | configuration file
  section | section to read
  tds_conf_parse | callback that receive every entry in section
  param | parameter to pass to callback function

TDSCONNECTINFO* tds_read_config_info | ( | TDSSOCKET * | tds,
|  | TDSLOGIN * | login,
|  | TDSLOCALE * | locale
| ) |

tds_read_config_info() will fill the tds connect_info structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values

.tdsrc and freetds.conf have been added to make the package easier to integration with various Linux and *BSD distributions.

int tds_set_interfaces_file_loc | ( | const char * | interf | ) |

Set the full name of interface file.

Parameters:

  interf | file name