Programmers Guide

Welcome to the BTR2SQL v7.0 Programmers Guide. This comprehensive guide is designed for developers who want to extend their Btrieve-based applications using the BTR2SQL Software Development Kit (SDK) and advanced programming features.

The BTR2SQL SDK provides developers with powerful tools to enhance their applications beyond basic Btrieve operations, enabling direct SQL backend access, advanced data manipulation, and custom database operations while maintaining full compatibility with existing Btrieve code.

What’s in the Programmers Guide?

This guide covers the essential components and advanced features available to developers:

Component

Description

BTR2SQL SDK

Complete software development kit with runtime DLLs, migration tools, header files, and comprehensive documentation for each supported backend (MS SQL Server, Oracle, PostgreSQL).

Extended APIs

Advanced Btrieve operations beyond standard functionality, including temporary file creation, embedded SQL execution, and fast insert operations.

Runtime Integration

Seamless integration with existing applications through dynamic linking, requiring no code changes to access enhanced functionality.

Backend-Specific Features

Optimized operations and data type handling for each supported SQL backend, ensuring maximum performance and compatibility.

Key Benefits for Developers

Zero Code Changes Required

Your existing Btrieve applications work immediately with SQL backends without any modifications to source code or BTRCALLs.

Enhanced Functionality

Access to advanced features like direct SQL execution, schema management, and optimized data operations while maintaining Btrieve compatibility.

Performance Optimization

Leverage native SQL backend capabilities for improved data throughput and reduced latency in critical operations.

Cross-Platform Support

Develop applications that can work with multiple SQL backends (MS SQL Server, Oracle, PostgreSQL) using the same codebase.

Professional Development Tools

Comprehensive SDK with examples, documentation, and utilities to accelerate development and debugging.

SDK Components Overview

The BTR2SQL SDK is installed in the <Program Files>\Mertech Data Systems\DB Drivers\Btrieve\sdk directory and includes:

Runtime DLLs
  • wbtrv32.dll or w3btrv7.dll replacements that provide SQL backend connectivity

  • Extended APIs for advanced operations

  • Backend-specific optimizations for MS SQL Server, Oracle, and PostgreSQL

Header Files
  • mds_btrieve.h - Main header containing extended API definitions

  • Constants, structures, and function prototypes for all SDK features

  • Type definitions for cross-platform compatibility

Documentation and Examples
  • Comprehensive API reference with examples

  • Sample code demonstrating SDK capabilities

  • Best practices and implementation guidelines

Migration Tools
  • Utilities for schema management and data migration

  • Tools for validating and optimizing database structures

  • Support for custom migration scenarios

Getting Started with the SDK

To begin using the BTR2SQL SDK in your applications:

  1. Install the SDK - Ensure the BTR2SQL drivers are properly installed and licensed

  2. Include Headers - Add #include <mds_btrieve.h> to your source files

  3. Link Runtime - The runtime DLL is automatically linked when your application loads

  4. Use Extended APIs - Call extended functions using standard BTRCALL interface

Example of Basic SDK Usage:

#include <mds_btrieve.h>

// Initialize extended SQL login
MDS_SQL_LOGIN loginInfo = {
    "SERVER\\INSTANCE",    // Server name
    "database_name",       // Database name
    "username",            // User ID
    "password",            // Password
    ""                     // Additional options
};

// Execute SQL login using extended API
status = BTRCALL(B_SQL_LOGIN, NULL, &loginInfo,
                 &(dataLen=sizeof(loginInfo)), NULL, 0, 0);

What’s Next?

This guide provides detailed information about:

  • BTR2SQL SDK - Complete API documentation with examples

  • Extended Operations - Advanced Btrieve functions and their usage

  • Backend-Specific Features - Optimizations for each supported SQL database

  • Best Practices - Guidelines for optimal performance and compatibility

  • Troubleshooting - Common issues and solutions for developers

For detailed SDK documentation, refer to the BTR2SQL SDK chapter, which contains comprehensive information about all available functions, data structures, and programming examples.

The BTR2SQL SDK empowers developers to create robust, high-performance applications that leverage the full power of modern SQL databases while maintaining complete compatibility with existing Btrieve codebases.