Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 50 lines (40 sloc) 1.205 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
PROCEDURE Main;

  { ryan@ryanmccuaig.net // 20120525 }
  { test script for checking that an ODBC database connection works }

CONST
  kDatabaseName = 'mysql-vw-test';
  kDatabaseUser = 'root';
  kDatabasePassword = '';
  kDatabaseSQLQuery = 'SELECT * FROM sheets';

TYPE
  SHEETDATA = STRUCTURE
    sheet_number, sheet_name : STRING;
  END;

VAR
  boo : BOOLEAN;
  colCount, resultSet : LONGINT;
  i : INTEGER;
  colName, colValue : DYNARRAY[] OF CHAR;
  sheet : SHEETDATA;

BEGIN

  boo := DBSQLExecuteDSN(
    kDatabaseName,
    kDatabaseUser,
    kDatabasePassword,
    kDatabaseSQLQuery,
    colCount,
    resultSet);

  REPEAT
    FOR i := 1 to colCount do BEGIN
      boo := DBSQLExecuteGet(resultSet, i, colName, colValue);
      IF (colName = 'sheet_number') THEN BEGIN
        sheet.sheet_number := colValue;
      END ELSE IF (colName = 'sheet_name') THEN BEGIN
        sheet.sheet_name := colValue;
      END;
    END;
    AlrtDialog(Concat('sheet number ', sheet.sheet_number, ' is named ', sheet.sheet_name));
  UNTIL NOT DBSQLExecuteNext(resultSet);

  DBSQLExecuteDelete(resultSet);

END;
Run(Main);
Something went wrong with that request. Please try again.