String values discarded after calling Commit() method
"jacek.ruzyczka via metakit" <[email protected]> Sun, 13 Aug 2017 08:53:22 -0700 (PDT)
| Newsgroups | gmane.comp.db.metakit |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_4105_1405699641.1502639602082
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
String values I add into into a S column of a c4_View are apparently discar=
ded after calling the Commit() method from the C++ API. See this code:
#include <iostream>
#include <map>
#include <mk4.h>
#include "database.h"
using namespace std;
database::database (string file_name)
: connection_handler (file_name.c_str (), 1),
table_tracks (connection_handler.GetAs ("tracks [degrees:D, compass=
:S]"))
{
cout << "Opening database " << file_name << "." << endl;
if (table_tracks.GetSize () =3D=3D 0) {
c4_DoubleProp degrees ("degrees");
c4_StringProp compass ("compass");
c4_Row track;
int i;
string compass_points [17] =3D {"N", "NNE", "NE", "ENE",
"E", "ESE", "SE", "SSE",
"S", "SSW", "SW", "WSW",
"W", "WNW", "NW", "NNW",
"N"};
cout << "Database is vanilla. Setting it up now." << endl;
for (i =3D 0; i <=3D 16; i++) {
degrees (track) =3D 22.5 * (double) i;
compass (track) =3D (compass_points [i]).c_str ();
table_tracks.Add (track);
}
for (i =3D 0; i < table_tracks.GetSize (); i++) {
cout << (double) degrees (table_tracks [i]) << " " << (string) compas=
s (table_tracks [i]) << endl;
}
connection_handler.Commit ();
for (i =3D 0; i < table_tracks.GetSize (); i++) {
cout << (double) degrees (table_tracks [i]) << " " << (string) compas=
s (table_tracks [i]) << endl;
}
}
}
In the loop before the Commit(), I get the contents of both columns (#1 =E2=
=86=92 double; #2 =E2=86=92 string; hope I did the syntax right in the GetA=
s() method), but in the loop following the commit, the contents of column #=
2 don't appear any more!
My version of Metakit is 2.4.9.7 on a Raspberry Pi.
What's wrong here? Thank you for any useful hint.
------=_Part_4105_1405699641.1502639602082--