Browse code

- db_val has been replaced with db_fld

Jan Janak authored on 29/03/2007 10:08:33
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,88 +0,0 @@
1
-/* 
2
- * $Id$ 
3
- *
4
- * Copyright (C) 2001-2003 FhG Fokus
5
- *
6
- * This file is part of ser, a free SIP server.
7
- *
8
- * ser is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
12
- *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * ser is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License 
24
- * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
- */
27
-
28
-
29
-#ifndef DB_VAL_H
30
-#define DB_VAL_H
31
-
32
-#include <time.h>
33
-#include "../str.h"
34
-
35
-
36
-/*
37
- * Accepted value types
38
- */
39
-typedef enum {
40
-	DB_INT,        /* 32-bit integer */
41
-	DB_FLOAT,      /* 32-bit integer */
42
-        DB_DOUBLE,     /* double data type */
43
-	DB_STRING,     /* Zero-terminated string */
44
-	DB_STR,        /* str structure */
45
-	DB_DATETIME,   /* Date and time */
46
-	DB_BLOB,       /* Large binary object */
47
-	DB_BITMAP      /* Bitmap of flags */
48
-} db_type_t;
49
-
50
-
51
-/*
52
- * Column value structure
53
- */
54
-typedef struct {
55
-	db_type_t type;                /* Type of the value */
56
-	int nul;                       /* Means that the column in database
57
-					* has no value 
58
-					*/
59
-	union {
60
-		int           int_val;    /* integer value */
61
-		float         float_val;  /* float value */
62
-		double        double_val; /* double value */
63
-		time_t        time_val;   /* unix time value */
64
-		const char*   string_val; /* NULL terminated string */
65
-		str           str_val;    /* str string value */
66
-		str           blob_val;   /* Blob data */
67
-		unsigned int  bitmap_val; /* Bitmap data type, 32 flags, should be enough */ 
68
-		long long     int8_val;   /* 8-byte integer */
69
-	} val;                            /* union of all possible types */
70
-} db_val_t;
71
-
72
-
73
-/*
74
- * Useful macros for accessing attributes of db_val structure
75
- */
76
-#define VAL_TYPE(dv)   ((dv)->type)
77
-#define VAL_NULL(dv)   ((dv)->nul)
78
-#define VAL_INT(dv)    ((dv)->val.int_val)
79
-#define VAL_FLOAT(dv)  ((dv)->val.float_val)
80
-#define VAL_DOUBLE(dv) ((dv)->val.double_val)
81
-#define VAL_TIME(dv)   ((dv)->val.time_val)
82
-#define VAL_STRING(dv) ((dv)->val.string_val)
83
-#define VAL_STR(dv)    ((dv)->val.str_val)
84
-#define VAL_BLOB(dv)   ((dv)->val.blob_val)
85
-#define VAL_BITMAP(dv) ((dv)->val.bitmap_val)
86
-
87
-
88
-#endif /* DB_VAL_H */
Browse code

- DB_FLOAT support - fixed error in params_add in postgres module

Jan Janak authored on 10/01/2006 22:16:08
Showing 1 changed files
... ...
@@ -38,6 +38,7 @@
38 38
  */
39 39
 typedef enum {
40 40
 	DB_INT,        /* 32-bit integer */
41
+	DB_FLOAT,      /* 32-bit integer */
41 42
         DB_DOUBLE,     /* double data type */
42 43
 	DB_STRING,     /* Zero-terminated string */
43 44
 	DB_STR,        /* str structure */
... ...
@@ -57,6 +58,7 @@ typedef struct {
57 58
 					*/
58 59
 	union {
59 60
 		int           int_val;    /* integer value */
61
+		float         float_val;  /* float value */
60 62
 		double        double_val; /* double value */
61 63
 		time_t        time_val;   /* unix time value */
62 64
 		const char*   string_val; /* NULL terminated string */
... ...
@@ -74,6 +76,7 @@ typedef struct {
74 76
 #define VAL_TYPE(dv)   ((dv)->type)
75 77
 #define VAL_NULL(dv)   ((dv)->nul)
76 78
 #define VAL_INT(dv)    ((dv)->val.int_val)
79
+#define VAL_FLOAT(dv)  ((dv)->val.float_val)
77 80
 #define VAL_DOUBLE(dv) ((dv)->val.double_val)
78 81
 #define VAL_TIME(dv)   ((dv)->val.time_val)
79 82
 #define VAL_STRING(dv) ((dv)->val.string_val)
Browse code

- int8_val for type conversions

Jan Janak authored on 27/10/2005 23:19:35
Showing 1 changed files
... ...
@@ -63,6 +63,7 @@ typedef struct {
63 63
 		str           str_val;    /* str string value */
64 64
 		str           blob_val;   /* Blob data */
65 65
 		unsigned int  bitmap_val; /* Bitmap data type, 32 flags, should be enough */ 
66
+		long long     int8_val;   /* 8-byte integer */
66 67
 	} val;                            /* union of all possible types */
67 68
 } db_val_t;
68 69
 
Browse code

- Spelling checked - READMEs updated

Jan Janak authored on 24/08/2004 08:45:09
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /* 
2 2
  * $Id$ 
3 3
  *
4
- * Copyright (C) 2001-2003 Fhg Fokus
4
+ * Copyright (C) 2001-2003 FhG Fokus
5 5
  *
6 6
  * This file is part of ser, a free SIP server.
7 7
  *
Browse code

- Removed obsolete function declarations

Jan Janak authored on 24/10/2003 20:33:45
Showing 1 changed files
... ...
@@ -34,16 +34,16 @@
34 34
 
35 35
 
36 36
 /*
37
- * Accepted column types
37
+ * Accepted value types
38 38
  */
39 39
 typedef enum {
40
-	DB_INT,
41
-        DB_DOUBLE,
42
-	DB_STRING,
43
-	DB_STR,
44
-	DB_DATETIME,
45
-	DB_BLOB,
46
-	DB_BITMAP
40
+	DB_INT,        /* 32-bit integer */
41
+        DB_DOUBLE,     /* double data type */
42
+	DB_STRING,     /* Zero-terminated string */
43
+	DB_STR,        /* str structure */
44
+	DB_DATETIME,   /* Date and time */
45
+	DB_BLOB,       /* Large binary object */
46
+	DB_BITMAP      /* Bitmap of flags */
47 47
 } db_type_t;
48 48
 
49 49
 
... ...
@@ -70,7 +70,6 @@ typedef struct {
70 70
 /*
71 71
  * Useful macros for accessing attributes of db_val structure
72 72
  */
73
-
74 73
 #define VAL_TYPE(dv)   ((dv)->type)
75 74
 #define VAL_NULL(dv)   ((dv)->nul)
76 75
 #define VAL_INT(dv)    ((dv)->val.int_val)
... ...
@@ -82,16 +81,4 @@ typedef struct {
82 81
 #define VAL_BITMAP(dv) ((dv)->val.bitmap_val)
83 82
 
84 83
 
85
-/*
86
- * Convert string to given type
87
- */
88
-int str2val(db_type_t _t, db_val_t* _v, const char* _s, int _l);
89
-
90
-
91
-/*
92
- * Convert given type to string
93
- */
94
-int val2str(db_val_t* _v, char* _s, int* _len);
95
-
96
-
97 84
 #endif /* DB_VAL_H */
Browse code

- DB_BITMAP data type added

Jan Janak authored on 15/09/2003 22:34:28
Showing 1 changed files
... ...
@@ -42,7 +42,8 @@ typedef enum {
42 42
 	DB_STRING,
43 43
 	DB_STR,
44 44
 	DB_DATETIME,
45
-	DB_BLOB
45
+	DB_BLOB,
46
+	DB_BITMAP
46 47
 } db_type_t;
47 48
 
48 49
 
... ...
@@ -52,15 +53,17 @@ typedef enum {
52 53
 typedef struct {
53 54
 	db_type_t type;                /* Type of the value */
54 55
 	int nul;                       /* Means that the column in database
55
-									  has no value */
56
+					* has no value 
57
+					*/
56 58
 	union {
57
-		int          int_val;    /* integer value */
58
-		double       double_val; /* double value */
59
-		time_t       time_val;   /* unix time value */
60
-		const char*  string_val; /* NULL terminated string */
61
-		str          str_val;    /* str string value */
62
-		str          blob_val;   /* Blob data */
63
-	} val;                       /* union of all possible types */
59
+		int           int_val;    /* integer value */
60
+		double        double_val; /* double value */
61
+		time_t        time_val;   /* unix time value */
62
+		const char*   string_val; /* NULL terminated string */
63
+		str           str_val;    /* str string value */
64
+		str           blob_val;   /* Blob data */
65
+		unsigned int  bitmap_val; /* Bitmap data type, 32 flags, should be enough */ 
66
+	} val;                            /* union of all possible types */
64 67
 } db_val_t;
65 68
 
66 69
 
... ...
@@ -76,6 +79,7 @@ typedef struct {
76 79
 #define VAL_STRING(dv) ((dv)->val.string_val)
77 80
 #define VAL_STR(dv)    ((dv)->val.str_val)
78 81
 #define VAL_BLOB(dv)   ((dv)->val.blob_val)
82
+#define VAL_BITMAP(dv) ((dv)->val.bitmap_val)
79 83
 
80 84
 
81 85
 /*
Browse code

- cosmetic changes (lines too long a.s.o)

Andrei Pelinescu-Onciul authored on 20/09/2002 09:29:07
Showing 1 changed files
... ...
@@ -50,8 +50,9 @@ typedef enum {
50 50
  * Column value structure
51 51
  */
52 52
 typedef struct {
53
-	db_type_t type;                  /* Type of the value */
54
-	int nul;                         /* Means that the column in database has no value */
53
+	db_type_t type;                /* Type of the value */
54
+	int nul;                       /* Means that the column in database
55
+									  has no value */
55 56
 	union {
56 57
 		int          int_val;    /* integer value */
57 58
 		double       double_val; /* double value */
... ...
@@ -59,7 +60,7 @@ typedef struct {
59 60
 		const char*  string_val; /* NULL terminated string */
60 61
 		str          str_val;    /* str string value */
61 62
 		str          blob_val;   /* Blob data */
62
-	} val;                           /* union of all possible types */
63
+	} val;                       /* union of all possible types */
63 64
 } db_val_t;
64 65
 
65 66
 
Browse code

GPLization banner introduced to *.[hc] files

Jiri Kuthan authored on 19/09/2002 12:23:52
Showing 1 changed files
... ...
@@ -1,7 +1,31 @@
1 1
 /* 
2 2
  * $Id$ 
3
+ *
4
+ * Copyright (C) 2001-2003 Fhg Fokus
5
+ *
6
+ * This file is part of ser, a free SIP server.
7
+ *
8
+ * ser is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * For a license to use the ser software under conditions
14
+ * other than those described here, or to purchase support for this
15
+ * software, please contact iptel.org by e-mail at the following addresses:
16
+ *    info@iptel.org
17
+ *
18
+ * ser is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License 
24
+ * along with this program; if not, write to the Free Software 
25
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
3 26
  */
4 27
 
28
+
5 29
 #ifndef DB_VAL_H
6 30
 #define DB_VAL_H
7 31
 
Browse code

db_con internals changed a little bit

Jan Janak authored on 12/08/2002 11:23:17
Showing 1 changed files
... ...
@@ -65,4 +65,4 @@ int str2val(db_type_t _t, db_val_t* _v, const char* _s, int _l);
65 65
 int val2str(db_val_t* _v, char* _s, int* _len);
66 66
 
67 67
 
68
-#endif
68
+#endif /* DB_VAL_H */
Browse code

Return values changed, blob support added

Jan Janak authored on 08/08/2002 17:25:32
Showing 1 changed files
... ...
@@ -17,7 +17,8 @@ typedef enum {
17 17
         DB_DOUBLE,
18 18
 	DB_STRING,
19 19
 	DB_STR,
20
-	DB_DATETIME
20
+	DB_DATETIME,
21
+	DB_BLOB
21 22
 } db_type_t;
22 23
 
23 24
 
... ...
@@ -33,6 +34,7 @@ typedef struct {
33 34
 		time_t       time_val;   /* unix time value */
34 35
 		const char*  string_val; /* NULL terminated string */
35 36
 		str          str_val;    /* str string value */
37
+		str          blob_val;   /* Blob data */
36 38
 	} val;                           /* union of all possible types */
37 39
 } db_val_t;
38 40
 
... ...
@@ -48,12 +50,13 @@ typedef struct {
48 50
 #define VAL_TIME(dv)   ((dv)->val.time_val)
49 51
 #define VAL_STRING(dv) ((dv)->val.string_val)
50 52
 #define VAL_STR(dv)    ((dv)->val.str_val)
53
+#define VAL_BLOB(dv)   ((dv)->val.blob_val)
51 54
 
52 55
 
53 56
 /*
54 57
  * Convert string to given type
55 58
  */
56
-int str2val(db_type_t _t, db_val_t* _v, const char* _s);
59
+int str2val(db_type_t _t, db_val_t* _v, const char* _s, int _l);
57 60
 
58 61
 
59 62
 /*
Browse code

str structure is supported now.

Jan Janak authored on 06/08/2002 11:11:45
Showing 1 changed files
... ...
@@ -6,6 +6,7 @@
6 6
 #define DB_VAL_H
7 7
 
8 8
 #include <time.h>
9
+#include "../str.h"
9 10
 
10 11
 
11 12
 /*
... ...
@@ -15,6 +16,7 @@ typedef enum {
15 16
 	DB_INT,
16 17
         DB_DOUBLE,
17 18
 	DB_STRING,
19
+	DB_STR,
18 20
 	DB_DATETIME
19 21
 } db_type_t;
20 22
 
... ...
@@ -30,6 +32,7 @@ typedef struct {
30 32
 		double       double_val; /* double value */
31 33
 		time_t       time_val;   /* unix time value */
32 34
 		const char*  string_val; /* NULL terminated string */
35
+		str          str_val;    /* str string value */
33 36
 	} val;                           /* union of all possible types */
34 37
 } db_val_t;
35 38
 
... ...
@@ -44,6 +47,7 @@ typedef struct {
44 47
 #define VAL_DOUBLE(dv) ((dv)->val.double_val)
45 48
 #define VAL_TIME(dv)   ((dv)->val.time_val)
46 49
 #define VAL_STRING(dv) ((dv)->val.string_val)
50
+#define VAL_STR(dv)    ((dv)->val.str_val)
47 51
 
48 52
 
49 53
 /*
Browse code

Header files split

Jan Janak authored on 24/07/2002 14:45:10
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,61 @@
1
+/* 
2
+ * $Id$ 
3
+ */
4
+
5
+#ifndef DB_VAL_H
6
+#define DB_VAL_H
7
+
8
+#include <time.h>
9
+
10
+
11
+/*
12
+ * Accepted column types
13
+ */
14
+typedef enum {
15
+	DB_INT,
16
+        DB_DOUBLE,
17
+	DB_STRING,
18
+	DB_DATETIME
19
+} db_type_t;
20
+
21
+
22
+/*
23
+ * Column value structure
24
+ */
25
+typedef struct {
26
+	db_type_t type;                  /* Type of the value */
27
+	int nul;                         /* Means that the column in database has no value */
28
+	union {
29
+		int          int_val;    /* integer value */
30
+		double       double_val; /* double value */
31
+		time_t       time_val;   /* unix time value */
32
+		const char*  string_val; /* NULL terminated string */
33
+	} val;                           /* union of all possible types */
34
+} db_val_t;
35
+
36
+
37
+/*
38
+ * Useful macros for accessing attributes of db_val structure
39
+ */
40
+
41
+#define VAL_TYPE(dv)   ((dv)->type)
42
+#define VAL_NULL(dv)   ((dv)->nul)
43
+#define VAL_INT(dv)    ((dv)->val.int_val)
44
+#define VAL_DOUBLE(dv) ((dv)->val.double_val)
45
+#define VAL_TIME(dv)   ((dv)->val.time_val)
46
+#define VAL_STRING(dv) ((dv)->val.string_val)
47
+
48
+
49
+/*
50
+ * Convert string to given type
51
+ */
52
+int str2val(db_type_t _t, db_val_t* _v, const char* _s);
53
+
54
+
55
+/*
56
+ * Convert given type to string
57
+ */
58
+int val2str(db_val_t* _v, char* _s, int* _len);
59
+
60
+
61
+#endif