Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
a4ff6102
...
a4ff610263d8557c3fa154a0c702c55426cdbc67
authored
2004-12-06 14:05:59 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added to the repository
1 parent
bd7a5d36
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
0 deletions
include/mailutils/sql.h
scripts/sqlmod.sh
include/mailutils/sql.h
0 → 100644
View file @
a4ff610
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2004 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MAILUTILS_SQL_H
#define _MAILUTILS_SQL_H
/* Loadable Modules Suppert */
#define __s_cat2__(a,b) a ## b
#define __s_cat3__(a,b,c) a ## b ## c
#define RDL_EXPORT(module,name) __s_cat3__(module,_LTX_,name)
typedef
int
(
*
rdl_init_t
)
(
void
);
typedef
void
(
*
rdl_done_t
)
(
void
);
#ifdef _HAVE_LIBLTDL //FIXME: Remove leading _ when SQL + ltdl works
# define MU_DECL_SQL_DISPATCH_T(mod) \
mu_sql_dispatch_t RDL_EXPORT(mod,dispatch_tab)
#else
# define MU_DECL_SQL_DISPATCH_T(mod) \
mu_sql_dispatch_t __s_cat2__(mod,_dispatch_tab)
#endif
enum
mu_sql_connection_state
{
mu_sql_not_connected
,
mu_sql_connected
,
mu_sql_query_run
,
mu_sql_result_available
};
typedef
struct
mu_sql_connection
*
mu_sql_connection_t
;
struct
mu_sql_connection
{
int
interface
;
char
*
server
;
int
port
;
char
*
login
;
char
*
password
;
char
*
dbname
;
void
*
data
;
enum
mu_sql_connection_state
state
;
};
typedef
struct
mu_sql_dispatch
mu_sql_dispatch_t
;
struct
mu_sql_dispatch
{
char
*
name
;
int
port
;
int
(
*
init
)
(
mu_sql_connection_t
conn
);
int
(
*
destroy
)
(
mu_sql_connection_t
conn
);
int
(
*
connect
)
(
mu_sql_connection_t
conn
);
int
(
*
disconnect
)
(
mu_sql_connection_t
conn
);
int
(
*
query
)
(
mu_sql_connection_t
conn
,
char
*
query
);
int
(
*
store_result
)
(
mu_sql_connection_t
conn
);
int
(
*
release_result
)
(
mu_sql_connection_t
conn
);
int
(
*
num_tuples
)
(
mu_sql_connection_t
conn
,
size_t
*
np
);
int
(
*
num_columns
)
(
mu_sql_connection_t
conn
,
size_t
*
np
);
int
(
*
get_column
)
(
mu_sql_connection_t
conn
,
size_t
nrow
,
size_t
ncol
,
char
**
pdata
);
char
*
(
*
errstr
)
(
mu_sql_connection_t
conn
);
};
/* Public interfaces */
int
mu_sql_interface_index
(
char
*
name
);
int
mu_sql_connection_init
(
mu_sql_connection_t
*
conn
,
int
interface
,
char
*
server
,
int
port
,
char
*
login
,
char
*
password
,
char
*
dbname
);
int
mu_sql_connection_destroy
(
mu_sql_connection_t
*
conn
);
int
mu_sql_connect
(
mu_sql_connection_t
conn
);
int
mu_sql_disconnect
(
mu_sql_connection_t
conn
);
int
mu_sql_query
(
mu_sql_connection_t
conn
,
char
*
query
);
int
mu_sql_store_result
(
mu_sql_connection_t
conn
);
int
mu_sql_release_result
(
mu_sql_connection_t
conn
);
int
mu_sql_num_tuples
(
mu_sql_connection_t
conn
,
size_t
*
np
);
int
mu_sql_num_columns
(
mu_sql_connection_t
conn
,
size_t
*
np
);
int
mu_sql_get_column
(
mu_sql_connection_t
conn
,
size_t
nrow
,
size_t
ncol
,
char
**
pdata
);
char
*
mu_sql_strerror
(
mu_sql_connection_t
conn
);
#endif
scripts/sqlmod.sh
0 → 100755
View file @
a4ff610
#! /bin/sh
# This file is part of GNU Mailutils
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# Written by Sergey Poznyakoff
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cat -
<<EOT
/* This file is generated automatically. Please do not edit */
EOT
for
module
do
echo
"extern mu_sql_dispatch_t
${
module
}
_dispatch_tab;"
done
cat -
<<EOT
static mu_sql_dispatch_t *static_dispatch_tab[] = {
NULL,
EOT
for
module
do
echo
" &
${
module
}
_dispatch_tab,"
done
echo
"};"
echo
'/* EOF */'
Please
register
or
sign in
to post a comment