Native-level Interface

The Silk Performer native-level interface enables you to use native interface API functions (via external function calls) for any database system or transaction monitor.

Example

The following example uses Oracle's OCI as the native-level interface.

var
  hConnection : number;
  cCursor : cursor;

dcltrans
  transaction TMain
  var
    sName             : string;
    nFetched, nAge, i : number;
  begin
    OraLogon(hConnection, "user", "password", "orclnet2");
    OraOpen(cCursor, hConnection);
    // insert two persons: Jimmy and Ronald
    OraParse(cCursor, sqlInsert);
    OraBind(cCursor, ":name", SQLT_CHR, 32, 2);
    OraBind(cCursor, ":age", SQLT_INT, 0, 2);
    OraSetString(cCursor, ":name", "Jimmy", 1);
    OraSetInt(cCursor, ":age", 55, 1);
    OraSetString(cCursor, ":name", "Ronald", 2);
    OraSetInt(cCursor, ":age", 18, 2);
    OraExec(cCursor, 2);
    // select all persons
    OraParse(cCursor, sqlSelect);
    OraDefine(cCursor, 1, SQLT_CHR, 32);
    OraDefine(cCursor, 2, SQLT_INT);
    OraExec(cCursor, 1, 50, 0, 0, nFetched);

    for i := 1 to nFetched do
      sName := OraGetString(cCursor, "1", i);
      nAge := OraGetInt(cCursor, "2", i);
      write(sName, 32); write(nAge, 5); writeln;
    end;

    OraClose(cCursor);
    OraLogoff(hConnection);
  end TMain;

dclsql
  sqlInsert:
    INSERT INTO persons (name, age) VALUES (:name, :age);
  sqlSelect:
    SELECT * FROM persons;