File: sqlite_functions.h

package info (click to toggle)
xmms-stats 0.2-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 116 kB
  • ctags: 74
  • sloc: ansic: 433; makefile: 70; php: 56
file content (58 lines) | stat: -rw-r--r-- 1,944 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 dated June, 1991.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "xmlwriter.h"

void delete_old_songs(void);

/* This callback is run when th XML file must be generated*/
static int callback_write_all(void *NotUsed, int argc, char **argv, char **azColName)
{
	write_xml(fd, "<song>\n<title>", strlen("<song>\n<title>"));
	replace_char_xml(&argv[0]);
	write_xml(fd, argv[0], strlen(argv[0]));
	write_xml(fd, "</title>\n<hits>", strlen("</title>\n<hits>"));
	write_xml(fd, argv[2], strlen(argv[2]));
 	write_xml(fd, "</hits>\n<length>",strlen("</hits>\n<length>"));
 	write_xml(fd, argv[1], strlen(argv[1]));
 	write_xml(fd, "</length>\n<listentime>",strlen("</length>\n<listentime>"));
	write_xml(fd, argv[3], strlen(argv[3]));
	write_xml(fd, "</listentime>\n<last>",strlen("</listentime>\n<last>"));
	write_xml(fd, argv[4], strlen(argv[4]));
	write_xml(fd, "</last>\n</song>\n",strlen("</last>\n</song>\n"));
	return 0;
}

/* set numbers of hits*/
static int callback_nb_result(void *NotUsed, int argc, char **argv, char **azColName)
{
	if(argc ==2)
	{
		hits = atoi(argv[0]);
		listen_time = atoi(argv[1]);
	}
	return 0;
}

static int callback_check_table_presence(void *NotUsed, int argc, char **argv, char **azColName){
	if(argc ==1)
		hits = 1;
	return 0;
}