summaryrefslogtreecommitdiff
path: root/contrib/pg_trgm/trgm.h
diff options
context:
space:
mode:
authorTeodor Sigaev2008-11-12 13:43:54 +0000
committerTeodor Sigaev2008-11-12 13:43:54 +0000
commitb87b52bf0469e5629f3119f93e0849fa70245602 (patch)
tree83854fa613830addfd7313017d7fa64aee180963 /contrib/pg_trgm/trgm.h
parente4ffd143a316b8b02b8ce3f4cf17e5fe8a89457d (diff)
Support of multibyte encoding for pg_trgm
Diffstat (limited to 'contrib/pg_trgm/trgm.h')
-rw-r--r--contrib/pg_trgm/trgm.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/contrib/pg_trgm/trgm.h b/contrib/pg_trgm/trgm.h
index e2f60fcf7b1..18d67516877 100644
--- a/contrib/pg_trgm/trgm.h
+++ b/contrib/pg_trgm/trgm.h
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/contrib/pg_trgm/trgm.h,v 1.9 2008/05/17 01:28:21 adunstan Exp $
+ * $PostgreSQL: pgsql/contrib/pg_trgm/trgm.h,v 1.10 2008/11/12 13:43:54 teodor Exp $
*/
#ifndef __TRGM_H__
#define __TRGM_H__
@@ -31,7 +31,14 @@ typedef char trgm[3];
*(((char*)(a))+2) = *(((char*)(b))+2); \
} while(0);
-#define TRGMINT(a) ( (*(((char*)(a))+2)<<16)+(*(((char*)(a))+1)<<8)+*(((char*)(a))+0) )
+uint32 trgm2int(trgm *ptr);
+
+#ifdef KEEPONLYALNUM
+#define ISPRINTABLECHAR(a) ( isascii( *(unsigned char*)(a) ) && (isalnum( *(unsigned char*)(a) ) || *(unsigned char*)(a)==' ') )
+#else
+#define ISPRINTABLECHAR(a) ( isascii( *(unsigned char*)(a) ) && isprint( *(unsigned char*)(a) ) )
+#endif
+#define ISPRINTABLETRGM(t) ( ISPRINTABLECHAR( ((char*)t) ) && ISPRINTABLECHAR( ((char*)t)+1 ) && ISPRINTABLECHAR( ((char*)t)+2 ) )
typedef struct
{