Skip to content

Commit

Permalink
Merge branch 'pcre2' into v1.3.1-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed Oct 28, 2016
2 parents 9fc5438 + 95a2d10 commit f764ce7
Show file tree
Hide file tree
Showing 21 changed files with 322 additions and 198,166 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ deps/pcre/pcre/
#protobuf
deps/protobuf/protobuf-2.6.1/

deps/sqlite3/sqlite-amalgamation-3150000/

test/.vagrant
.DS_Store
proxysql-tests.ini
Expand Down
21 changes: 16 additions & 5 deletions deps/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


default: libconfig libdaemon jemalloc mariadb_client re2 sqlite3
default: libconfig libdaemon jemalloc mariadb_client re2 sqlite3 pcre
.PHONY: default


Expand Down Expand Up @@ -40,7 +40,10 @@ mariadb_client: mariadb-client-library/mariadb_client/include/my_config.h


sqlite3/sqlite3/sqlite3.o:
cd sqlite3/sqlite3 && ${CC} -O2 -c -o sqlite3.o sqlite3.c
cd sqlite3 && rm -rf sqlite-amalgamation-3150000
cd sqlite3 && tar -zxf sqlite-amalgamation-3150000.tar.gz
cd sqlite3/sqlite3 && patch sqlite3.c < ../from_unixtime.patch
cd sqlite3/sqlite3 && ${CC} -O2 -c -o sqlite3.o sqlite3.c -DSQLITE_ENABLE_MEMORY_MANAGEMENT

sqlite3: sqlite3/sqlite3/sqlite3.o

Expand All @@ -55,19 +58,27 @@ libconfig: libconfig/libconfig/lib/.libs/libconfig++.a

re2/re2/obj/libre2.a:
cd re2 && rm -rf re2
cd re2 && tar -zxf re2-20140304.tgz
cd re2/re2 && sed -i -e 's/-O3 -g /-O3 -fPIC /' Makefile
# cd re2 && tar -zxf re2-20140304.tgz
cd re2 && tar -zxf re2.tar.gz
# cd re2/re2 && sed -i -e 's/-O3 -g /-O3 -fPIC /' Makefile
# cd re2 && patch re2/util/mutex.h < mutex.h.patch
cd re2/re2 && CC=${CC} CXX=${CXX} ${MAKE}

re2: re2/re2/obj/libre2.a

pcre/pcre/.libs/libpcre.a:
cd pcre && rm -rf pcre-8.39
cd pcre && tar -zxf pcre-8.39.tar.gz
cd pcre/pcre && ./configure
cd pcre/pcre && CC=${CC} CXX=${CXX} ${MAKE}
pcre: pcre/pcre/.libs/libpcre.a

cleanall:
cd libdaemon && rm -rf libdaemon-0.14
cd jemalloc && rm -rf jemalloc-3.6.0
cd mariadb-client-library && rm -rf mariadb-connector-c-2.1.0-src
cd libconfig && rm -rf libconfig-1.4.9
cd re2 && rm -rf re2
cd sqlite3/sqlite3 && rm -rf *.o
cd sqlite3/sqlite3 && rm -rf *
.PHONY: cleanall

1 change: 1 addition & 0 deletions deps/pcre/pcre
Binary file added deps/pcre/pcre-8.39.tar.gz
Binary file not shown.
Binary file removed deps/re2/re2-20140304.tgz
Binary file not shown.
Binary file added deps/re2/re2.tar.gz
Binary file not shown.
38 changes: 38 additions & 0 deletions deps/sqlite3/from_unixtime.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--- sqlite-amalgamation-3150000/sqlite3.c 2016-10-14 18:48:16.000000000 +0000
+++ /tmp/sqlite3.c 2016-10-28 00:22:06.993102669 +0000
@@ -19426,6 +19426,27 @@
}

/*
+** from_unixtime( TIMESTRING)
+**
+** Return YYYY-MM-DD HH:MM:SS
+*/
+static void from_unixtimeFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ DateTime x;
+ if( isDate(context, 1, argv, &x)==0 ){
+ parseModifier(context, (char*)"unixepoch", &x);
+ char zBuf[100];
+ computeYMD_HMS(&x);
+ sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d %02d:%02d:%02d",
+ x.Y, x.M, x.D, x.h, x.m, (int)(x.s));
+ sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
+ }
+}
+
+/*
** time( TIMESTRING, MOD, MOD, ...)
**
** Return HH:MM:SS
@@ -19715,6 +19736,7 @@
DFUNCTION(date, -1, 0, 0, dateFunc ),
DFUNCTION(time, -1, 0, 0, timeFunc ),
DFUNCTION(datetime, -1, 0, 0, datetimeFunc ),
+ DFUNCTION(from_unixtime, -1, 0, 0, from_unixtimeFunc ),
DFUNCTION(strftime, -1, 0, 0, strftimeFunc ),
DFUNCTION(current_time, 0, 0, 0, ctimeFunc ),
DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),
Loading

0 comments on commit f764ce7

Please sign in to comment.