Code review comment for lp:~vkolesnikov/pbxt/pbxt-bug-378222

Revision history for this message
Paul McCullagh (paul-mccullagh) wrote :

Hi Vlad,

This patch looks good. Just one thing: how about doing this in
xt_tab_init_db()?

I think this would be more efficient.

On Jun 12, 2009, at 4:40 PM, Vladimir Kolesnikov wrote:

> === modified file 'src/database_xt.cc'
> --- src/database_xt.cc 2009-05-28 15:17:16 +0000
> +++ src/database_xt.cc 2009-06-12 14:29:30 +0000
> @@ -616,7 +616,9 @@
> xtPublic void xt_open_database(XTThreadPtr self, char *path, xtBool
> multi_path)
> {
> XTDatabaseHPtr db;
> -
> + XTTableDescRec desc;
> + XTPathStr table_path;
> +
> /* We cannot get a database, without unusing the current
> * first. The reason is that the restart process will
> * partially set the current database!
> @@ -625,7 +627,18 @@
> db = xt_get_database(self, path, multi_path);
> pushr_(xt_heap_release, db);
> xt_use_database(self, db, XT_FOR_USER);
> - freer_(); // xt_heap_release(self, db);
> +
> + xt_describe_tables_init(self, db, &desc);
> + pushr_(xt_describe_tables_exit, &desc);
> + while (xt_describe_tables_next(self, &desc)) {
> + xt_strcpy(PATH_MAX, table_path.ps_path, desc.td_tab_path->tp_path);
> + xt_add_dir_char(PATH_MAX, table_path.ps_path);
> + xt_strcat(PATH_MAX, table_path.ps_path, desc.td_tab_name);
> + xt_heap_release(self, xt_use_table(self, &table_path, FALSE,
> FALSE, NULL));
> + }
> +
> + freer_(); // xt_describe_tables_exit(self, desc);
> + freer_(); // xt_heap_release(self, db);
> }
>

--
Paul McCullagh
PrimeBase Technologies
www.primebase.org
www.blobstreaming.org
pbxt.blogspot.com

« Back to merge proposal