On Fri, Feb 08, 2008 at 01:08:13PM +0530, Yuvaraj Athur Raghuvir wrote:
I get an error in the second run.
Finally, I have managed to get the Mbeddded example working in VC++ 2005 Express Edition on Windows XP ! Thanks to the folks in the mailing list. Use Case: MonetDB5 , Embedded Mode , SQL To move towards the application I intend to experiment on, I need some more information: 1) How to make data durable? In the simple example, I tried the following: a) First Run: Create table and insert rows. Select to check if everything is ok. b) Second Run: Only perform selection 2) How to get meta data of the database? a) I want to know the size of the tables and meta tables in the data base. In particular I am interested in seeing the growth of the database on addition of content. The growth depends on your column types used. Ie if you use lets say integers, then each new row of 8 columns, would simply increase the storage requirements with 8 * 4 bytes. etc. b) Typically, there is a master table in the database that records information of the schema persisted. What is the name of the Master Table and its schema in MonetDB? You mean the table 'tables' ? A select * from tables gives you a list of all your tables. (see also schemas, columns , etc) c) SQLite has an independent analyzer tool which dumps the state of the storage from which I can extract most of the data I need. Does MonetDB have a similar mechanism? There is no storage analyzer for MonetDB. ~Yuva
code snippet >>>>> dbh = embedded_sql (set, setlen); if (dbh == NULL || mapi_error(dbh)) die(dbh, hdl); /* switch off autocommit */ if (mapi_setAutocommit(dbh, 0) != MOK || mapi_error(dbh)) Okay here you disabled autocommit, which is fine.
die(dbh,NULL); if ((hdl = mapi_query(dbh, "create table emp" " (name varchar(20),age int)")) == NULL || mapi_error(dbh)) die(dbh, hdl); close_handle(dbh,hdl); for(i=0; i< 1000; i++) { char query[100]; _snprintf(query, 100,"insert into emp values(\'user%d\', %d)", i, (i % 82)); if ((hdl = mapi_query(dbh, query)) == NULL || mapi_error(dbh)) die(dbh, hdl); close_handle(dbh,hdl); }
But then I would expect an 'commit;' here.
if ((hdl = mapi_query(dbh, "select * from emp")) == NULL || mapi_error(dbh)) die(dbh, hdl); i=0; while (mapi_fetch_row(hdl)) { char *age = mapi_fetch_field(hdl, 1); i= i+ atoi(age); } if (mapi_error(dbh)) die(dbh, hdl); close_handle(dbh,hdl); printf("The sum is %d \n",i); mapi_disconnect(dbh); return 0;
Niels
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Niels Nes, Centre for Mathematics and Computer Science (CWI) Kruislaan 413, 1098 SJ Amsterdam, The Netherlands room C0.02, phone ++31 20 592-4098, fax ++31 20 592-4312 url: http://www.cwi.nl/~niels e-mail: Niels.Nes@cwi.nl