Hello!
authorBruce Momjian
Sat, 29 Aug 1998 04:05:46 +0000 (04:05 +0000)
committerBruce Momjian
Sat, 29 Aug 1998 04:05:46 +0000 (04:05 +0000)
Here is a new patch for libpq, to make it work on Win32 again (since
the latest modifications broke it a little).

Please also add the file "libpq.rc" to the interfaces/libpq directory.
This will allow version-stamping of the generated DLL file, so that
automatic install programs (and interested users) can determine
the version of the file.  The file is currently set as "prerelease".
Before the release, somebody should change the line "FILEFLAGS
VS_FF_PRERELEASE" to "FILEFLAGS 0".  That information should probably
go into toos\RELEASE_CHANGES.

The patch is against the cvs as of ~ 1998-08-26 14:30 CEST.

//Magnus

src/bin/psql/psql.c
src/include/c.h
src/include/libpq/pqcomm.h
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/win32.mak

index d9c3fd1e5eefc4285bf8f07955fd6d251a31e368..715fb50a2c915c24b580782f55b37eea17cfd0fb 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.156 1998/08/27 13:25:18 scrappy Exp $
+ *   $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.157 1998/08/29 04:05:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -89,7 +89,8 @@ char *__progname = "psql";
 #define PROMPT_READY   '='
 #define PROMPT_CONTINUE '-'
 #define PROMPT_COMMENT '*'
-#define PROMPT_QUOTE   '\''
+#define PROMPT_SINGLEQUOTE '\''
+#define PROMPT_DOUBLEQUOTE '"'
 
 /* Backslash command handling:
  * 0 - send currently constructed query to backend (i.e. we got a \g)
@@ -2310,7 +2311,7 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
 
    /* We've reached the end of our command input. */
    bool        success;
-   bool        in_quote;
+   char        in_quote;   /* == 0 for no in_quote */
    bool        was_bslash;     /* backslash */
    int         paren_level;
    char       *query_start;
@@ -2380,8 +2381,10 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
        {
            if (interactive && !pset->quiet)
            {
-               if (in_quote)
-                   pset->prompt[strlen(pset->prompt) - 3] = PROMPT_QUOTE;
+               if (in_quote && in_quote == PROMPT_SINGLEQUOTE)
+                   pset->prompt[strlen(pset->prompt) - 3] = PROMPT_SINGLEQUOTE;
+               else if (in_quote && in_quote == PROMPT_DOUBLEQUOTE)
+                   pset->prompt[strlen(pset->prompt) - 3] = PROMPT_DOUBLEQUOTE;
                else if (xcomment != NULL)
                    pset->prompt[strlen(pset->prompt) - 3] = PROMPT_COMMENT;
                else if (query[0] != '\0' && !querySent)
@@ -2500,7 +2503,7 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
                    was_bslash = true;
 
                /* inside a quote? */
-               if (in_quote && (line[i] != '\'' || was_bslash))
+               if (in_quote && (line[i] != in_quote || was_bslash))
                     /* do nothing */ ;
                else if (xcomment != NULL)      /* inside an extended
                                                 * comment? */
@@ -2548,8 +2551,10 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
                    line[i] = '\0';     /* remove comment */
                    break;
                }
-               else if (line[i] == '\'')
-                   in_quote ^= 1;
+               else if (in_quote && line[i] == in_quote)
+                   in_quote = false;
+               else if (!in_quote && (line[i] == '\'' || line[i] == '"'))
+                   in_quote = line[i];
                /* semi-colon? then send query now */
                else if (!paren_level && line[i] == ';')
                {
index 65eb4266aea282cfed1319f0893cd53401576bf9..3d7c08ddd4f5e71927f999d4942ec2cee2a0431d 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: c.h,v 1.43 1998/08/25 21:04:41 scrappy Exp $
+ * $Id: c.h,v 1.44 1998/08/29 04:05:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -133,7 +133,9 @@ typedef char *Pointer;
  * Example:
  *     extern const Version    RomVersion;
  */
+#ifndef WIN32
 #define const                  /* const */
+#endif
 
 /*
  * signed --
index a9bb120552d7b58e32bcaf26be278ce1bf2bd15b..e3b5a71b8375d4b82edc1160e11b94b2b766bc71 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pqcomm.h,v 1.27 1998/08/22 04:24:18 momjian Exp $
+ * $Id: pqcomm.h,v 1.28 1998/08/29 04:05:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 #include 
 #include 
+#ifdef WIN32
+#include 
+#else
 #include 
 #include 
 #include 
+#endif
 
 #include "c.h"
 
-
 /* Define a generic socket address type. */
 
 typedef union SockAddr
 {
    struct sockaddr sa;
    struct sockaddr_in in;
+#ifndef WIN32
    struct sockaddr_un un;
+#endif
 } SockAddr;
 
 
index 4cd45fca6c39d5e10755ee00483d04b6ff12136a..0e2112c1595211b9b6b7b49b7dd731b7a384629e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: libpq-fe.h,v 1.38 1998/08/17 03:50:40 scrappy Exp $
+ * $Id: libpq-fe.h,v 1.39 1998/08/29 04:05:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,9 +21,13 @@ extern       "C"
 
 #include 
 /* these wouldn't need to be included if PGSockAddr weren't exported: */
+#ifdef WIN32
+#include 
+#else
 #include 
 #include 
 #include 
+#endif
 /* ----------------
  *     include stuff common to fe and be
  * ----------------
@@ -141,7 +145,9 @@ extern      "C"
    {
        struct sockaddr sa;
        struct sockaddr_in in;
+#ifndef WIN32
        struct sockaddr_un un;
+#endif
    } PGSockAddr;
 
 /* large-object-access data ... allocated only if large-object code is used.
index 4c50caf5e4bea8c8171697f70526a46949a0993b..41d28189dcd7442209e6aecace343052935741eb 100644 (file)
@@ -11,6 +11,7 @@ NULL=nul
 !ENDIF 
 
 CPP=cl.exe
+RSC=rc.exe
 
 OUTDIR=.\Release
 INTDIR=.\Release
@@ -28,10 +29,14 @@ CLEAN :
    -@erase "$(INTDIR)\fe-lobj.obj"
    -@erase "$(INTDIR)\fe-misc.obj"
    -@erase "$(INTDIR)\fe-print.obj"
-        -@erase "$(OUTDIR)\libpqdll.obj"
-   -@erase "$(INTDIR)\vc50.idb"
+   -@erase "$(OUTDIR)\libpqdll.obj"
    -@erase "$(OUTDIR)\libpq.lib"
-        -@erase "$(OUTDIR)\libpq.dll"
+   -@erase "$(OUTDIR)\libpq.dll"
+   -@erase "$(OUTDIR)\libpq.res"
+   -@erase "vc50.pch"
+   -@erase "$(OUTDIR)\libpq.pch"
+   -@erase "$(OUTDIR)\libpqdll.exp"
+   -@erase "$(OUTDIR)\libpqdll.lib"
 
 "$(OUTDIR)" :
     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
@@ -53,6 +58,8 @@ LIB32_OBJS= \
    "$(INTDIR)\fe-misc.obj" \
    "$(INTDIR)\fe-print.obj"
 
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"
+
 LINK32=link.exe
 LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
  advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib\
@@ -61,7 +68,8 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
  /implib:"$(OUTDIR)\libpqdll.lib"  /def:libpqdll.def
 LINK32_OBJS= \
    "$(INTDIR)\libpqdll.obj" \
-   "$(OUTDIR)\libpq.lib"
+   "$(OUTDIR)\libpq.lib" \
+   "$(OUTDIR)\libpq.res"
 
 
 "$(OUTDIR)\libpq.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
@@ -69,7 +77,11 @@ LINK32_OBJS= \
   $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
 <<
 
-"$(OUTDIR)\libpq.dll" : "$(OUTDIR)" "$(OUTDIR)\libpqdll.obj" "$(INTDIR)\libpqdll.obj"
+"$(INTDIR)\libpq.res" : "$(INTDIR)" libpq.rc
+    $(RSC) $(RSC_PROJ) libpq.rc
+
+
+"$(OUTDIR)\libpq.dll" : "$(OUTDIR)" "$(OUTDIR)\libpqdll.obj" "$(INTDIR)\libpqdll.obj" "$(INTDIR)\libpq.res"
     $(LINK32) @<<
   $(LINK32_FLAGS) $(LINK32_OBJS)
 <<