Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mysql_microsecnow
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
mysql_microsecnow
Commits
02b35e6c
Commit
02b35e6c
authored
Mar 01, 2014
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First commit
parent
618e516b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
Makefile
Makefile
+24
-0
microsecnow.c
microsecnow.c
+25
-0
No files found.
Makefile
0 → 100644
View file @
02b35e6c
MYSQL_LIB
=
$(
shell
mysql_config
--cflags
--libs
)
MYSQL_PLUGINDIR
=
$(
shell
mysql_config
--plugindir
)
all
:
mysql
mysql
:
gcc
-Wall
${
MYSQL_LIB
}
-fPIC
-shared
-o
microsecnow.so microsecnow.c
install
:
install
-m
0644 microsecnow.so
${
MYSQL_PLUGINDIR
}
@
echo
""
@
echo
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
@
echo
""
@
echo
"please now in the mysql shell execute:"
@
echo
""
@
echo
"CREATE FUNCTION microsecnow RETURNS INTEGER SONAME 'microsecnow.so'"
@
echo
""
@
echo
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
@
echo
""
clean
:
rm
-f
*
.so
microsecnow.c
0 → 100644
View file @
02b35e6c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef
long
long
longlong
;
#include <mysql.h>
#include <ctype.h>
#include <sys/time.h>
#include <unistd.h>
longlong
microsecnow
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
is_null
,
char
*
error
);
my_bool
microsecnow_init
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
message
);
void
microsecnow_deinit
(
UDF_INIT
*
initid
);
my_bool
microsecnow_init
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
message
)
{
return
0
;
//optional
}
void
microsecnow_deinit
(
UDF_INIT
*
initid
)
{
//optional
}
longlong
microsecnow
(
UDF_INIT
*
initid
,
UDF_ARGS
*
args
,
char
*
is_null
,
char
*
error
)
{
struct
timeval
start
;
gettimeofday
(
&
start
,
NULL
);
return
start
.
tv_sec
*
1000000
+
start
.
tv_usec
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment