![]() |
MobilityDB 1.3
|
A simple program that reads AIS data from a CSV file, converts them into temporal values, and stores them in MobilityDB. More...
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <libpq-fe.h>
#include <meos.h>
#include <meos_geo.h>
Data Structures | |
struct | AIS_record |
Macros | |
#define | MAX_LENGTH_HEADER 1024 |
#define | MAX_LENGTH_SQL 16384 |
#define | NO_BULK_INSERT 20 |
#define | NO_INSTANTS_BATCH 10000 |
Functions | |
static int | exec_sql (PGconn *conn, const char *sql, ExecStatusType status) |
Function that sends a SQL query to the database. More... | |
int | main (int argc, char **argv) |
A simple program that reads AIS data from a CSV file, converts them into temporal values, and stores them in MobilityDB.
This program uses the libpq library https://www.postgresql.org/docs/current/libpq.html for connecting to a PostgreSQL database that has the MobilityDB extension. For this, it is required that libpq-dev
is installed in your system. For example, in Ubuntu you can install this library as follows
You should configure PostgreSQL to accept all incoming connections by setting in the pg_hba.conf
file
Also, make sure that PostgreSQL allows incoming connections on all available IP interfaces by setting in the postgresql.conf
file
This program is based on the libpq example programs https://www.postgresql.org/docs/current/libpq-example.html Please read the assumptions made about the input file in the file 02_ais_read.c
in the same directory.
The program can be build as follows