Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18367ce

Browse files
committed
Ack, missed two files from the merge...looks like a .11 is goin gto have
to go out after all :(
1 parentb619cb0 commit18367ce

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

‎src/backend/parser/sysfunc.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* sysfunc.c--
4+
* process system functions and return a string result
5+
*
6+
* Notes:
7+
* 1) I return a string result because most of the functions cannot return any
8+
* normal type anyway (e.g. SYS_DATE, SYS_TIME, etc...), and the few that
9+
* might (SYS_UID or whatever) can just return it as a string - no problem.
10+
* This keeps the function flexible enough to be of good use.
11+
*
12+
* Written by Chad Robinson, chadr@brttech.com
13+
* Last modified: 04/27/1996
14+
* -------------------------------------------------------------------------
15+
*/
16+
#include<stdio.h>
17+
#include<stdlib.h>
18+
#include<string.h>
19+
#include<time.h>
20+
21+
/*
22+
* Can't get much more obvious than this. Might need to replace localtime()
23+
* on older systems...
24+
*/
25+
char*Sysfunc_system_date(void)
26+
{
27+
time_tcur_time_secs;
28+
structtm*cur_time_expanded;
29+
staticcharbuf[12];/* Just for safety, y'understand... */
30+
31+
time(&cur_time_secs);
32+
cur_time_expanded=localtime(&cur_time_secs);
33+
sprintf(buf,"%02.2d-%02.2d-%04.4d",cur_time_expanded->tm_mon+1,
34+
cur_time_expanded->tm_mday,cur_time_expanded->tm_year+1900);
35+
return&buf[0];
36+
}
37+
38+
char*SystemFunctionHandler(char*funct)
39+
{
40+
if (!strcmp(funct,"SYS_DATE"))
41+
returnSysfunc_system_date();
42+
return"*unknown function*";
43+
}
44+
45+
#ifdefSYSFUNC_TEST
46+
/*
47+
* Chad's rule of coding #4 - never delete a test function, even a stupid
48+
* one - you always need it 10 minutes after you delete it.
49+
*/
50+
voidmain(void)
51+
{
52+
printf("Current system date: %s\n",SystemFunctionHandler("SYS_DATE"));
53+
return;
54+
}
55+
#endif

‎src/backend/parser/sysfunc.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* sysfunc.h--
4+
* support for system functions
5+
*
6+
* -------------------------------------------------------------------------
7+
*/
8+
9+
externchar*SystemFunctionHandler(char*funct);
10+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp