#include "utils/builtins.h" /* where the function declarations go */
#include "mb/pg_wchar.h"
-static int like(pg_wchar * text, pg_wchar * p);
+static int like(pg_wchar *text, pg_wchar *p);
/*
* interface routines called by the function manager
charlen - the length of the string
*/
static bool
-fixedlen_like(char *s, struct varlena * p, int charlen)
+fixedlen_like(char *s, struct varlena *p, int charlen)
{
pg_wchar *sterm,
*pterm;
}
bool
-namelike(NameData *n, struct varlena * p)
+namelike(NameData *n, struct varlena *p)
{
if (!n)
return FALSE;
}
bool
-namenlike(NameData *s, struct varlena * p)
+namenlike(NameData *s, struct varlena *p)
{
return !namelike(s, p);
}
bool
-textlike(struct varlena * s, struct varlena * p)
+textlike(struct varlena *s, struct varlena *p)
{
if (!s)
return FALSE;
}
bool
-textnlike(struct varlena * s, struct varlena * p)
+textnlike(struct varlena *s, struct varlena *p)
{
return !textlike(s, p);
}
-/* $Revision: 1.21 $
+/* $Revision: 1.22 $
** "like.c" A first attempt at a LIKE operator for Postgres95.
**
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
** Match text and p, return LIKE_TRUE, LIKE_FALSE, or LIKE_ABORT.
*/
static int
-DoMatch(pg_wchar * text, pg_wchar * p)
+DoMatch(pg_wchar *text, pg_wchar *p)
{
int matched;
** User-level routine. Returns TRUE or FALSE.
*/
static int
-like(pg_wchar * text, pg_wchar * p)
+like(pg_wchar *text, pg_wchar *p)
{
if (p[0] == '%' && p[1] == '\0')
return TRUE;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.171 1999/02/21 03:49:39 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.172 1999/03/15 02:18:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
/*
+ * Extract the veiw name and veiw definition from pg_views.
+ * -Ryan 2/14/99
+ */
+
+ descbuf[0] = '\0';
+ strcat(descbuf, "SELECT viewname, definition ");
+ strcat(descbuf, "FROM pg_views ");
+ strcat(descbuf, "WHERE viewname like '");
+ strcat(descbuf, table);
+ strcat(descbuf, "' ");
+ if(!(res2 = PSQLexec(pset, descbuf)))
+ return -1;
+
+ /*
* Display the information
*/
+ if(PQntuples(res2)) {
+ /*
+ * display the query.
+ * -Ryan 2/14/99
+ */
+ fprintf(fout, "\nView = %s\n", table);
+ fprintf(fout, "Query = %s\n", PQgetvalue(res2, 0, 1));
+ } else {
+ fprintf(fout, "\nTable = %s\n", table);
+ }
+ PQclear(res2);
- fprintf(fout, "\nTable = %s\n", table);
fprintf(fout, "+----------------------------------+----------------------------------+-------+\n");
fprintf(fout, "| Field | Type | Length|\n");
fprintf(fout, "+----------------------------------+----------------------------------+-------+\n");