Function EN Version 5.00

@MySQLOptions

SQL

Syntax

@MySQLOptions(MySQLHandle);
@MySQLOptions(MySQLHandle;GroupName);

Description

Sets the options.
Should be called after @MySQLInit.
Currently, only the option MYSQL_READ_DEFAULT_GROUP is set.
If only one parameter is specified, this value is set to "engine"; otherwise it is set to the specified TEXT GroupName;

The VSPECMYSQL MySQLHandle is provided by @MySQLInit.

Return:
On success TRUE, otherwise @Error;

Example: @MySQLOptions(MySQLHandle);

MySQLh:=@MySQLInit;

MySQLError:=1;
IF(@IsError(MySQLh)){
   @LogReport(MySQLh;3);
}ELSE{
   @MySQLOptions(MySQLh);
   
   MySQLUser:="MySQLConnectorUser";
   MySQLPassword:="ConnectorPassword";
   MySQLDefaultDatabase:="testdb";
   MySQLHost:="mysql.intranet";
   Ret:=@MySQLConnect(MySQLh;MySQLHost;MySQLUser;MySQLPassword;MySQLDefaultDatabase);
   
   IF(@IsError(Ret)){
      @LogReport(Ret);
   }ELSE{
      MySQLError:=0;}
   
   IF(!MySQLError){
      QueryStr:="SELECT ID,Name,Amount,UID FROM testdb.amounts WHERE Name=\"Test User\";";
      Ret:=@MySQLQuery(MySQLh;QueryStr;MySQLResH);
      NumRows:=@MySQLGetNumRows(MySQLResH);
      IF(NumRows=1){
         Ret:=@MySQLFetchRow(MySQLResH;1;ThisQueryID;ThisQueryName;ThisQueryAmount;ThisQueryUID);
      }ELSE{
         ThisQueryID:=-1;
         ThisQueryAmount:=0;
         ThisQueryName:=ThisQueryUID:="";
      }
      MySQLResH:=@MySQLFreeResult(MySQLResH);
      @LogReport("ThisQueryID :"+@Text(ThisQueryID);3);
      @LogReport("ThisQueryName :"+ThisQueryName;3);
      @LogReport("ThisQueryAmount:"+@Text(ThisQueryAmount);3);
      @LogReport("ThisQueryUID :"+ThisQueryUID;3);
   }
   
   MySQLh:=@MySQLClose(MySQLh);
}
@MySQLThreadEnd;

MySQL DB for this example:

INSERT INTO testdb.amount (Name,Amount,UID,ModTime) VALUES ("Test User",123.45,"1234567890ABCDEFABCD1234567890AB",NOW());

Output in APILOG for this example:
NumRows:1
ThisQueryID :1
ThisQueryName :Test User
ThisQueryAmount:123.45
ThisQueryUID :1234567890ABCDEFABCD1234567890AB

A MySQL connection is established and a query is submitted; the result is then output to APILOG.

Note : This text was machine-translated and may contain inaccuracies.