reading in duckdb filepath as arg and opening the database
This commit is contained in:
26
src/main.c
26
src/main.c
@@ -1,6 +1,28 @@
|
|||||||
|
#include <duckdb.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(int argc, char** argv){
|
||||||
|
printf("Hello from HardCompound!\n");
|
||||||
|
|
||||||
|
if(argc < 2){
|
||||||
|
printf("You need to specify a duckdb file path! Terminating!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
printf("First argument: %s", argv[1]);
|
||||||
|
|
||||||
|
duckdb_database db;
|
||||||
|
if(duckdb_open(argv[1], &db) == DuckDBError){
|
||||||
|
printf("Error opening duckdb file, terminating!");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
duckdb_connection conn;
|
||||||
|
if(duckdb_connect(db, &conn) == DuckDBError){
|
||||||
|
printf("Error connecting to the duckdb database! Terminating!");
|
||||||
|
exit(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
|
||||||
printf("Hello World");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user