2025-10-21 11:36:43 +03:00
|
|
|
Address = "127.0.0.1";
|
2025-04-03 21:52:31 +03:00
|
|
|
Login = "bayselonarrend";
|
2025-10-21 11:36:43 +03:00
|
|
|
Password = "12we...";
|
2025-04-03 21:52:31 +03:00
|
|
|
Base = "testbase1";
|
|
|
|
|
|
2025-09-01 14:51:24 +03:00
|
|
|
TLS = True;
|
|
|
|
|
Port = 3306;
|
|
|
|
|
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, Base, Login, Password, Port);
|
|
|
|
|
|
|
|
|
|
If TLS Then
|
|
|
|
|
TLSSettings = OPI_MySQL.GetTLSSettings(True);
|
|
|
|
|
Else
|
|
|
|
|
TLSSettings = Undefined;
|
|
|
|
|
EndIf;
|
2025-04-03 21:52:31 +03:00
|
|
|
|
|
|
|
|
// All records without filters
|
|
|
|
|
|
|
|
|
|
Table = "testtable";
|
|
|
|
|
|
|
|
|
|
// When using the connection string, a new connection is initialised,
|
|
|
|
|
// which will be closed after the function is executed.
|
|
|
|
|
// If several operations are performed, it is desirable to use one connection,
|
|
|
|
|
// previously created by the CreateConnection function()
|
2025-09-01 14:51:24 +03:00
|
|
|
Result = OPI_MySQL.GetRecords(Table, , , , , ConnectionString, TLSSettings);
|
2025-04-03 21:52:31 +03:00
|
|
|
|
|
|
|
|
// Filter, selected fields, limit and sorting
|
|
|
|
|
|
2025-09-01 14:51:24 +03:00
|
|
|
ConnectionString = OPI_MySQL.GenerateConnectionString(Address, "test_data", Login, Password, Port);
|
2025-04-03 21:52:31 +03:00
|
|
|
|
|
|
|
|
Table = "test_data";
|
|
|
|
|
|
|
|
|
|
Fields = New Array;
|
|
|
|
|
Fields.Add("first_name");
|
|
|
|
|
Fields.Add("last_name");
|
|
|
|
|
Fields.Add("email");
|
|
|
|
|
|
|
|
|
|
Filters = New Array;
|
|
|
|
|
|
|
|
|
|
FilterStructure1 = New Structure;
|
|
|
|
|
|
|
|
|
|
FilterStructure1.Insert("field", "gender");
|
|
|
|
|
FilterStructure1.Insert("type" , "=");
|
|
|
|
|
FilterStructure1.Insert("value", "Male");
|
|
|
|
|
FilterStructure1.Insert("union", "AND");
|
|
|
|
|
FilterStructure1.Insert("raw" , False);
|
|
|
|
|
|
|
|
|
|
FilterStructure2 = New Structure;
|
|
|
|
|
|
|
|
|
|
FilterStructure2.Insert("field", "id");
|
|
|
|
|
FilterStructure2.Insert("type" , "BETWEEN");
|
|
|
|
|
FilterStructure2.Insert("value", "20 AND 50");
|
|
|
|
|
FilterStructure2.Insert("raw" , True);
|
|
|
|
|
|
|
|
|
|
Filters.Add(FilterStructure1);
|
|
|
|
|
Filters.Add(FilterStructure2);
|
|
|
|
|
|
|
|
|
|
Sort = New Structure("ip_address", "DESC");
|
|
|
|
|
Count = 5;
|
|
|
|
|
|
2025-09-01 14:51:24 +03:00
|
|
|
Result = OPI_MySQL.GetRecords(Table, Fields, Filters, Sort, Count, ConnectionString, TLSSettings);
|