Browse code

Example extended

Jan Janak authored on 09/08/2002 18:31:31
Showing 1 changed files
... ...
@@ -96,7 +96,7 @@ struct module_exports* mod_register()
96 96
 	     /*
97 97
 	      * Column names of table location
98 98
 	      */
99
-	db_key_t keys1[] = {"user", "contact", "q", "expire" };
99
+	db_key_t keys1[] = {"user", "contact", "q", "expire", "opaque" };
100 100
 	db_key_t keys2[] = {"user", "q"};
101 101
 	db_key_t keys3[] = {"user", "contact"};
102 102
 	db_key_t keys4[] = {"contact", "q"};
... ...
@@ -105,21 +105,24 @@ struct module_exports* mod_register()
105 105
 		{ DB_STRING  , 0, { .string_val = "foo@bar.com" }              },
106 106
 		{ DB_STR     , 0, { .str_val    = { "real@foo.bar.com", 18 } } },
107 107
 		{ DB_DOUBLE  , 0, { .double_val = 1.2 }                        },
108
-		{ DB_DATETIME, 0, { .time_val   = 439826493 }                  }
108
+		{ DB_DATETIME, 0, { .time_val   = 439826493 }                  },
109
+		{ DB_BLOB    , 0, { .blob_val   = { "hdslgkhas\0glksf", 17 } } }
109 110
 	};
110 111
 
111 112
 	db_val_t vals2[] = { 
112 113
 		{ DB_STRING  , 0, { .string_val = "foo2@bar2.com" }              },
113 114
 		{ DB_STR     , 0, { .str_val    = { "real2@foo.bar2.com", 18 } } },
114 115
 		{ DB_DOUBLE  , 0, { .double_val = 1.3 }                          },
115
-		{ DB_DATETIME, 0, { .time_val   = 12345 }                        }
116
+		{ DB_DATETIME, 0, { .time_val   = 12345 }                        },
117
+		{ DB_BLOB    , 0, { .blob_val   = { "\0a\0balkdfj", 10 }       } }
116 118
 	};
117 119
 
118 120
 	db_val_t vals3[] = { 
119 121
 		{ DB_STRING  , 0, { .string_val = "foo3@bar3.com" }              },
120 122
 		{ DB_STR     , 0, { .str_val    = { "real3@foo.bar3.com", 18 } } },
121 123
 		{ DB_DOUBLE  , 0, { .double_val = 1.5 }                          },
122
-		{ DB_DATETIME, 0, { .time_val   = 123456 }                       }
124
+		{ DB_DATETIME, 0, { .time_val   = 123456 }                       },
125
+		{ DB_BLOB    , 0, { .blob_val   = { "halgkasdg\'", 10 }        } }
123 126
 	};
124 127
 
125 128
 	db_val_t vals4[] = {
... ...
@@ -181,17 +184,17 @@ struct module_exports* mod_register()
181 184
 		return &dbex_exports;
182 185
 	}
183 186
 
184
-	if (db_insert(h, keys1, vals1, 4) < 0) {
187
+	if (db_insert(h, keys1, vals1, 5) < 0) {
185 188
 		fprintf(stderr, "Error while inserting line 1\n");
186 189
 		return &dbex_exports;
187 190
 	}
188 191
 
189
-	if (db_insert(h, keys1, vals2, 4) < 0) {
192
+	if (db_insert(h, keys1, vals2, 5) < 0) {
190 193
 		fprintf(stderr, "Error while inserting line 2\n");
191 194
 		return &dbex_exports;
192 195
 	}
193 196
 
194
-	if (db_insert(h, keys1, vals3, 4) < 0) {
197
+	if (db_insert(h, keys1, vals3, 5) < 0) {
195 198
 		fprintf(stderr, "Error while inserting line 3\n");
196 199
 		return &dbex_exports;
197 200
 	}