OpenVMS Source Code Demos

mysql_demo01.c

//=================================================================================
// title       : mysql_demo01.c
// author      : Neil Rieck
//             : Waterloo, Ontario, Canada.
//             : http://neilrieck.net   MAILTO:[email protected]
// created     : 2014-01-27
// purpose     : a 'hello world' program for MariaDB (an alternative fork of MySQL)
// target      : for MariaDB-5.5 on OpenVMS-8.4 from Mark Berryman
// vms-build   : @mysql_demo.com mysql_demo1.c (see DCL script for details)
// caveat      : Linking is noisy on Alpha but quiet on Itanium
// dependancies: you need an up-to-date version of zlib (1.2.6 or higher)
// references  : http://zetcode.com/db/mysqlc/
//               http://www.yolinux.com/TUTORIALS/MySQL-Programming-C-API.html
//               http://code-reference.com/c/mysql/mysql.h/mysql_real_connect
// ver who when   what
// --- --- ------ --------------------------------------------------------------
// 100 NSR 140127 1. initial work for MariaDB-5.5.25
// 101 NSR 240415 1. changes for use with "LibMariaDB for VSI OpenVMS"
//==============================================================================
#define __NEW_STARLET     1              // enable strict starlet (>= OpenVMS70)
//
//      includes
//
// -----------------------------------------------------------------------------
// CAVEAT: 
// 1) original API instructions said to include <my_global.h>
// 2) newer API instructions say to include <ma_global.h> and invoke it first.
// 3) other instructions say to only include these files in server apps. Since
//    these are client apps, I disabled both for simplicity (everythings seems
//    to compile properly without them in 2024). Enable one if something is
//    missing during compile.
// --------------------------------------------------------------
//#include <ma_global.h>        // LibMariaDB v3  for VSI OpenVMS
// --------------------------------------------------------------
//#include <my_global.h>        // LibMariaDB v2  for VSI OpenVMS
                                // MariaDB-5.5-63 from VSI
                                // MariaDB        from Mark Berryman
// -----------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <mysql.h>
//
//      main
//
//      execute a function in the client library to prove we can properly compile-link
//
int main(int argc, char **argv) {
    printf("MySQL client version: %s\n", mysql_get_client_info());
    exit(0);
}
// this is the end
//==============================================================================

home Back to Home
Neil Rieck
Waterloo, Ontario, Canada.