Using the SQL topic

Previous Next

In a conversation with USoft Developer about the SQL topic, you may send commands to the USoft DDE server, which are passed to the SQL script interpreter. This interpreter understands SQL DML statements but not DDL statements. In other words, it allows you to manipulate the data in the database, but not to create new tables and views or change existing ones. Before a DML statement is executed, it is checked by the conceptual processor, so the execution of these SQL statements never results in the violation of database integrity.

In addition to SQL statements, the SQL Command interpreter can run the global actions of USoft Developer, such as MessageInformation(), DataCommit() and CommandSystemBackground().

To send a SQL statement to the USoft DDE server, write the following procedure:

HSZ   hszService;

HSZ   hszTopic;

HCONV hConv = (HCONV)NULL;

hszService = DdeCreateStringHandle(

    idInst,

    (LPCSTR)"USoft Developer",

    CP_WINANSI);

hszTopic = DdeCreateStringHandle(

    idInst,

    (LPCSTR)"SQL",

    CP_WINANSI);

hConv = DdeConnect(

    idInst,

    hszService,

    hszTopic,

    NULL);

pData = (LPSTR) "update persons \

    set name = 'Jansen' \

    where person_id = 1514";

hData = DdeCreateDataHandle(

    idInst,

    pData,

    lpcbData,

    0L,

    hszItem,

    CF_TEXT,

    0);

DdeClientTransaction(

    (LPBYTE) hData,

    -1,

    hConv,

    hszItem,

    CF_TEXT,

    XTYP_EXECUTE,

    DDE_TIMEOUT,

    NULL);