Merge commit 'origin/stable'
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 31 Mar 2009 07:48:51 +0000 (15:48 +0800)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 31 Mar 2009 07:48:51 +0000 (15:48 +0800)
Smake
doc/statistics.texi
src/data/make-file.c
src/data/por-file-writer.c
src/data/psql-reader.c
tests/command/get-data-psql.sh
tests/command/import-export.sh

diff --git a/Smake b/Smake
index 84537ef08561f7011d846e256f095e487106e3b1..4c8d83bc3bdae38f08560b305bb7a754a1220f42 100644 (file)
--- a/Smake
+++ b/Smake
@@ -16,6 +16,7 @@ GNULIB_MODULES = \
        environ \
        exit \
        fatal-signal \
+       fcntl \
        fpieee \
        fprintf-posix \
        full-read \
index 311f5d7ad98d7588256cf835b58d0e56a2727eda..985560604b02b52b02440dcd39a36bd1b773c118 100644 (file)
@@ -566,7 +566,7 @@ values.
 If more than two distinct, non-missing values for a variable
 under test are encountered then an error occurs.
 
-If the test proportion is equal to 0.5, then a one tailed test is
+If the test proportion is equal to 0.5, then a two tailed test is
 reported.   For any other test proportion, a one tailed test is
 reported.   
 For one tailed tests, if the test proportion is less than
index 807adc50d9d112de7b47459f0a06a98a4786651f..2162741a78e416324d07578f49e5d75f5da4a95e 100644 (file)
@@ -185,7 +185,7 @@ replace_file_start (const char *file_name, const char *mode,
         }
 
       /* Create file by that name. */
-      fd = open (rf->tmp_name, O_WRONLY | O_CREAT | O_EXCL, permissions);
+      fd = open (rf->tmp_name, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, permissions);
       if (fd >= 0)
         break;
       if (errno != EEXIST)
index 773969302ebcb9ddc3b06fea93aa1da6c66c313c..8de293c5eafb2904d065db08f7779c9980f4e805 100644 (file)
@@ -215,7 +215,8 @@ write_float (struct pfm_writer *w, double d)
   char buffer[64];
   format_trig_double (d, floor (d) == d ? DBL_DIG : w->digits, buffer);
   buf_write (w, buffer, strlen (buffer));
-  buf_write (w, "/", 1);
+  if (d != SYSMIS)
+    buf_write (w, "/", 1);
 }
 
 /* Write N to the portable file as an integer field. */
index a54b9f8b3888c58320623ea1d53086bc8650a155..be6d0a60759c45746ea01b660ca35e8f1770064b 100644 (file)
@@ -440,6 +440,10 @@ psql_open_reader (struct psql_read_info *info, struct dictionary **dict)
          break;
        }
 
+      if ( width == 0 && fmt_is_string (fmt.type))
+       fmt.w = width = MAX_SHORT_STRING;
+
+
       var = create_var (r, &fmt, width, PQfname (qres, i), i);
       if ( type == NUMERICOID && n_tuples > 0)
        {
index fa61d6d684db5ee9ea1060ad6f6dd69cc31f2666..1d8afadaa815f2ece469e7d488845844540f8951 100755 (executable)
@@ -427,4 +427,44 @@ diff -b  $TEMPDIR/pspp.list - << 'EOF'
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
+
+
+# Check for a bug caused by having string variables in the database,
+# all of which are null.
+
+activity="populate database 4"
+$pgpath/psql  -h $TEMPDIR -p $port  $dbase > /dev/null << EOF
+
+-- a table which has a text field containing only null, or zero
+-- length entries.
+
+CREATE TABLE foo (int4  int4, text text);
+
+INSERT INTO foo VALUES ('12', '');
+
+INSERT INTO foo VALUES (null, '');
+
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+activity="create program 4"
+cat > $TESTFILE <<EOF
+GET DATA /TYPE=psql 
+       /CONNECT="host=$TEMPDIR port=$port dbname=$dbase"
+       /UNENCRYPTED
+       /SQL="select * from foo".
+
+DISPLAY DICTIONARY.
+
+LIST.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 4"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
 pass;
index f0c2b5c4793b481e1504f8786315a4ecea30e2e9..0cb178bf5776ade7e26ac28b5218f2eefd18e70f 100755 (executable)
@@ -61,7 +61,7 @@ cat > $TESTFILE <<EOF
 DATA LIST LIST NOTABLE /X Y.
 BEGIN DATA.
 1 2
-3 4
+3 .
 5 6
 END DATA.
 
@@ -83,7 +83,7 @@ diff -b  $TEMPDIR/pspp.list - << EOF
        X        Y
 -------- --------
     1.00     2.00 
-    3.00     4.00 
+    3.00     .
     5.00     6.00 
 EOF
 if [ $? -ne 0 ] ; then fail ; fi