diff --git a/meos/examples/02_ais_read.c b/meos/examples/02_ais_read.c index 218e9dab1a..24cda2d84d 100644 --- a/meos/examples/02_ais_read.c +++ b/meos/examples/02_ais_read.c @@ -95,7 +95,7 @@ int main(void) int read = fscanf(file, "%31[^,],%ld,%lf,%lf,%lf\n", timestamp_buffer, &rec.MMSI, &rec.Latitude, &rec.Longitude, &rec.SOG); /* Transform the string representing the timestamp into a timestamp value */ - rec.T = pg_timestamp_in(timestamp_buffer, -1); + rec.T = timestamp_in(timestamp_buffer, -1); if (read == 5) no_records++; @@ -116,7 +116,7 @@ int main(void) /* Print only 1 out of 1000 records */ if (no_records % 1000 == 0) { - char *t_out = pg_timestamp_out(rec.T); + char *t_out = timestamp_out(rec.T); /* See above the assumptions made wrt the input data in the file */ sprintf(point_buffer, "SRID=4326;Point(%lf %lf)@%s+00", rec.Longitude, rec.Latitude, t_out); diff --git a/meos/examples/03_ais_assemble.c b/meos/examples/03_ais_assemble.c index 908fbbb549..b30ebda5e1 100644 --- a/meos/examples/03_ais_assemble.c +++ b/meos/examples/03_ais_assemble.c @@ -132,7 +132,7 @@ int main(void) int read = fscanf(file, "%31[^,],%ld,%lf,%lf,%lf\n", timestamp_buffer, &rec.MMSI, &rec.Latitude, &rec.Longitude, &rec.SOG); /* Transform the string representing the timestamp into a timestamp value */ - rec.T = pg_timestamp_in(timestamp_buffer, -1); + rec.T = timestamp_in(timestamp_buffer, -1); if (read == 5) { @@ -186,7 +186,7 @@ int main(void) * - The coordinates are given in the WGS84 geographic coordinate system * - The timestamps are given in GMT time zone */ - char *t_out = pg_timestamp_out(rec.T); + char *t_out = timestamp_out(rec.T); sprintf(point_buffer, "SRID=4326;Point(%lf %lf)@%s+00", rec.Longitude, rec.Latitude, t_out); free(t_out); diff --git a/meos/examples/03_berlinmod_assemble.c b/meos/examples/03_berlinmod_assemble.c index 55b3d418f2..16e3c096d7 100644 --- a/meos/examples/03_berlinmod_assemble.c +++ b/meos/examples/03_berlinmod_assemble.c @@ -145,11 +145,11 @@ int main(void) &rec.tripid, &rec.vehid, date_buffer, &rec.seq, point_buffer, timestamp_buffer); /* Transform the string representing the date into a date value */ - rec.day = pg_date_in(date_buffer); + rec.day = date_in(date_buffer); /* Transform the string representing the trip into a temporal value */ rec.point = geom_in(point_buffer, -1); /* Transform the string representing the timestamp into a timestamp value */ - rec.t = pg_timestamp_in(timestamp_buffer, -1); + rec.t = timestamp_in(timestamp_buffer, -1); /* Transform the string representing the trip into a temporal value */ TInstant *inst = tpointinst_make(rec.point, rec.t); /* Free the point as it's not needed anymore */ @@ -238,7 +238,7 @@ int main(void) for (i = 0; i < no_trips; i++) { /* Write line in the CSV file */ - char *date_str = pg_date_out(trips[i].day); + char *date_str = date_out(trips[i].day); size_t length; /* Encode using server machine endian */ char *trip_str = temporal_as_hexwkb(trips[i].trip, WKB_EXTENDED, &length); diff --git a/meos/examples/04_ais_store.c b/meos/examples/04_ais_store.c index 8030b27d34..3d9753620f 100644 --- a/meos/examples/04_ais_store.c +++ b/meos/examples/04_ais_store.c @@ -204,7 +204,7 @@ main(int argc, char **argv) int read = fscanf(file, "%32[^,],%ld,%lf,%lf,%lf\n", text_buffer, &rec.MMSI, &rec.Latitude, &rec.Longitude, &rec.SOG); /* Transform the string representing the timestamp into a timestamp value */ - rec.T = pg_timestamp_in(text_buffer, -1); + rec.T = timestamp_in(text_buffer, -1); if (read == 5) { @@ -234,7 +234,7 @@ main(int argc, char **argv) len = sprintf(insert_buffer, "INSERT INTO public.AISInstants(MMSI, location, SOG) VALUES "); - char *t_out = pg_timestamp_out(rec.T); + char *t_out = timestamp_out(rec.T); len += sprintf(insert_buffer + len, "(%ld, 'SRID=4326;Point(%lf %lf)@%s+00', '%lf@%s+00'),", rec.MMSI, rec.Longitude, rec.Latitude, t_out, rec.SOG, t_out); diff --git a/meos/examples/04_ais_stream_db.c b/meos/examples/04_ais_stream_db.c index 8cfe4b7b04..ee89825090 100644 --- a/meos/examples/04_ais_stream_db.c +++ b/meos/examples/04_ais_stream_db.c @@ -225,7 +225,7 @@ main(int argc, char **argv) int read = fscanf(file, "%32[^,],%ld,%lf,%lf,%lf\n", text_buffer, &rec.MMSI, &rec.Latitude, &rec.Longitude, &rec.SOG); /* Transform the string representing the timestamp into a timestamp value */ - rec.T = pg_timestamp_in(text_buffer, -1); + rec.T = timestamp_in(text_buffer, -1); if (read == 5) no_records++; @@ -272,7 +272,7 @@ main(int argc, char **argv) * - The coordinates are given in the WGS84 geographic coordinate system * - The timestamps are given in GMT time zone */ - char *t_out = pg_timestamp_out(rec.T); + char *t_out = timestamp_out(rec.T); sprintf(point_buffer, "SRID=4326;Point(%lf %lf)@%s+00", rec.Longitude, rec.Latitude, t_out); free(t_out); diff --git a/meos/examples/04_ais_stream_file.c b/meos/examples/04_ais_stream_file.c index 11bdd1ab9c..c4f979c171 100644 --- a/meos/examples/04_ais_stream_file.c +++ b/meos/examples/04_ais_stream_file.c @@ -144,7 +144,7 @@ main(int argc, char **argv) int read = fscanf(file_in, "%32[^,],%ld,%lf,%lf,%lf\n", text_buffer, &rec.MMSI, &rec.Latitude, &rec.Longitude, &rec.SOG); /* Transform the string representing the timestamp into a timestamp value */ - rec.T = pg_timestamp_in(text_buffer, -1); + rec.T = timestamp_in(text_buffer, -1); if (read == 5) no_records++; @@ -188,7 +188,7 @@ main(int argc, char **argv) * - The coordinates are given in the WGS84 geographic coordinate system * - The timestamps are given in GMT time zone */ - char *t_out = pg_timestamp_out(rec.T); + char *t_out = timestamp_out(rec.T); sprintf(point_buffer, "SRID=4326;Point(%lf %lf)@%s+00", rec.Longitude, rec.Latitude, t_out); free(t_out); diff --git a/meos/examples/05_berlinmod_disassemble.c b/meos/examples/05_berlinmod_disassemble.c index 47ea4efc41..3b7976537b 100644 --- a/meos/examples/05_berlinmod_disassemble.c +++ b/meos/examples/05_berlinmod_disassemble.c @@ -116,7 +116,7 @@ int main(void) int read = fscanf(file, "%d,%d,%10[^,],%d,%170000[^\n]\n", &tripid, &vehid, date_buffer, &seq, trip_buffer); /* Transform the string representing the date into a date value */ - DateADT day = pg_date_in(date_buffer); + DateADT day = date_in(date_buffer); /* Transform the string representing the trip into a temporal value */ Temporal *trip = temporal_from_hexwkb(trip_buffer); @@ -198,9 +198,9 @@ int main(void) } /* Write line in the CSV file */ - char *date_str = pg_date_out(trips[min_trip].day); + char *date_str = date_out(trips[min_trip].day); char *geom_str = geo_as_ewkt((GSERIALIZED *) &min_inst->value, 6); - char *time_str = pg_timestamptz_out(min_inst->t); + char *time_str = timestamptz_out(min_inst->t); fprintf(file,"%d,%d,%s,%d,%s,%s\n", trips[min_trip].vehid, trips[min_trip].vehid, date_str, trips[min_trip].seq, geom_str, time_str); free(date_str); free(geom_str); free(time_str); free(min_inst); diff --git a/meos/examples/07_berlinmod_tile.c b/meos/examples/07_berlinmod_tile.c index df2b80e6f4..2cf8ca7c5a 100644 --- a/meos/examples/07_berlinmod_tile.c +++ b/meos/examples/07_berlinmod_tile.c @@ -103,8 +103,8 @@ int main(void) true, &no_trip_tiles); /* Compute the (value and time) tiles for speed of trips */ TBox *speed_extent = tbox_in("TBox XT([0, 35),[2020-06-01, 2020-06-05))"); - Interval *duration = pg_interval_in("1 day", -1); - TimestampTz torigin = pg_timestamptz_in("2020-06-01", -1); + Interval *duration = interval_in("1 day", -1); + TimestampTz torigin = timestamptz_in("2020-06-01", -1); TBox *speed_tiles = tfloatbox_value_time_tiles(speed_extent, 10.0, duration, 0.0, torigin, &no_speed_tiles); /* Variables for tiling the trips and their speeds */ @@ -221,10 +221,10 @@ int main(void) memset(&intervalzero, 0, sizeof(Interval)); for (i = 0; i < no_trip_tiles; i++) { - if (pg_interval_cmp(&trip_splits[k].duration, &intervalzero) != 0) + if (interval_cmp(&trip_splits[k].duration, &intervalzero) != 0) { char *stbox_str = stbox_out(&trip_tiles[k], 0); - char *interval_str = pg_interval_out(&trip_splits[k].duration); + char *interval_str = interval_out(&trip_splits[k].duration); printf("Tile: %d, Box: %s, Count: %d, Duration: %s, Distance: %f\n", i, stbox_str, trip_splits[k].count, interval_str, trip_splits[k].distance); @@ -244,7 +244,7 @@ int main(void) { char *span_str = floatspan_out(&speed_tiles[k].span, 0); char *tstzspan_str = tstzspan_out(&speed_tiles[k].period); - char *interval_str = pg_interval_out(&speed_splits[k].duration); + char *interval_str = interval_out(&speed_splits[k].duration); printf("Tile: %d, Span: %s, Period: %s, Count: %d, Duration: %s\n", i, span_str, tstzspan_str, speed_splits[k].count, interval_str); free(span_str); free(tstzspan_str); free(interval_str); diff --git a/meos/examples/08_berlinmod_simplify.c b/meos/examples/08_berlinmod_simplify.c index de04868a19..95d540bfa5 100644 --- a/meos/examples/08_berlinmod_simplify.c +++ b/meos/examples/08_berlinmod_simplify.c @@ -114,7 +114,7 @@ int main(void) &trips[i].tripId, &trips[i].vehId, date_buffer, &trips[i].seq, trip_buffer); /* Transform the string representing the date into a date value */ - trips[i].day = pg_date_in(date_buffer); + trips[i].day = date_in(date_buffer); /* Transform the string representing the trip into a temporal value */ trips[i].trip = temporal_from_hexwkb(trip_buffer); @@ -147,7 +147,7 @@ int main(void) { trips_dp[i] = temporal_simplify_dp(trips[i].trip, DELTA_DISTANCE, false); trips_sed[i] = temporal_simplify_dp(trips[i].trip, DELTA_DISTANCE, true); - char *day_str = pg_date_out(trips[i].day); + char *day_str = date_out(trips[i].day); printf("Vehicle: %d, Date: %s, Seq: %d, No. of instants: %d, " "No. of instants DP: %d, No. of instants SED: %d\n", trips[i].vehId, day_str, trips[i].seq, diff --git a/meos/examples/09_berlinmod_aggregate.c b/meos/examples/09_berlinmod_aggregate.c index 1908e6aee9..6dcface3e5 100644 --- a/meos/examples/09_berlinmod_aggregate.c +++ b/meos/examples/09_berlinmod_aggregate.c @@ -99,8 +99,8 @@ int main(void) /* Variable keeping the current aggregate state */ SkipList *state = NULL; STBox *extent = NULL; - Interval *interval = pg_interval_in("1 hour", -1); - TimestampTz origin = pg_timestamptz_in("2020-06-01", -1); + Interval *interval = interval_in("1 hour", -1); + TimestampTz origin = timestamptz_in("2020-06-01", -1); /* Continue reading the file */ do @@ -108,7 +108,7 @@ int main(void) int read = fscanf(file, "%d,%d,%10[^,],%d,%170000[^\n]\n", &trip_rec.tripid, &trip_rec.vehid, date_buffer, &trip_rec.seq, trip_buffer); /* Transform the string representing the date into a date value */ - DateADT day = pg_date_in(date_buffer); + DateADT day = date_in(date_buffer); trip_rec.day = day; /* Transform the string representing the trip into a temporal value */ trip_rec.trip = temporal_from_hexwkb(trip_buffer); diff --git a/meos/examples/ais_assemble_full.c b/meos/examples/ais_assemble_full.c index bc449cf8f4..1a658af944 100644 --- a/meos/examples/ais_assemble_full.c +++ b/meos/examples/ais_assemble_full.c @@ -188,7 +188,7 @@ int main(void) switch (field) { case 0: - rec.T = pg_timestamp_in(token, -1); + rec.T = timestamp_in(token, -1); if (rec.T != 0) has_t = true; break; @@ -283,7 +283,7 @@ int main(void) /* Create an Trip instant from the record */ if (has_lat && has_long) { - char *t_out = pg_timestamp_out(rec.T); + char *t_out = timestamp_out(rec.T); sprintf(point_buffer, "SRID=4326;Point(%lf %lf)@%s+00", rec.Longitude, rec.Latitude, t_out); free(t_out); diff --git a/meos/examples/ais_expand.c b/meos/examples/ais_expand.c index fc21315935..3b16bc31a9 100644 --- a/meos/examples/ais_expand.c +++ b/meos/examples/ais_expand.c @@ -121,7 +121,7 @@ int main(void) int read = fscanf(file, "%31[^,],%ld,%lf,%lf,%lf\n", timestamp_buffer, &rec.MMSI, &rec.Latitude, &rec.Longitude, &rec.SOG); /* Transform the string representing the timestamp into a timestamp value */ - rec.T = pg_timestamp_in(timestamp_buffer, -1); + rec.T = timestamp_in(timestamp_buffer, -1); if (read == 5) no_records++; @@ -168,7 +168,7 @@ int main(void) * - The coordinates are given in the WGS84 geographic coordinate system * - The timestamps are given in GMT time zone */ - char *t_out = pg_timestamp_out(rec.T); + char *t_out = timestamp_out(rec.T); sprintf(inst_buffer, "SRID=4326;Point(%lf %lf)@%s", rec.Longitude, rec.Latitude, t_out); free(t_out); diff --git a/meos/examples/ais_expand_full.c b/meos/examples/ais_expand_full.c index 89da289c56..ca68dfcca2 100644 --- a/meos/examples/ais_expand_full.c +++ b/meos/examples/ais_expand_full.c @@ -188,7 +188,7 @@ int main(void) switch (field) { case 0: - rec.T = pg_timestamp_in(token, -1); + rec.T = timestamp_in(token, -1); if (rec.T != 0) has_t = true; break; @@ -277,7 +277,7 @@ int main(void) /* Create an Trip instant from the record */ if (has_lat && has_long) { - char *t_out = pg_timestamp_out(rec.T); + char *t_out = timestamp_out(rec.T); sprintf(point_buffer, "SRID=4326;Point(%lf %lf)@%s+00", rec.Longitude, rec.Latitude, t_out); free(t_out); diff --git a/meos/examples/ais_generalize.c b/meos/examples/ais_generalize.c index 5806257e16..0d48888268 100644 --- a/meos/examples/ais_generalize.c +++ b/meos/examples/ais_generalize.c @@ -212,8 +212,8 @@ int main(void) free(temp); /* Minimum tdelta simplification */ - Interval *secs1 = pg_interval_in("1 second", -1); - Interval *secs10 = pg_interval_in("10 seconds", -1); + Interval *secs1 = interval_in("1 second", -1); + Interval *secs10 = interval_in("10 seconds", -1); temp = temporal_simplify_min_tdelta(trips[i].trip, secs1); min_tdelta_1 += temporal_mem_size(temp); no_min_tdelta_1 += temporal_num_instants(temp); @@ -224,7 +224,7 @@ int main(void) free(temp); /* Tprecision simplification */ - TimestampTz origin = pg_timestamp_in("2000-01-01", -1); + TimestampTz origin = timestamp_in("2000-01-01", -1); temp = temporal_tprecision(trips[i].trip, secs1, origin); tprec_1s += temporal_mem_size(temp); no_tprec_1s += temporal_num_instants(temp); diff --git a/meos/examples/stbox_tile.c b/meos/examples/stbox_tile.c index f9a8674dbc..e3b7acffb7 100644 --- a/meos/examples/stbox_tile.c +++ b/meos/examples/stbox_tile.c @@ -64,9 +64,9 @@ int main(void) /* Initialize values for tiling */ STBox *box = stbox_in("STBOX XT(((1,1),(10,10)),[2020-03-01, 2020-03-10])"); - Interval *interv = pg_interval_in("5 days", -1); + Interval *interv = interval_in("5 days", -1); GSERIALIZED *sorigin = geom_in("Point(0 0 0)", -1); - TimestampTz torigin = pg_timestamptz_in("2020-03-01", -1); + TimestampTz torigin = timestamptz_in("2020-03-01", -1); /* Perform tiling */ STBox *boxes; diff --git a/meos/examples/tbox_tile.c b/meos/examples/tbox_tile.c index a0bd3170d4..2d7db9823b 100644 --- a/meos/examples/tbox_tile.c +++ b/meos/examples/tbox_tile.c @@ -68,8 +68,8 @@ int main(void) TBox *box = intspan ? tbox_in("TBOXINT XT([1,10],[2020-03-01, 2020-03-10])") : tbox_in("TBOXFLOAT XT([1,10],[2020-03-01, 2020-03-10])"); - Interval *interv = pg_interval_in("5 days", -1); - TimestampTz torigin = pg_timestamptz_in("2020-03-01", -1); + Interval *interv = interval_in("5 days", -1); + TimestampTz torigin = timestamptz_in("2020-03-01", -1); /* Perform tiling */ TBox *boxes; diff --git a/meos/examples/tfloat_assemble.c b/meos/examples/tfloat_assemble.c index ca4cb51b68..4221289046 100644 --- a/meos/examples/tfloat_assemble.c +++ b/meos/examples/tfloat_assemble.c @@ -69,13 +69,13 @@ int main(void) /* Sequence constructed from the input instants */ Temporal *seq = NULL; /* Interval to add */ - Interval *oneday = pg_interval_in("1 day", -1); + Interval *oneday = interval_in("1 day", -1); /* Iterator variable */ int i; /* Seed the random number generator with the current time in seconds. */ srandom (time (0)); - TimestampTz t = pg_timestamptz_in("1999-12-31", -1); + TimestampTz t = timestamptz_in("1999-12-31", -1); for (i = 0; i < MAX_INSTANTS; i++) { t = add_timestamptz_interval(t, oneday); diff --git a/meos/examples/tfloat_expand.c b/meos/examples/tfloat_expand.c index 803ef1d324..fe9f5dee16 100644 --- a/meos/examples/tfloat_expand.c +++ b/meos/examples/tfloat_expand.c @@ -70,11 +70,11 @@ int main(void) /* Expandable sequence */ Temporal *seq = NULL; /* Interval to add */ - Interval *oneday = pg_interval_in("1 day", -1); + Interval *oneday = interval_in("1 day", -1); /* Iterator variable */ int i; - TimestampTz t = pg_timestamptz_in("1999-12-31", -1); + TimestampTz t = timestamptz_in("1999-12-31", -1); for (i = 0; i < MAX_INSTANTS; i++) { t = add_timestamptz_interval(t, oneday); diff --git a/meos/examples/tfloat_tile.c b/meos/examples/tfloat_tile.c index 5b23b184ee..1a30b7c59b 100644 --- a/meos/examples/tfloat_tile.c +++ b/meos/examples/tfloat_tile.c @@ -54,9 +54,9 @@ int main(void) meos_initialize(); Temporal *tfloat = tfloat_in("[1@2020-03-01, 10@2020-03-10]"); - Interval *interv = pg_interval_in("2 days", -1); + Interval *interv = interval_in("2 days", -1); double vorigin = 0.0; - TimestampTz torigin = pg_timestamptz_in("2020-03-01", -1); + TimestampTz torigin = timestamptz_in("2020-03-01", -1); bool valuesplit = true; /* Set this parameter to enable/disable value split */ bool timesplit = true; /* Set this parameter to enable/disable time split */ @@ -87,7 +87,7 @@ int main(void) int i; for (i = 0; i < count; i++) { - char *time_str = timesplit ? pg_timestamptz_out(time_bins[i]) : ""; + char *time_str = timesplit ? timestamptz_out(time_bins[i]) : ""; char *temp_str = tfloat_out(result[i], 3); if (valuesplit) snprintf(output_buffer, sizeof(output_buffer), "%f, %s%s%s\n", diff --git a/meos/examples/tpoint_assemble.c b/meos/examples/tpoint_assemble.c index 644a610bbd..9bb648a174 100644 --- a/meos/examples/tpoint_assemble.c +++ b/meos/examples/tpoint_assemble.c @@ -76,14 +76,14 @@ int main(void) /* Sequence constructed from the input instants */ Temporal *seq = NULL; /* Interval to add */ - Interval *oneday = pg_interval_in("1 day", -1); + Interval *oneday = interval_in("1 day", -1); /* Iterator variable */ int i; printf("Reading the instants (one '*' marker every %d instants)\n", NO_INSTANTS_BATCH); - TimestampTz t = pg_timestamptz_in("1999-12-31", -1); + TimestampTz t = timestamptz_in("1999-12-31", -1); for (i = 0; i < MAX_INSTANTS; i++) { if (i % NO_INSTANTS_BATCH == 0) @@ -92,7 +92,7 @@ int main(void) fflush(stdout); } t = add_timestamptz_interval(t, oneday); - char *time_str = pg_timestamptz_out(t); + char *time_str = timestamptz_out(t); int value = i % 2 + 1; #if GEODETIC == true sprintf(inst_buffer, "SRID=4326;Point(%d %d)@%s", value, value, time_str); diff --git a/meos/examples/tpoint_expand.c b/meos/examples/tpoint_expand.c index 5ec2abf497..baf17a6c05 100644 --- a/meos/examples/tpoint_expand.c +++ b/meos/examples/tpoint_expand.c @@ -84,14 +84,14 @@ int main(void) /* Sequence constructed from the input instants */ Temporal *seq = NULL; /* Interval to add */ - Interval *oneday = pg_interval_in("1 day", -1); + Interval *oneday = interval_in("1 day", -1); /* Iterator variable */ int i; printf("Reading the instants (one '*' marker every %d instants)\n", NO_INSTANTS_BATCH); - TimestampTz t = pg_timestamptz_in("1999-12-31", -1); + TimestampTz t = timestamptz_in("1999-12-31", -1); for (i = 0; i < MAX_INSTANTS; i++) { if (i % NO_INSTANTS_BATCH == 0) @@ -100,7 +100,7 @@ int main(void) fflush(stdout); } t = add_timestamptz_interval(t, oneday); - char *time_str = pg_timestamptz_out(t); + char *time_str = timestamptz_out(t); int value = i % 2 + 1; #if GEODETIC == true sprintf(inst_buffer, "SRID=4326;Point(%d %d)@%s", value, value, time_str); diff --git a/meos/examples/tpoint_tile.c b/meos/examples/tpoint_tile.c index 316646fb89..6bef501e0c 100644 --- a/meos/examples/tpoint_tile.c +++ b/meos/examples/tpoint_tile.c @@ -54,9 +54,9 @@ int main(void) meos_initialize(); Temporal *tpoint = tgeompoint_in("[Point(1 1)@2020-03-01, Point(10 10)@2020-03-10]"); - Interval *interv = pg_interval_in("2 days", -1); + Interval *interv = interval_in("2 days", -1); GSERIALIZED *sorigin = geom_in("Point(0 0 0)", -1); - TimestampTz torigin = pg_timestamptz_in("2020-03-01", -1); + TimestampTz torigin = timestamptz_in("2020-03-01", -1); bool spacesplit = true; /* Set this parameter to enable/disable space split */ bool timesplit = true; /* Set this parameter to enable/disable time split */ @@ -92,7 +92,7 @@ int main(void) { char *space_str = spacesplit ? geo_as_ewkt(space_bins[i], 3) : ""; - char *time_str = timesplit ? pg_timestamptz_out(time_bins[i]) : ""; + char *time_str = timesplit ? timestamptz_out(time_bins[i]) : ""; char *temp_str = tpoint_as_ewkt(result[i], 3); sprintf(output_buffer, "%s%s%s%s%s\n", space_str, spacesplit ? ", " : "", time_str, timesplit ? ", " : "", temp_str); diff --git a/meos/examples/tpointseq_make_coords.c b/meos/examples/tpointseq_make_coords.c index 633788356e..c6df8cb953 100644 --- a/meos/examples/tpointseq_make_coords.c +++ b/meos/examples/tpointseq_make_coords.c @@ -58,7 +58,7 @@ int main() meos_initialize(); for (int i = 0; i < 4; i++) - times[i] = pg_timestamptz_in(times_str[i], -1); + times[i] = timestamptz_in(times_str[i], -1); /* Input temporal points in WKT format */ TSequence *seq1 = tpointseq_make_coords(xcoords, ycoords, zcoords, times, diff --git a/meos/examples/ttext_assemble.c b/meos/examples/ttext_assemble.c index eb44ebb508..7fef149efa 100644 --- a/meos/examples/ttext_assemble.c +++ b/meos/examples/ttext_assemble.c @@ -70,7 +70,7 @@ int main(void) /* Sequence constructed from the input instants */ Temporal *seq = NULL; /* Interval to add */ - Interval *oneday = pg_interval_in("1 day", -1); + Interval *oneday = interval_in("1 day", -1); /* Iterator variable */ int i; /* Seed the random number generator with the current time in seconds. */ @@ -79,7 +79,7 @@ int main(void) printf("Generating the instants (one '*' marker every %d instants)\n", NO_INSTANTS_BATCH); - TimestampTz t = pg_timestamptz_in("1999-12-31", -1); + TimestampTz t = timestamptz_in("1999-12-31", -1); for (i = 0; i < MAX_INSTANTS; i++) { /* Generate the instant */ diff --git a/meos/examples/ttext_expand.c b/meos/examples/ttext_expand.c index 1d0909ba4e..4e0075c512 100644 --- a/meos/examples/ttext_expand.c +++ b/meos/examples/ttext_expand.c @@ -102,7 +102,7 @@ int main(void) TSequence *seq = NULL, *seq1 = NULL; TSequenceSet *ss = NULL; /* Interval to add */ - Interval *onehour = pg_interval_in("1 hour", -1); + Interval *onehour = interval_in("1 hour", -1); /* Iterator variables */ int i; /* Seed the random number generator with the current time in seconds. */ @@ -113,7 +113,7 @@ int main(void) printf("Generating the instants (one '*' marker every %d instants)\n", NO_INSTANTS_BATCH); - TimestampTz t = pg_timestamptz_in("2000-01-01", -1); + TimestampTz t = timestamptz_in("2000-01-01", -1); for (i = 0; i < MAX_INSTANTS; i++) { /* Generate the instant */ diff --git a/meos/include/general/pg_types.h b/meos/include/general/pg_types.h index 245c9844d9..637a1f3ee4 100644 --- a/meos/include/general/pg_types.h +++ b/meos/include/general/pg_types.h @@ -38,7 +38,12 @@ /* PostgreSQL */ #include +#if MEOS +#include "postgres_int_defs.h" +#else +#include #include +#endif /* Functions adapted from int.c */ @@ -62,7 +67,18 @@ extern float8 pg_datan2(float8 arg1, float8 arg2); /* Functions adadpted from timestamp.c */ +extern DateADT pg_date_in(const char *str); +extern char *pg_date_out(DateADT d); +extern int pg_interval_cmp(const Interval *interv1, const Interval *interv2); +extern Interval *pg_interval_in(const char *str, int32 prec); extern Interval *pg_interval_justify_hours(const Interval *span); +extern char *pg_interval_out(const Interval *interv); +extern TimeADT pg_time_in(const char *str, int32 typmod); +extern char *pg_time_out(TimeADT t); +extern Timestamp pg_timestamp_in(const char *str, int32 typmod); +extern char *pg_timestamp_out(Timestamp t); +extern TimestampTz pg_timestamptz_in(const char *str, int32 prec); +extern char *pg_timestamptz_out(TimestampTz t); /* Functions adapted from hashfn.h and hashfn.c */ diff --git a/meos/include/meos.h b/meos/include/meos.h index 3069e7518d..8b9f23be96 100644 --- a/meos/include/meos.h +++ b/meos/include/meos.h @@ -380,18 +380,7 @@ extern DateADT minus_date_int(DateADT d, int32 days); extern TimestampTz minus_timestamptz_interval(TimestampTz t, const Interval *interv); extern Interval *minus_timestamptz_timestamptz(TimestampTz t1, TimestampTz t2); extern Interval *mult_interval_double(const Interval *interv, double factor); -extern DateADT pg_date_in(const char *str); -extern char *pg_date_out(DateADT d); -extern int pg_interval_cmp(const Interval *interv1, const Interval *interv2); -extern Interval *pg_interval_in(const char *str, int32 typmod); -extern Interval *pg_interval_make(int32 years, int32 months, int32 weeks, int32 days, int32 hours, int32 mins, double secs); -extern char *pg_interval_out(const Interval *interv); -extern TimeADT pg_time_in(const char *str, int32 typmod); -extern char *pg_time_out(TimeADT t); -extern Timestamp pg_timestamp_in(const char *str, int32 typmod); -extern char *pg_timestamp_out(Timestamp t); -extern TimestampTz pg_timestamptz_in(const char *str, int32 typmod); -extern char *pg_timestamptz_out(TimestampTz t); + extern char *text2cstring(const text *txt); extern int text_cmp(const text *txt1, const text *txt2); extern text *text_copy(const text *txt); diff --git a/meos/include/postgres_ext_defs.in.h b/meos/include/postgres_ext_defs.in.h index 0103cb7377..b131497d03 100644 --- a/meos/include/postgres_ext_defs.in.h +++ b/meos/include/postgres_ext_defs.in.h @@ -39,4 +39,17 @@ typedef struct varlena typedef varlena text; typedef struct varlena bytea; +extern DateADT date_in(const char *str); +extern char *date_out(DateADT d); +extern int interval_cmp(const Interval *interv1, const Interval *interv2); +extern Interval *interval_in(const char *str, int32 typmod); +extern Interval *interval_make(int32 years, int32 months, int32 weeks, int32 days, int32 hours, int32 mins, double secs); +extern char *interval_out(const Interval *interv); +extern TimeADT time_in(const char *str, int32 typmod); +extern char *time_out(TimeADT t); +extern Timestamp timestamp_in(const char *str, int32 typmod); +extern char *timestamp_out(Timestamp t); +extern TimestampTz timestamptz_in(const char *str, int32 typmod); +extern char *timestamptz_out(TimestampTz t); + #endif /* POSTGRES_H */ diff --git a/meos/postgres/timezone/CMakeLists.txt b/meos/postgres/timezone/CMakeLists.txt index 4c842f0308..2e03b8f9eb 100644 --- a/meos/postgres/timezone/CMakeLists.txt +++ b/meos/postgres/timezone/CMakeLists.txt @@ -4,5 +4,5 @@ add_library(timezone OBJECT pgtz.c ) -set_property(TARGET timezone PROPERTY C_VISIBILITY_PRESET hidden) -set_property(TARGET timezone PROPERTY POSITION_INDEPENDENT_CODE ON) +# set_property(TARGET timezone PROPERTY C_VISIBILITY_PRESET hidden) +# set_property(TARGET timezone PROPERTY POSITION_INDEPENDENT_CODE ON) diff --git a/meos/src/general/pg_types.c b/meos/src/general/pg_types.c index 39db3be799..e129dfcaad 100644 --- a/meos/src/general/pg_types.c +++ b/meos/src/general/pg_types.c @@ -658,6 +658,11 @@ pg_date_in(const char *str) * @note PostgreSQL function: @p date_in(PG_FUNCTION_ARGS) */ DateADT +date_in(const char *str) +{ + return pg_date_in(str); +} +DateADT pg_date_in(const char *str) { /* Ensure validity of the arguments */ @@ -762,6 +767,11 @@ pg_date_out(DateADT d) * @note PostgreSQL function: @p date_in(PG_FUNCTION_ARGS) */ char * +date_out(DateADT d) +{ + return pg_date_out(d); +} +char * pg_date_out(DateADT d) { struct pg_tm tt, *tm = &tt; @@ -1112,7 +1122,7 @@ MEOSAdjustTimeForTypmod(TimeADT *time, int32 typmod) * @note PostgreSQL function: @p time_in(PG_FUNCTION_ARGS) */ TimeADT -pg_time_in(const char *str, int32 prec) +time_in(const char *str, int32 prec) { /* Ensure validity of the arguments */ if (! ensure_not_null((void *) str)) @@ -1156,7 +1166,7 @@ pg_time_in(const char *str, int32 prec) * @note PostgreSQL function: @p time_out(PG_FUNCTION_ARGS) */ char * -pg_time_out(TimeADT t) +time_out(TimeADT t) { struct pg_tm tt, *tm = &tt; fsec_t fsec; @@ -1360,6 +1370,11 @@ timestamp_in_common(const char *str, int32 typmod, bool withtz) * @note PostgreSQL function: @p timestamp_in(PG_FUNCTION_ARGS) */ Timestamp +timestamp_in(const char *str, int32 prec) +{ + return (Timestamp) timestamp_in_common(str, prec, false); +} +Timestamp pg_timestamp_in(const char *str, int32 prec) { return (Timestamp) timestamp_in_common(str, prec, false); @@ -1376,6 +1391,11 @@ pg_timestamp_in(const char *str, int32 prec) * @note PostgreSQL function: @p timestamptz_in(PG_FUNCTION_ARGS) */ TimestampTz +timestamptz_in(const char *str, int32 prec) +{ + return timestamp_in_common(str, prec, true); +} +TimestampTz pg_timestamptz_in(const char *str, int32 prec) { return timestamp_in_common(str, prec, true); @@ -1432,6 +1452,11 @@ timestamp_out_common(TimestampTz t, bool withtz) * @note PostgreSQL function: @p timestamp_out(PG_FUNCTION_ARGS) */ char * +timestamp_out(Timestamp t) +{ + return timestamp_out_common((TimestampTz) t, false); +} +char * pg_timestamp_out(Timestamp t) { return timestamp_out_common((TimestampTz) t, false); @@ -1444,6 +1469,11 @@ pg_timestamp_out(Timestamp t) * @note PostgreSQL function: @p timestamptz_out(PG_FUNCTION_ARGS) */ char * +timestamptz_out(TimestampTz t) +{ + return timestamp_out_common(t, true); +} +char * pg_timestamptz_out(TimestampTz t) { return timestamp_out_common(t, true); @@ -1482,19 +1512,7 @@ timestamptz_to_date(TimestampTz t) /*****************************************************************************/ -#if ! MEOS -/** - * @brief Return the string representation of an interval - * @return On error return @p NULL - * @note PostgreSQL function: @p interval_out(PG_FUNCTION_ARGS) - */ -char * -pg_interval_out(const Interval *interv) -{ - Datum d = PointerGetDatum(interv); - return DatumGetCString(call_function1(interval_out, d)); -} -#else /*if MEOS */ +#if MEOS /* * Adjust interval for specified precision, in both YEAR to SECOND * range and sub-second precision. @@ -1681,6 +1699,11 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) * for a detailed account of the input syntax and the precision */ Interval * +interval_in(const char *str, int32 prec) +{ + return pg_interval_in(str, prec); +} +Interval * pg_interval_in(const char *str, int32 prec) { /* Ensure validity of the arguments */ @@ -1758,6 +1781,7 @@ pg_interval_in(const char *str, int32 prec) return result; } +#endif /* MEOS */ /** * @ingroup meos_pg_types @@ -1772,7 +1796,7 @@ pg_interval_in(const char *str, int32 prec) * @note PostgreSQL function: @p make_interval(PG_FUNCTION_ARGS) */ Interval * -pg_interval_make(int32 years, int32 months, int32 weeks, int32 days, int32 hours, +interval_make(int32 years, int32 months, int32 weeks, int32 days, int32 hours, int32 mins, double secs) { Interval *result; @@ -1798,6 +1822,20 @@ pg_interval_make(int32 years, int32 months, int32 weeks, int32 days, int32 hours return result; } + +#if ! MEOS +/** + * @brief Return the string representation of an interval + * @return On error return @p NULL + * @note PostgreSQL function: @p interval_out(PG_FUNCTION_ARGS) + */ +char * +pg_interval_out(const Interval *interv) +{ + Datum d = PointerGetDatum(interv); + return DatumGetCString(call_function1(interval_out, d)); +} +#else /** * @ingroup meos_pg_types * @brief Return the string representation of an interval @@ -1810,6 +1848,11 @@ pg_interval_make(int32 years, int32 months, int32 weeks, int32 days, int32 hours * default) */ char * +interval_out(const Interval *interv) +{ + return pg_interval_out(interv); +} +char * pg_interval_out(const Interval *interv) { /* Ensure validity of the arguments */ @@ -2188,6 +2231,7 @@ interval_cmp_value(const Interval *interval) return span; } +#if MEOS /** * @ingroup meos_pg_types * @brief Return the comparison of two intervals @@ -2195,6 +2239,12 @@ interval_cmp_value(const Interval *interval) * @note PostgreSQL function: @p interval_cmp(PG_FUNCTION_ARGS) */ int +interval_cmp(const Interval *interv1, const Interval *interv2) +{ + return pg_interval_cmp(interv1, interv2); +} +#endif /* MEOS */ +int pg_interval_cmp(const Interval *interv1, const Interval *interv2) { /* Ensure validity of the arguments */ diff --git a/meos/src/general/spanset.c b/meos/src/general/spanset.c index d55c37dd63..3ebaf0bd5b 100644 --- a/meos/src/general/spanset.c +++ b/meos/src/general/spanset.c @@ -47,6 +47,7 @@ /* MEOS */ #include #include +#include "general/pg_types.h" #include "general/span.h" #include "general/temporal.h" #include "general/type_parser.h" diff --git a/meos/src/general/temporal.c b/meos/src/general/temporal.c index e84f2ff160..8d7facd6e3 100644 --- a/meos/src/general/temporal.c +++ b/meos/src/general/temporal.c @@ -49,6 +49,7 @@ #include #include "general/doxygen_meos.h" #include "general/lifting.h" +#include "general/pg_types.h" #include "general/temporal_boxops.h" #include "general/temporal_tile.h" #include "general/tinstant.h" diff --git a/meos/src/general/temporal_aggfuncs.c b/meos/src/general/temporal_aggfuncs.c index 207f2d60a6..6f1c0cec32 100644 --- a/meos/src/general/temporal_aggfuncs.c +++ b/meos/src/general/temporal_aggfuncs.c @@ -43,6 +43,7 @@ /* MEOS */ #include #include +#include "general/pg_types.h" #include "general/set.h" #include "general/skiplist.h" #include "general/span.h" diff --git a/meos/src/general/temporal_analytics.c b/meos/src/general/temporal_analytics.c index ab5a253028..7be5024e8b 100644 --- a/meos/src/general/temporal_analytics.c +++ b/meos/src/general/temporal_analytics.c @@ -40,6 +40,7 @@ #include /* PostgreSQL */ #include +#include /* PostGIS */ #include /* MEOS */ diff --git a/meos/src/general/temporal_modif.c b/meos/src/general/temporal_modif.c index 84c2dada1c..d64181a90f 100644 --- a/meos/src/general/temporal_modif.c +++ b/meos/src/general/temporal_modif.c @@ -44,6 +44,7 @@ /* MEOS */ #include #include +#include "general/pg_types.h" #include "general/span.h" #include "general/spanset.h" #include "general/temporal_boxops.h" diff --git a/meos/src/general/tsequence.c b/meos/src/general/tsequence.c index 8050bd1f08..32d2ddf8ff 100644 --- a/meos/src/general/tsequence.c +++ b/meos/src/general/tsequence.c @@ -49,6 +49,7 @@ #include #include #include "general/doublen.h" +#include "general/pg_types.h" #include "general/set.h" #include "general/span.h" #include "general/spanset.h" diff --git a/meos/src/general/tsequenceset.c b/meos/src/general/tsequenceset.c index edac37edd5..675ce6eada 100644 --- a/meos/src/general/tsequenceset.c +++ b/meos/src/general/tsequenceset.c @@ -45,6 +45,7 @@ /* MEOS */ #include #include +#include "general/pg_types.h" #include "general/span.h" #include "general/spanset.h" #include "general/tsequence.h" diff --git a/meos/src/general/type_in.c b/meos/src/general/type_in.c index c599624a42..54214a3308 100644 --- a/meos/src/general/type_in.c +++ b/meos/src/general/type_in.c @@ -40,6 +40,7 @@ /* MEOS */ #include #include +#include "general/pg_types.h" #include "general/set.h" #include "general/span.h" #include "general/tbox.h" diff --git a/meos/src/general/type_out.c b/meos/src/general/type_out.c index 43cb29bb99..66aa358304 100644 --- a/meos/src/general/type_out.c +++ b/meos/src/general/type_out.c @@ -46,6 +46,7 @@ /* MEOS */ #include #include +#include "general/pg_types.h" #include "general/temporal.h" #if NPOINT #include "npoint/tnpoint.h" diff --git a/meos/src/general/type_parser.c b/meos/src/general/type_parser.c index fe6a4e1c1c..3a5c7c842b 100644 --- a/meos/src/general/type_parser.c +++ b/meos/src/general/type_parser.c @@ -41,6 +41,7 @@ /* MEOS */ #include #include +#include "general/pg_types.h" #include "general/temporal.h" #include "general/type_util.h"