Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F2113625
inst_ado.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 18, 3:03 PM
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 20, 3:03 PM (2 h, 33 m)
Engine
blob
Format
Raw Data
Handle
984486
Attached To
rINP In-Portal
inst_ado.php
View Options
<?php
/**
* Returns reference to database connection
*
* @param bool $new_type Return Kernel4 or in-portal connection object
* @return kDBConnection
*/
function
&
inst_GetADODBConnection
(
$new_type
=
false
)
{
static
$DB
=
null
;
global
$g_DBType
,
$g_DBHost
,
$g_DBUser
,
$g_DBUserPassword
,
$g_DBName
,
$g_DebugMode
;
global
$ADODB_FETCH_MODE
,
$ADODB_COUNTRECS
,
$ADODB_CACHE_DIR
,
$pathtoroot
;
if
(
$new_type
)
{
static
$new_db
=
null
;
if
(!
isset
(
$new_db
)
&&
$g_DBType
)
{
require_once
FULL_PATH
.
'/core/kernel/db/db_connection.php'
;
$new_db
=
new
kDBConnection
(
$g_DBType
);
$new_db
->
Connect
(
$g_DBHost
,
$g_DBUser
,
$g_DBUserPassword
,
$g_DBName
);
}
return
$new_db
;
}
if
(
!
isset
(
$DB
)
&&
strlen
(
$g_DBType
)
>
0
)
{
$DB
=
ADONewConnection
(
$g_DBType
);
$connected
=
$DB
->
Connect
(
$g_DBHost
,
$g_DBUser
,
$g_DBUserPassword
,
$g_DBName
);
$ADODB_CACHE_DIR
=
$pathtoroot
.
'cache'
;
$ADODB_FETCH_MODE
=
2
;
$ADODB_COUNTRECS
=
false
;
$DB
->
debug
=
false
;
$DB
->
cacheSecs
=
3600
;
}
return
$DB
;
}
?>
Event Timeline
Log In to Comment