mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-03-27 21:48:56 +02:00
53 lines
3.6 KiB
Plaintext
Vendored
53 lines
3.6 KiB
Plaintext
Vendored
Address = "127.0.0.1";
|
|
Login = "bayselonarrend";
|
|
Password = "12we...";
|
|
Base = "testbase1";
|
|
|
|
ConnectionString = OPI_PostgreSQL.GenerateConnectionString(Address, Base, Login, Password);
|
|
|
|
Table = "testtable";
|
|
RecordsArray = New Array;
|
|
|
|
Image = "https://api.athenaeum.digital/test_data/picture.jpg";
|
|
OPI_TypeConversion.GetBinaryData(Image); // Image - Type: BinaryData
|
|
|
|
CasualStructure = New Structure("key,value", "ItsKey", 10);
|
|
|
|
CurrentDate = OPI_Tools.GetCurrentDate();
|
|
CurrentDateTZ = OPI_Tools.DateRFC3339(CurrentDate, "+05:00");
|
|
|
|
RecordStructure = New Structure;
|
|
RecordStructure.Insert("bool_field" , New Structure("BOOL" , True));
|
|
RecordStructure.Insert("oldchar_field" , New Structure("OLDCHAR" , 1)); // or "char"
|
|
RecordStructure.Insert("smallint_field" , New Structure("SMALLINT" , 5));
|
|
RecordStructure.Insert("smallserial_field", New Structure("SMALLSERIAL" , 6));
|
|
RecordStructure.Insert("int_field" , New Structure("INT" , 100));
|
|
RecordStructure.Insert("serial_field" , New Structure("SERIAL" , 100));
|
|
RecordStructure.Insert("oid_field" , New Structure("OID" , 24576));
|
|
RecordStructure.Insert("bigint_field" , New Structure("BIGINT" , 9999999));
|
|
RecordStructure.Insert("bigserial_field" , New Structure("BIGSERIAL" , 9999999));
|
|
RecordStructure.Insert("real_field" , New Structure("REAL" , 15.2));
|
|
RecordStructure.Insert("dp_field" , New Structure("DOUBLE_PRECISION" , 1.0002)); // or DOUBLE PRECISION
|
|
RecordStructure.Insert("text_field" , New Structure("TEXT" , "Some text"));
|
|
RecordStructure.Insert("varchar_field" , New Structure("VARCHAR" , "Some varchar"));
|
|
RecordStructure.Insert("charn_field" , New Structure("CHAR" , "AAA"));
|
|
RecordStructure.Insert("char_field" , New Structure("CHAR" , "A"));
|
|
RecordStructure.Insert("name_field" , New Structure("NAME" , "Vitaly"));
|
|
RecordStructure.Insert("bytea_field" , New Structure("BYTEA" , Image));
|
|
RecordStructure.Insert("ts_field" , New Structure("TIMESTAMP" , CurrentDate));
|
|
RecordStructure.Insert("tswtz_field" , New Structure("TIMESTAMP_WITH_TIME_ZONE", CurrentDateTZ)); // or TIMESTAMP WITH TIME ZONE
|
|
RecordStructure.Insert("ip_field" , New Structure("INET" , "127.0.0.1"));
|
|
RecordStructure.Insert("json_field" , New Structure("JSON" , CasualStructure));
|
|
RecordStructure.Insert("jsonb_field" , New Structure("JSONB" , CasualStructure));
|
|
RecordStructure.Insert("date_field" , New Structure("DATE" , CurrentDate));
|
|
RecordStructure.Insert("time_field" , New Structure("TIME" , CurrentDate));
|
|
RecordStructure.Insert("uuid_field" , New Structure("UUID" , New UUID()));
|
|
|
|
RecordsArray.Add(RecordStructure);
|
|
|
|
// 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()
|
|
Result = OPI_PostgreSQL.AddRecords(Table, RecordsArray, True, ConnectionString);
|