Merge ktlim@zizzer:/bk/newmem
[gem5.git] / src / base / stats / mysql.cc
1 /*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Nathan Binkert
29 */
30
31 #include <cassert>
32 #include <map>
33 #include <sstream>
34 #include <string>
35 #include <vector>
36
37 #include "base/misc.hh"
38 #include "base/mysql.hh"
39 #include "base/statistics.hh"
40 #include "base/stats/flags.hh"
41 #include "base/stats/mysql.hh"
42 #include "base/stats/mysql_run.hh"
43 #include "base/stats/statdb.hh"
44 #include "base/stats/types.hh"
45 #include "base/str.hh"
46 #include "sim/host.hh"
47
48 using namespace std;
49
50 namespace Stats {
51
52 MySqlRun MySqlDB;
53
54 bool
55 MySqlConnected()
56 {
57 return MySqlDB.connected();
58 }
59
60 void
61 MySqlRun::connect(const string &host, const string &user, const string &passwd,
62 const string &db, const string &name, const string &sample,
63 const string &project)
64 {
65 if (connected())
66 panic("can only get one database connection at this time!");
67
68 mysql.connect(host, user, passwd, db);
69 if (mysql.error)
70 panic("could not connect to database server\n%s\n", mysql.error);
71
72 if (mysql.autocommit(false))
73 panic("could not set autocommit\n%s\n", mysql.error);
74
75 remove(name);
76 //cleanup();
77 setup(name, sample, user, project);
78 }
79
80 void
81 MySqlRun::setup(const string &name, const string &sample, const string &user,
82 const string &project)
83 {
84 assert(mysql.connected());
85
86 stringstream insert;
87 ccprintf(insert,
88 "INSERT INTO "
89 "runs(rn_name,rn_sample,rn_user,rn_project,rn_date,rn_expire)"
90 "values(\"%s\", \"%s\", \"%s\", \"%s\", NOW(),"
91 "DATE_ADD(CURDATE(), INTERVAL 31 DAY))",
92 name, sample, user, project);
93
94 mysql.query(insert);
95 if (mysql.error)
96 panic("could not get a run\n%s\n", mysql.error);
97
98 run_id = mysql.insert_id();
99 if (mysql.commit())
100 panic("could not commit transaction\n%s\n", mysql.error);
101 }
102
103 void
104 MySqlRun::remove(const string &name)
105 {
106 assert(mysql.connected());
107 stringstream sql;
108 ccprintf(sql, "DELETE FROM runs WHERE rn_name=\"%s\"", name);
109 mysql.query(sql);
110 if (mysql.error)
111 panic("could not delete run\n%s\n", mysql.error);
112 if (mysql.commit())
113 panic("could not commit transaction\n%s\n", mysql.error);
114 }
115
116 void
117 MySqlRun::cleanup()
118 {
119 assert(mysql.connected());
120
121 mysql.query("DELETE data "
122 "FROM data "
123 "LEFT JOIN runs ON dt_run=rn_id "
124 "WHERE rn_id IS NULL");
125
126 if (mysql.commit())
127 panic("could not commit transaction\n%s\n", mysql.error);
128
129 mysql.query("DELETE formula_ref "
130 "FROM formula_ref "
131 "LEFT JOIN runs ON fr_run=rn_id "
132 "WHERE rn_id IS NULL");
133
134 if (mysql.commit())
135 panic("could not commit transaction\n%s\n", mysql.error);
136
137 mysql.query("DELETE formulas "
138 "FROM formulas "
139 "LEFT JOIN formula_ref ON fm_stat=fr_stat "
140 "WHERE fr_stat IS NULL");
141
142 if (mysql.commit())
143 panic("could not commit transaction\n%s\n", mysql.error);
144
145 mysql.query("DELETE stats "
146 "FROM stats "
147 "LEFT JOIN data ON st_id=dt_stat "
148 "WHERE dt_stat IS NULL");
149
150 if (mysql.commit())
151 panic("could not commit transaction\n%s\n", mysql.error);
152
153 mysql.query("DELETE subdata "
154 "FROM subdata "
155 "LEFT JOIN data ON sd_stat=dt_stat "
156 "WHERE dt_stat IS NULL");
157
158 if (mysql.commit())
159 panic("could not commit transaction\n%s\n", mysql.error);
160
161 mysql.query("DELETE bins "
162 "FROM bins "
163 "LEFT JOIN data ON bn_id=dt_bin "
164 "WHERE dt_bin IS NULL");
165
166 if (mysql.commit())
167 panic("could not commit transaction\n%s\n", mysql.error);
168
169 mysql.query("DELETE events"
170 "FROM events"
171 "LEFT JOIN runs ON ev_run=rn_id"
172 "WHERE rn_id IS NULL");
173
174 if (mysql.commit())
175 panic("could not commit transaction\n%s\n", mysql.error);
176
177 mysql.query("DELETE event_names"
178 "FROM event_names"
179 "LEFT JOIN events ON en_id=ev_event"
180 "WHERE ev_event IS NULL");
181
182 if (mysql.commit())
183 panic("could not commit transaction\n%s\n", mysql.error);
184 }
185
186 void
187 SetupStat::init()
188 {
189 name = "";
190 descr = "";
191 type = "";
192 print = false;
193 prereq = 0;
194 prec = -1;
195 nozero = false;
196 nonan = false;
197 total = false;
198 pdf = false;
199 cdf = false;
200 min = 0;
201 max = 0;
202 bktsize = 0;
203 size = 0;
204 }
205
206 unsigned
207 SetupStat::setup()
208 {
209 MySQL::Connection &mysql = MySqlDB.conn();
210
211 stringstream insert;
212 ccprintf(insert,
213 "INSERT INTO "
214 "stats(st_name, st_descr, st_type, st_print, st_prereq, "
215 "st_prec, st_nozero, st_nonan, st_total, st_pdf, st_cdf, "
216 "st_min, st_max, st_bktsize, st_size)"
217 "values(\"%s\",\"%s\",\"%s\","
218 " %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",
219 name, descr, type, print, prereq, (int)prec, nozero, nonan,
220 total, pdf, cdf,
221 min, max, bktsize, size);
222
223 mysql.query(insert);
224 if (!mysql.error) {
225 int id = mysql.insert_id();
226 if (mysql.commit())
227 panic("could not commit transaction\n%s\n", mysql.error);
228 return id;
229 }
230
231 stringstream select;
232 ccprintf(select, "SELECT * FROM stats WHERE st_name=\"%s\"", name);
233
234 mysql.query(select);
235 MySQL::Result result = mysql.store_result();
236 if (!result)
237 panic("could not find stat\n%s\n", mysql.error);
238
239 assert(result.num_fields() == 16);
240 MySQL::Row row = result.fetch_row();
241 if (!row)
242 panic("could not get stat row\n%s\n", mysql.error);
243
244 bool tb;
245 int8_t ti8;
246 uint16_t tu16;
247 int64_t ti64;
248 uint64_t tu64;
249
250 if (name != (char *)row[1])
251 panic("failed stat check on %s:name. %s != %s\n",
252 name, name, row[1]);
253
254 if (descr != (char *)row[2])
255 panic("failed stat check on %s:descr. %s != %s\n",
256 name, descr, row[2]);
257
258 if (type != (char *)row[3])
259 panic("failed stat check on %s:type. %s != %s\n",
260 name, type, row[3]);
261
262 if (!to_number(row[4], tb) || print != tb)
263 panic("failed stat check on %s:print. %d != %d\n",
264 name, print, tb);
265
266 if (!to_number(row[6], ti8) || prec != ti8)
267 panic("failed stat check on %s:prec. %d != %d\n",
268 name, prec, ti8);
269
270 if (!to_number(row[7], tb) || nozero != tb)
271 panic("failed stat check on %s:nozero. %d != %d\n",
272 name, nozero, tb);
273
274 if (!to_number(row[8], tb) || nonan != tb)
275 panic("failed stat check on %s:nonan. %d != %d\n",
276 name, nonan, tb);
277
278 if (!to_number(row[9], tb) || total != tb)
279 panic("failed stat check on %s:total. %d != %d\n",
280 name, total, tb);
281
282 if (!to_number(row[10], tb) || pdf != tb)
283 panic("failed stat check on %s:pdf. %d != %d\n",
284 name, pdf, tb);
285
286 if (!to_number(row[11], tb) || cdf != tb)
287 panic("failed stat check on %s:cdf. %d != %d\n",
288 name, cdf, tb);
289
290 if (!to_number(row[12], ti64) || min != ti64)
291 panic("failed stat check on %s:min. %d != %d\n",
292 name, min, ti64);
293
294 if (!to_number(row[13], ti64) || max != ti64)
295 panic("failed stat check on %s:max. %d != %d\n",
296 name, max, ti64);
297
298 if (!to_number(row[14], tu64) || bktsize != tu64)
299 panic("failed stat check on %s:bktsize. %d != %d\n",
300 name, bktsize, tu64);
301
302 if (!to_number(row[15], tu16) || size != tu16)
303 panic("failed stat check on %s:size. %d != %d\n",
304 name, size, tu16);
305
306 to_number(row[5], prereq);
307 uint16_t statid;
308 to_number(row[0], statid);
309 return statid;
310 }
311
312 unsigned
313 SetupBin(const string &bin)
314 {
315 static map<string, int> binmap;
316
317 using namespace MySQL;
318 map<string,int>::const_iterator i = binmap.find(bin);
319 if (i != binmap.end())
320 return (*i).second;
321
322 Connection &mysql = MySqlDB.conn();
323 assert(mysql.connected());
324
325 uint16_t bin_id;
326
327 stringstream select;
328 stringstream insert;
329 ccprintf(select, "SELECT bn_id FROM bins WHERE bn_name=\"%s\"", bin);
330
331 mysql.query(select);
332 MySQL::Result result = mysql.store_result();
333 if (result) {
334 assert(result.num_fields() == 1);
335 MySQL::Row row = result.fetch_row();
336 if (row) {
337 to_number(row[0], bin_id);
338 goto exit;
339 }
340 }
341
342 ccprintf(insert, "INSERT INTO bins(bn_name) values(\"%s\")", bin);
343
344 mysql.query(insert);
345 if (mysql.error)
346 panic("could not get a bin\n%s\n", mysql.error);
347
348 bin_id = mysql.insert_id();
349 if (mysql.commit())
350 panic("could not commit transaction\n%s\n", mysql.error);
351
352 binmap.insert(make_pair(bin, bin_id));
353
354 exit:
355 return bin_id;
356 }
357
358 InsertData::InsertData()
359 {
360 query = new char[maxsize + 1];
361 size = 0;
362 flush();
363 }
364
365 InsertData::~InsertData()
366 {
367 delete [] query;
368 }
369
370 void
371 InsertData::flush()
372 {
373 if (size) {
374 MySQL::Connection &mysql = MySqlDB.conn();
375 assert(mysql.connected());
376 mysql.query(query);
377 if (mysql.error)
378 panic("could not insert data\n%s\n", mysql.error);
379 if (mysql.commit())
380 panic("could not commit transaction\n%s\n", mysql.error);
381 }
382
383 query[0] = '\0';
384 size = 0;
385 first = true;
386 strcpy(query, "INSERT INTO "
387 "data(dt_stat,dt_x,dt_y,dt_run,dt_tick,dt_bin,dt_data) "
388 "values");
389 size = strlen(query);
390 }
391
392 void
393 InsertData::insert()
394 {
395 if (size + 1024 > maxsize)
396 flush();
397
398 if (!first) {
399 query[size++] = ',';
400 query[size] = '\0';
401 }
402
403 first = false;
404
405 size += sprintf(query + size, "(%u,%d,%d,%u,%llu,%u,\"%f\")",
406 stat, x, y, MySqlDB.run(), (unsigned long long)tick,
407 bin, data);
408 }
409
410 struct InsertSubData
411 {
412 uint16_t stat;
413 int16_t x;
414 int16_t y;
415 string name;
416 string descr;
417
418 void setup();
419 };
420
421 void
422 InsertSubData::setup()
423 {
424 MySQL::Connection &mysql = MySqlDB.conn();
425 assert(mysql.connected());
426 stringstream insert;
427 ccprintf(insert,
428 "INSERT INTO subdata(sd_stat,sd_x,sd_y,sd_name,sd_descr) "
429 "values(%d,%d,%d,\"%s\",\"%s\")",
430 stat, x, y, name, descr);
431
432 mysql.query(insert);
433 // if (mysql.error)
434 // panic("could not insert subdata\n%s\n", mysql.error);
435
436 if (mysql.commit())
437 panic("could not commit transaction\n%s\n", mysql.error);
438 }
439
440 void
441 InsertFormula(uint16_t stat, const string &formula)
442 {
443 MySQL::Connection &mysql = MySqlDB.conn();
444 assert(mysql.connected());
445 stringstream insert_formula;
446 ccprintf(insert_formula,
447 "INSERT INTO formulas(fm_stat,fm_formula) values(%d, \"%s\")",
448 stat, formula);
449
450 mysql.query(insert_formula);
451 // if (mysql.error)
452 // panic("could not insert formula\n%s\n", mysql.error);
453
454 stringstream insert_ref;
455 ccprintf(insert_ref,
456 "INSERT INTO formula_ref(fr_stat,fr_run) values(%d, %d)",
457 stat, MySqlDB.run());
458
459 mysql.query(insert_ref);
460 // if (mysql.error)
461 // panic("could not insert formula reference\n%s\n", mysql.error);
462
463 if (mysql.commit())
464 panic("could not commit transaction\n%s\n", mysql.error);
465 }
466
467 void
468 UpdatePrereq(uint16_t stat, uint16_t prereq)
469 {
470 MySQL::Connection &mysql = MySqlDB.conn();
471 assert(mysql.connected());
472 stringstream update;
473 ccprintf(update, "UPDATE stats SET st_prereq=%d WHERE st_id=%d",
474 prereq, stat);
475 mysql.query(update);
476 if (mysql.error)
477 panic("could not update prereq\n%s\n", mysql.error);
478
479 if (mysql.commit())
480 panic("could not commit transaction\n%s\n", mysql.error);
481 }
482
483 void
484 MySql::configure()
485 {
486 /*
487 * set up all stats!
488 */
489 using namespace Database;
490
491 MySQL::Connection &mysql = MySqlDB.conn();
492
493 stat_list_t::const_iterator i, end = stats().end();
494 for (i = stats().begin(); i != end; ++i) {
495 (*i)->visit(*this);
496 }
497
498 for (i = stats().begin(); i != end; ++i) {
499 StatData *data = *i;
500 if (data->prereq) {
501 uint16_t stat_id = find(data->id);
502 uint16_t prereq_id = find(data->prereq->id);
503 assert(stat_id && prereq_id);
504
505 UpdatePrereq(stat_id, prereq_id);
506 }
507 }
508
509 if (mysql.commit())
510 panic("could not commit transaction\n%s\n", mysql.error);
511
512 configured = true;
513 }
514
515
516 bool
517 MySql::configure(const StatData &data, string type)
518 {
519 stat.init();
520 stat.name = data.name;
521 stat.descr = data.desc;
522 stat.type = type;
523 stat.print = data.flags & print;
524 stat.prec = data.precision;
525 stat.nozero = data.flags & nozero;
526 stat.nonan = data.flags & nonan;
527 stat.total = data.flags & total;
528 stat.pdf = data.flags & pdf;
529 stat.cdf = data.flags & cdf;
530
531 return stat.print;
532 }
533
534 void
535 MySql::configure(const ScalarData &data)
536 {
537 if (!configure(data, "SCALAR"))
538 return;
539
540 insert(data.id, stat.setup());
541 }
542
543 void
544 MySql::configure(const VectorData &data)
545 {
546 if (!configure(data, "VECTOR"))
547 return;
548
549 uint16_t statid = stat.setup();
550
551 if (!data.subnames.empty()) {
552 InsertSubData subdata;
553 subdata.stat = statid;
554 subdata.y = 0;
555 for (int i = 0; i < data.subnames.size(); ++i) {
556 subdata.x = i;
557 subdata.name = data.subnames[i];
558 subdata.descr = data.subdescs.empty() ? "" : data.subdescs[i];
559
560 if (!subdata.name.empty() || !subdata.descr.empty())
561 subdata.setup();
562 }
563 }
564
565 insert(data.id, statid);
566 }
567
568 void
569 MySql::configure(const DistData &data)
570 {
571 if (!configure(data, "DIST"))
572 return;
573
574 if (!data.data.fancy) {
575 stat.size = data.data.size;
576 stat.min = data.data.min;
577 stat.max = data.data.max;
578 stat.bktsize = data.data.bucket_size;
579 }
580 insert(data.id, stat.setup());
581 }
582
583 void
584 MySql::configure(const VectorDistData &data)
585 {
586 if (!configure(data, "VECTORDIST"))
587 return;
588
589 if (!data.data[0].fancy) {
590 stat.size = data.data[0].size;
591 stat.min = data.data[0].min;
592 stat.max = data.data[0].max;
593 stat.bktsize = data.data[0].bucket_size;
594 }
595
596 uint16_t statid = stat.setup();
597
598 if (!data.subnames.empty()) {
599 InsertSubData subdata;
600 subdata.stat = statid;
601 subdata.y = 0;
602 for (int i = 0; i < data.subnames.size(); ++i) {
603 subdata.x = i;
604 subdata.name = data.subnames[i];
605 subdata.descr = data.subdescs.empty() ? "" : data.subdescs[i];
606 if (!subdata.name.empty() || !subdata.descr.empty())
607 subdata.setup();
608 }
609 }
610
611 insert(data.id, statid);
612 }
613
614 void
615 MySql::configure(const Vector2dData &data)
616 {
617 if (!configure(data, "VECTOR2D"))
618 return;
619
620 uint16_t statid = stat.setup();
621
622 if (!data.subnames.empty()) {
623 InsertSubData subdata;
624 subdata.stat = statid;
625 subdata.y = -1;
626 for (int i = 0; i < data.subnames.size(); ++i) {
627 subdata.x = i;
628 subdata.name = data.subnames[i];
629 subdata.descr = data.subdescs.empty() ? "" : data.subdescs[i];
630 if (!subdata.name.empty() || !subdata.descr.empty())
631 subdata.setup();
632 }
633 }
634
635 if (!data.y_subnames.empty()) {
636 InsertSubData subdata;
637 subdata.stat = statid;
638 subdata.x = -1;
639 subdata.descr = "";
640 for (int i = 0; i < data.y_subnames.size(); ++i) {
641 subdata.y = i;
642 subdata.name = data.y_subnames[i];
643 if (!subdata.name.empty())
644 subdata.setup();
645 }
646 }
647
648 insert(data.id, statid);
649 }
650
651 void
652 MySql::configure(const FormulaData &data)
653 {
654 configure(data, "FORMULA");
655 insert(data.id, stat.setup());
656 InsertFormula(find(data.id), data.str());
657 }
658
659 void
660 MySql::output(MainBin *bin)
661 {
662 MySQL::Connection &mysql = MySqlDB.conn();
663
664 if (bin) {
665 bin->activate();
666 newdata.bin = SetupBin(bin->name());
667 } else {
668 newdata.bin = 0;
669 }
670
671 Database::stat_list_t::const_iterator i, end = Database::stats().end();
672 for (i = Database::stats().begin(); i != end; ++i) {
673 StatData *stat = *i;
674 if (bin && stat->binned() || !bin && !stat->binned()) {
675 stat->visit(*this);
676 if (mysql.commit())
677 panic("could not commit transaction\n%s\n", mysql.error);
678 }
679 }
680 }
681
682 bool
683 MySql::valid() const
684 {
685 return MySqlDB.connected();
686 }
687
688 void
689 MySql::output()
690 {
691 using namespace Database;
692 assert(valid());
693
694 if (!configured)
695 configure();
696
697 // store sample #
698 newdata.tick = curTick;
699
700 output(NULL);
701 if (!bins().empty()) {
702 bin_list_t::iterator i, end = bins().end();
703 for (i = bins().begin(); i != end; ++i)
704 output(*i);
705 }
706
707 newdata.flush();
708 }
709
710 void
711 MySql::output(const ScalarData &data)
712 {
713 if (!(data.flags & print))
714 return;
715
716 newdata.stat = find(data.id);
717 newdata.x = 0;
718 newdata.y = 0;
719 newdata.data = data.value();
720
721 newdata.insert();
722 }
723
724 void
725 MySql::output(const VectorData &data)
726 {
727 if (!(data.flags & print))
728 return;
729
730 newdata.stat = find(data.id);
731 newdata.y = 0;
732
733 const VCounter &cvec = data.value();
734 int size = data.size();
735 for (int x = 0; x < size; x++) {
736 newdata.x = x;
737 newdata.data = cvec[x];
738 newdata.insert();
739 }
740 }
741
742 void
743 MySql::output(const DistDataData &data)
744 {
745 const int db_sum = -1;
746 const int db_squares = -2;
747 const int db_samples = -3;
748 const int db_min_val = -4;
749 const int db_max_val = -5;
750 const int db_underflow = -6;
751 const int db_overflow = -7;
752
753 newdata.x = db_sum;
754 newdata.data = data.sum;
755 newdata.insert();
756
757 newdata.x = db_squares;
758 newdata.data = data.squares;
759 newdata.insert();
760
761 newdata.x = db_samples;
762 newdata.data = data.samples;
763 newdata.insert();
764
765 if (data.samples && !data.fancy) {
766 newdata.x = db_min_val;
767 newdata.data = data.min_val;
768 newdata.insert();
769
770 newdata.x = db_max_val;
771 newdata.data = data.max_val;
772 newdata.insert();
773
774 newdata.x = db_underflow;
775 newdata.data = data.underflow;
776 newdata.insert();
777
778 newdata.x = db_overflow;
779 newdata.data = data.overflow;
780 newdata.insert();
781
782 int size = data.cvec.size();
783 for (int x = 0; x < size; x++) {
784 newdata.x = x;
785 newdata.data = data.cvec[x];
786 newdata.insert();
787 }
788 }
789 }
790
791
792 void
793 MySql::output(const DistData &data)
794 {
795 if (!(data.flags & print))
796 return;
797
798 newdata.stat = find(data.id);
799 newdata.y = 0;
800 output(data.data);
801 }
802
803 void
804 MySql::output(const VectorDistData &data)
805 {
806 if (!(data.flags & print))
807 return;
808
809 newdata.stat = find(data.id);
810
811 int size = data.data.size();
812 for (int y = 0; y < size; ++y) {
813 newdata.y = y;
814 output(data.data[y]);
815 }
816 }
817
818 void
819 MySql::output(const Vector2dData &data)
820 {
821 if (!(data.flags & print))
822 return;
823
824 newdata.stat = find(data.id);
825
826 int index = 0;
827 for (int x = 0; x < data.x; x++) {
828 newdata.x = x;
829 for (int y = 0; y < data.y; y++) {
830 newdata.y = y;
831 newdata.data = data.cvec[index++];
832 newdata.insert();
833 }
834 }
835 }
836
837 void
838 MySql::output(const FormulaData &data)
839 {
840 }
841
842 /*
843 * Implement the visitor
844 */
845 void
846 MySql::visit(const ScalarData &data)
847 {
848 if (!configured)
849 configure(data);
850 else
851 output(data);
852 }
853
854 void
855 MySql::visit(const VectorData &data)
856 {
857 if (!configured)
858 configure(data);
859 else
860 output(data);
861 }
862
863 void
864 MySql::visit(const DistData &data)
865 {
866 return;
867 if (!configured)
868 configure(data);
869 else
870 output(data);
871 }
872
873 void
874 MySql::visit(const VectorDistData &data)
875 {
876 return;
877 if (!configured)
878 configure(data);
879 else
880 output(data);
881 }
882
883 void
884 MySql::visit(const Vector2dData &data)
885 {
886 return;
887 if (!configured)
888 configure(data);
889 else
890 output(data);
891 }
892
893 void
894 MySql::visit(const FormulaData &data)
895 {
896 if (!configured)
897 configure(data);
898 else
899 output(data);
900 }
901
902 /* namespace Stats */ }