SOURCES: sqlite3-sign-function.patch (NEW) - a tiny, but useful fu...

prism prism at pld-linux.org
Mon Oct 17 00:32:29 CEST 2005


Author: prism                        Date: Sun Oct 16 22:32:28 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- a tiny, but useful function

---- Files affected:
SOURCES:
   sqlite3-sign-function.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/sqlite3-sign-function.patch
diff -u /dev/null SOURCES/sqlite3-sign-function.patch:1.1
--- /dev/null	Mon Oct 17 00:32:28 2005
+++ SOURCES/sqlite3-sign-function.patch	Mon Oct 17 00:32:23 2005
@@ -0,0 +1,43 @@
+diff -uNr sqlite-3.2.7.orig/src/func.c sqlite-3.2.7/src/func.c
+--- sqlite-3.2.7.orig/src/func.c	2005-09-17 18:34:55.000000000 +0200
++++ sqlite-3.2.7/src/func.c	2005-10-17 00:11:22.000000000 +0200
+@@ -139,6 +139,31 @@
+ }
+ 
+ /*
++** Implementation of the sign() function
++*/
++static void signFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
++  assert( argc==1 );
++  switch( sqlite3_value_type(argv[0]) ){
++    case SQLITE_INTEGER: {
++      i64 iVal = sqlite3_value_int64(argv[0]);
++      iVal = (iVal > 0)? 1 : (iVal < 0)? -1 : 0;
++      sqlite3_result_int64(context, iVal);
++      break;
++    }
++    case SQLITE_NULL: {
++      sqlite3_result_null(context);
++      break;
++    }
++    default: {
++      double rVal = sqlite3_value_double(argv[0]);
++      rVal = (rVal > 0)? 1.0 : (rVal < 0)? -1.0 : 0;
++      sqlite3_result_double(context, rVal);
++      break;
++    }
++  }
++}
++
++/*
+ ** Implementation of the substr() function
+ */
+ static void substrFunc(
+@@ -963,6 +988,7 @@
+     { "substr",             3, 0, SQLITE_UTF16LE, 0, sqlite3utf16Substr },
+ #endif
+     { "abs",                1, 0, SQLITE_UTF8,    0, absFunc    },
++	{ "sign",               1, 0, SQLITE_UTF8,    0, signFunc   },
+     { "round",              1, 0, SQLITE_UTF8,    0, roundFunc  },
+     { "round",              2, 0, SQLITE_UTF8,    0, roundFunc  },
+     { "upper",              1, 0, SQLITE_UTF8,    0, upperFunc  },
================================================================



More information about the pld-cvs-commit mailing list