Compare commits

..

No commits in common. "52b70c3df1945c673bb997d6896cb8d292cc659a" and "d4544112860983ce3cd36a010a77f19543bd2330" have entirely different histories.

11 changed files with 0 additions and 573426 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
.POSIX:
SRC = dodo.c sqlite3.c x_string.c
OBJ = $(SRC:.c=.o)
CONFIG_PATH = $$HOME/.config/dodo
all: dodo
$(OBJ):
dodo: $(OBJ)
$(CC) -o $@ $(OBJ)
install: dodo
mkdir -p $(CONFIG_PATH)
sqlite3 $(CONFIG_PATH)/dodo.db < dodo.schema
uninstall:
rm -rf $(CONFIG_PATH)
clean:
rm -f dodo $(OBJ)
.PHONY: all clean install uninstall

View File

@ -1,4 +0,0 @@
#ifndef DB_PATH
#define DB_PATH "db.db"
#endif

View File

@ -1,36 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include "sqlite3.h"
#include "x_string.h"
#define HOME_DIR "HOME"
#define DB_DIR "/current_projects/dodo/db/"
#define FILENAME "db.db"
int initdb(sqlite3 *db, char* filename){
int rc = 0;
rc = sqlite3_open(filename, &db);
if ( rc != 0 ){
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
return(rc);
}
return(rc);
}
int main( int argc, char **argv ){
sqlite3 *db;
char* home_dir = getenv(HOME_DIR);
char* filename = x_strconcat(home_dir, DB_DIR);
filename = x_strconcat(filename, FILENAME);
initdb(db, filename);
puts(filename);
return 0;
}

View File

@ -1,19 +0,0 @@
CREATE TABLE tasks(
task_id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'backlog',
due_date DATE,
creation_date DATE DEFAULT (date('now'))
);
CREATE TABLE entries(
entry_id INTEGER PRIMARY KEY,
task_id INTEGER NOT NULL REFERENCES tasks(task_id),
body TEXT NOT NULL,
creation_date DATETIME DEFAULT (datetime('now', 'localtime'))
);
INSERT INTO tasks (title) VALUES ('test1'), ('test2'), ('test3');
INSERT INTO entries (task_id, body) VALUES (1, 'this is an entry for test1'), (2, 'this is an entry for test2'), (3, 'this is an entry for test3');
CREATE VIEW all_info AS SELECT * FROM entries JOIN tasks ON entries.task_id = tasks.task_id;

257673
src/sqlite3.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
int x_strlen(char* str){
char* ptr = str;
while(*ptr != '\0'){
ptr++;
}
return ptr - str;
}
void x_strcpy(char* dest, char* src, const int size_dest){
char* dest_ptr = dest;
char* src_ptr = src;
int i = 0;
while(*src_ptr != '\0'){
if (i >= size_dest){
fprintf(stderr, "Error: x_strcpy\nSource string exeeds destination memory\n");
exit(1);
}
*dest_ptr = *src_ptr;
dest_ptr++;
src_ptr++;
i++;
}
}
char* x_strconcat(char* str1, char* str2){
char* new_string;
int len1 = x_strlen(str1);
int len2 = x_strlen(str2);
int new_length = len1 + len2;
new_string = malloc( sizeof(*new_string) * new_length );
x_strcpy(new_string, str1, new_length);
x_strcpy(&new_string[len1], str2, new_length - len1);
return new_string;
}

View File

@ -1,8 +0,0 @@
#ifndef X_STRING_H
#define X_STRING_H
int x_strlen(char*);
void x_strcpy(char*, char*, const int);
char* x_strconcat(char*, char*);
#endif