Changeset: 5fd104291cea for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5fd104291cea
Modified Files:
        sql/backends/monet5/sql_scenario.c
Branch: Jan2014
Log Message:

Allocate enough memory for even large initialization files.


diffs (15 lines):

diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1094,7 +1094,10 @@ SQLinitClient(Client c)
                                        filename = p + 1;
 
                                if (fd) {
-                                       bfd = bstream_create(fd, 128 * BLOCK);
+                                       struct stat st;
+                                       if (fstat(fileno(getFile(fd)), &st) < 0)
+                                               st.st_size = 128 * BLOCK;
+                                       bfd = bstream_create(fd, BLOCK * 
(st.st_size / BLOCK + 1));
                                        if (bfd && bstream_next(bfd) >= 0)
                                                msg = SQLstatementIntern(c, 
&bfd->buf, "sql.init", TRUE, FALSE);
                                        bstream_destroy(bfd);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to