Update of /cvsroot/monetdb/sql/src/storage/bpm
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2982

Modified Files:
        bpm_storage.mx 
Log Message:
Correct some code.

To look for a part (partition fragment) the cleanest way is to give
the partion structure and the part id


Index: bpm_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bpm/bpm_storage.mx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- bpm_storage.mx      19 Jan 2008 17:23:54 -0000      1.8
+++ bpm_storage.mx      19 Jan 2008 23:41:28 -0000      1.9
@@ -58,8 +58,8 @@
 
 extern int bpm_add_partition(sql_bpm *p);
 
-extern int bpm_set_part_location(Part p, char *host, int port, char *dbname, 
char* username, char* passwd);
-extern int bpm_del_part_location(Part p);
+extern int bpm_set_part_location(sql_bpm *pp, int part, int id, char *host, 
int port, char *dbname, char* username, char* passwd);
+extern int bpm_del_part_location(sql_bpm *pp, int part);
 
 #endif /*BPMSTORAGE_H */
 
@@ -135,34 +135,41 @@
 }
 
 int
-bpm_set_part_location(Part p, char *host, int port, char *dbname, char* user, 
char* passwd)
+bpm_set_part_location(sql_bpm *pp, int part, int host_id, char *host, int 
port, char *dbname, char* user, char* passwd)
 {
        BATiter part_namei;
        ptr id;
        BAT *part_name = bpm_part_name();
-       bpmHost bpmH =  bpm_host_create(host, port, dbname, user, passwd);
+       bpmHost bpmH = NULL;
+       Part p = &(pp->parts[part]);
+
+       if (host_id)
+               bpmH = bpm_host_get(host_id);
+       else
+               bpmH =  bpm_host_create(host, port, dbname, user, passwd);
 
        if (bpmH) {
                p->host = bpmH;
+               part_namei = bat_iterator(part_name);
+               id = BUNhead(part_namei,BUNfnd(part_name, p->name));
+               BUNins(part_host, (ptr)&id, &bpmH->id, TRUE);
+
                return 1;
        }
 
-       part_namei = bat_iterator(part_name);
-       id = BUNhead(part_namei,BUNfnd(part_name, p->name));
-       BUNins(part_host, (ptr)&id, &bpmH->id, TRUE);
-
        /* error */
        assert(0);
        return 0;
 }
 
 int
-bpm_remove_part_location(Part p)
+bpm_del_part_location(sql_bpm *pp, int part)
 {
        BATiter part_namei;
        ptr id;
        BAT *part_name = bpm_part_name();
        int host_id = 0;
+       Part p = &(pp->parts[part]);
 
        if (p->host) {
                p->host = NULL;


-------------------------------------------------------------------------
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-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to