Ejemplo n.º 1
0
int sql_loop() /*This is the main loop to be concerned with.*/
{
    MYSQL *conn;
    MYSQL_INFO *info = CONNECTION_INIT();
    if((conn = MYSQL_CONNECT_DB(info)) == (MYSQL *) 0){
        printw("MySQL connection failed. Exiting.\n");
        refresh();
        return 1;
    } else {
        int key;
        nodelay(stdscr,TRUE);
        signal(SIGINT, INThandler);
        while(1){
            if((key = getch()) == ERR) {
                if(mysql_ping(conn) == 1){
                    printw("Error!\n");
                    refresh();
                    
                    return 1;
                } 
            } else {
                if(key == EOF) break;
            }
        }
        free(info);
        EXIT_SERVER(conn);
        return 0;
    }
    return 0;
}
Ejemplo n.º 2
0
void soma_init(Soma * soma)
{
	if (soma != NULL)
	{
		soma->connection.from = NULL;
		soma->connection.to = NULL;
		CONNECTION_INIT(&soma->connection);
		ion_channel_init(&soma->ion_channel, 0, 1);
	}
}
Ejemplo n.º 3
0
void dendrite_init(Dendrite * dendrite, int length, int diameter)
{
	if (dendrite != NULL)
	{
		dendrite->connection.from = NULL;
		dendrite->connection.to = NULL;
		CONNECTION_INIT(&dendrite->connection);
		ion_channel_init(&dendrite->ion_channel, length, diameter);
	}
}