Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Ng
OpenLDAP
Commits
e24cc058
Commit
e24cc058
authored
19 years ago
by
Pierangelo Masarati
Browse files
Options
Downloads
Patches
Plain Diff
more cleanup
parent
d79d9be8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
servers/slapd/back-sql/init.c
+6
-0
6 additions, 0 deletions
servers/slapd/back-sql/init.c
servers/slapd/back-sql/proto-sql.h
+2
-0
2 additions, 0 deletions
servers/slapd/back-sql/proto-sql.h
servers/slapd/back-sql/sql-wrap.c
+34
-21
34 additions, 21 deletions
servers/slapd/back-sql/sql-wrap.c
with
42 additions
and
21 deletions
servers/slapd/back-sql/init.c
+
6
−
0
View file @
e24cc058
...
...
@@ -567,8 +567,14 @@ int
backsql_db_close
(
BackendDB
*
bd
)
{
backsql_info
*
bi
=
(
backsql_info
*
)
bd
->
be_private
;
Debug
(
LDAP_DEBUG_TRACE
,
"==>backsql_db_close()
\n
"
,
0
,
0
,
0
);
backsql_conn_destroy
(
bi
);
Debug
(
LDAP_DEBUG_TRACE
,
"<==backsql_db_close()
\n
"
,
0
,
0
,
0
);
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/back-sql/proto-sql.h
+
2
−
0
View file @
e24cc058
...
...
@@ -213,6 +213,8 @@ RETCODE backsql_FreeRow( BACKSQL_ROW_NTS *row );
void
backsql_PrintErrors
(
SQLHENV
henv
,
SQLHDBC
hdbc
,
SQLHSTMT
sth
,
int
rc
);
int
backsql_conn_destroy
(
backsql_info
*
bi
);
int
backsql_init_db_env
(
backsql_info
*
si
);
int
backsql_free_db_env
(
backsql_info
*
si
);
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/back-sql/sql-wrap.c
+
34
−
21
View file @
e24cc058
...
...
@@ -253,10 +253,13 @@ backsql_cmp_connid( const void *v_c1, const void *v_c2 )
return
0
;
}
static
int
backsql_close_db_conn
(
backsql_db_conn
*
conn
)
static
void
backsql_close_db_conn
(
void
*
v_
conn
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"==>backsql_close_db_conn()
\n
"
,
0
,
0
,
0
);
backsql_db_conn
*
conn
=
(
backsql_db_conn
*
)
v_conn
;
Debug
(
LDAP_DEBUG_TRACE
,
"==>backsql_close_db_conn(%lu)
\n
"
,
conn
->
ldap_cid
,
0
,
0
);
/*
* Default transact is SQL_ROLLBACK; commit is required only
...
...
@@ -270,9 +273,17 @@ backsql_close_db_conn( backsql_db_conn *conn )
SQLFreeConnect
(
conn
->
dbh
);
ch_free
(
conn
);
Debug
(
LDAP_DEBUG_TRACE
,
"<==backsql_close_db_conn()
\n
"
,
0
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"<==backsql_close_db_conn(%lu)
\n
"
,
conn
->
ldap_cid
,
0
,
0
);
}
int
backsql_conn_destroy
(
backsql_info
*
bi
)
{
avl_free
(
bi
->
sql_db_conns
,
backsql_close_db_conn
);
return
1
;
return
0
;
}
int
...
...
@@ -326,13 +337,15 @@ backsql_open_db_conn( backsql_info *bi, unsigned long ldap_cid, backsql_db_conn
assert
(
pdbc
!=
NULL
);
*
pdbc
=
NULL
;
Debug
(
LDAP_DEBUG_TRACE
,
"==>backsql_open_db_conn()
\n
"
,
0
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"==>backsql_open_db_conn(%lu)
\n
"
,
ldap_cid
,
0
,
0
);
dbc
=
(
backsql_db_conn
*
)
ch_calloc
(
1
,
sizeof
(
backsql_db_conn
)
);
dbc
->
ldap_cid
=
ldap_cid
;
rc
=
SQLAllocConnect
(
bi
->
sql_db_env
,
&
dbc
->
dbh
);
if
(
!
BACKSQL_SUCCESS
(
rc
)
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn: "
"SQLAllocConnect() failed:
\n
"
,
0
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn
(%lu)
: "
"SQLAllocConnect() failed:
\n
"
,
ldap_cid
,
0
,
0
);
backsql_PrintErrors
(
bi
->
sql_db_env
,
SQL_NULL_HDBC
,
SQL_NULL_HENV
,
rc
);
return
LDAP_UNAVAILABLE
;
...
...
@@ -343,9 +356,9 @@ backsql_open_db_conn( backsql_info *bi, unsigned long ldap_cid, backsql_db_conn
(
SQLCHAR
*
)
bi
->
sql_dbuser
,
SQL_NTS
,
(
SQLCHAR
*
)
bi
->
sql_dbpasswd
,
SQL_NTS
);
if
(
rc
!=
SQL_SUCCESS
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn: "
"SQLConnect() to database
\"
%s
\"
as user
\"
%s
\"
"
"%s:
\n
"
,
bi
->
sql_dbname
,
bi
->
sql_dbuser
,
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn
(%lu)
: "
"SQLConnect() to database
\"
%s
\"
%s.
\n
"
,
ldap_cid
,
bi
->
sql_dbname
,
rc
==
SQL_SUCCESS_WITH_INFO
?
"succeeded with info"
:
"failed"
);
backsql_PrintErrors
(
bi
->
sql_db_env
,
dbc
->
dbh
,
SQL_NULL_HENV
,
rc
);
...
...
@@ -372,28 +385,28 @@ backsql_open_db_conn( backsql_info *bi, unsigned long ldap_cid, backsql_db_conn
if
(
rc
==
SQL_SUCCESS
)
{
if
(
strcmp
(
DBMSName
,
"TimesTen"
)
==
0
||
strcmp
(
DBMSName
,
"Front-Tier"
)
==
0
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn: "
"TimesTen database!
\n
"
,
0
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn
(%lu)
: "
"TimesTen database!
\n
"
,
ldap_cid
,
0
,
0
);
bi
->
sql_flags
|=
BSQLF_USE_REVERSE_DN
;
}
}
else
{
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn: "
"SQLGetInfo() failed
:
\n
"
,
0
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn
(%lu)
: "
"SQLGetInfo() failed
.
\n
"
,
ldap_cid
,
0
,
0
);
backsql_PrintErrors
(
bi
->
sql_db_env
,
dbc
->
dbh
,
SQL_NULL_HENV
,
rc
);
return
rc
;
}
/* end TimesTen */
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn(): "
"connected, adding to tree
\n
"
,
0
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn(
%lu
): "
"connected, adding to tree
.
\n
"
,
ldap_cid
,
0
,
0
);
ldap_pvt_thread_mutex_lock
(
&
bi
->
sql_dbconn_mutex
);
if
(
avl_insert
(
&
bi
->
sql_db_conns
,
dbc
,
backsql_cmp_connid
,
avl_dup_error
)
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn: "
"duplicate connection ID
\n
"
,
0
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_open_db_conn
(%lu)
: "
"duplicate connection ID
.
\n
"
,
ldap_cid
,
0
,
0
);
return
LDAP_OTHER
;
}
ldap_pvt_thread_mutex_unlock
(
&
bi
->
sql_dbconn_mutex
);
Debug
(
LDAP_DEBUG_TRACE
,
"<==backsql_open_db_conn()
\n
"
,
0
,
0
,
0
);
Debug
(
LDAP_DEBUG_TRACE
,
"<==backsql_open_db_conn(
%lu
)
\n
"
,
ldap_cid
,
0
,
0
);
*
pdbc
=
dbc
;
...
...
@@ -421,7 +434,7 @@ backsql_free_db_conn( Operation *op )
Debug
(
LDAP_DEBUG_TRACE
,
"backsql_free_db_conn(): "
"closing db connection %lu (%p)
\n
"
,
op
->
o_connid
,
conn
,
0
);
backsql_close_db_conn
(
conn
);
backsql_close_db_conn
(
(
void
*
)
conn
);
}
Debug
(
LDAP_DEBUG_TRACE
,
"<==backsql_free_db_conn()
\n
"
,
0
,
0
,
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment