本文整理汇总了PHP中throwSQLError函数的典型用法代码示例。如果您正苦于以下问题:PHP throwSQLError函数的具体用法?PHP throwSQLError怎么用?PHP throwSQLError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了throwSQLError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Copyright
<?php
/*
Copyright (C)
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program 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 General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
$connection = @mssql_connect($_SESSION['datasource_name'], $_SESSION['datasource_username'], $_SESSION['datasource_password']) or die(throwSQLError('general connection failure to the database'));
if (!empty($_GET['dbname'])) {
$db = urldecode($_GET['dbname']);
mssql_select_db($db);
$_SESSION['database'] = $db;
}
示例2: mssql_select_db
<td align="center" style="background: #D0DCE0">
<input type="submit" value="Run Query">
</td>
</tr>
</table>
</form>
<script language="javascript">
document.form1.query.focus();
</script>
<?php
if ($_POST['query'] == '') {
include 'inc/footer.php';
}
mssql_select_db($_SESSION['database']);
$data_query = @mssql_query($_POST['query']) or die(throwSQLError('unable to complete query'));
echo '<table width="' . $_SETTINGS['mobilescreenwidth'] . '" cellpadding="2" cellspacing="0" style="border: 1px solid">';
$toggle = true;
$colors = array('#DDDDDD', '#CCCCCC');
$isempty = true;
$fields = array();
if (mssql_num_rows($data_query) > 0) {
while ($row = mssql_fetch_array($data_query)) {
if ($isempty) {
$isempty = false;
}
if ($toggle) {
$bg = $colors[0];
} else {
$bg = $colors[1];
}
示例3: or
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program 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 General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include 'inc/header.php';
mssql_select_db($_SESSION['database']);
$data_query = @mssql_query('sp_helptext \'' . urldecode($_GET['procedure']) . '\'') or die(throwSQLError('unable to retrieve procedure'));
if (!@mssql_num_rows($data_query)) {
$schema_query = @mssql_query('SELECT SPECIFIC_SCHEMA FROM INFORMATION_SCHEMA.ROUTINES WHERE SPECIFIC_NAME = \'' . urldecode($_GET['procedure']) . '\';');
if ($schema_query) {
$schema_array = mssql_fetch_array($schema_query);
if ($schema_array['SPECIFIC_SCHEMA'] != 'dbo') {
$_GET['procedure'] = $schema_array['SPECIFIC_SCHEMA'] . '.' . urldecode($_GET['procedure']);
}
}
}
@mssql_query('DROP PROCEDURE ' . urldecode($_GET['procedure']) . ';') or die(throwSQLError('unable to delete procedure'));
if (empty($_GET['returnto'])) {
$_GET['returnto'] = 'database_properties.php';
}
echo '<meta http-equiv="refresh" content="0;url=' . $_GET['returnto'] . '">';
include 'inc/footer.php';
示例4: or
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program 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 General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include 'inc/header.php';
$db_info_query = @mssql_query('sp_helpdb') or die(throwSQLError('unable to retrieve databases'));
$dbinfo = array();
while ($row = mssql_fetch_array($db_info_query)) {
if (!in_array($row['name'], $_SETTINGS['dbexclude'])) {
$dbinfo[] = $row['name'] . ':' . number_format($row['db_size'], 2);
}
}
?>
<table width="90%">
<tr>
<td align="left" valign="top" width="45%">
<form name="form1" method="post" action="database_create.php?step=1">
<table cellpadding="5" cellspacing="0" width="100%" style="border: 1px solid; border-color: black">
<tr>
<td align="center" colspan="2" style="background: #D0DCE0; border-bottom: 1px solid">
示例5: mssql_select_db
any later version.
This program 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 General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include 'inc/header.php';
mssql_select_db($_SESSION['database']);
if (!empty($_POST['query'])) {
if (!@mssql_query($_POST['query'])) {
throwSQLError('unable to create trigger');
} else {
echo '<meta http-equiv="refresh" content="0;url=database_properties.php">';
include 'inc/footer.php';
}
} else {
$_POST['query'] = 'CREATE TRIGGER NewTrig;';
}
?>
<form name="form1" method="post" action="trigger_create.php">
<table cellpadding="3" cellspacing="3" style="border: 1px solid">
<tr>
<td align="center" style="background: #D0DCE0">
<b>Create Trigger</b>
</td>
</tr>
示例6: array
<b>Triggers</b>
</td>
</tr>
<tr>
<td style="background: #D0DCE0"> </td>
<td align="center" style="background: #D0DCE0">
<b>Name</b>
</td>
<td align="center" colspan="2" style="background: #D0DCE0">
<b>Action</b>
</td>
</tr>
<?php
$toggle = true;
$colors = array('#DDDDDD', '#CCCCCC');
$trig_query = @mssql_query('sp_helptrigger \'' . urldecode($_GET['table']) . '\'') or die(throwSQLError('unable to retrieve list of stored procedures'));
while ($row = mssql_fetch_assoc($trig_query)) {
if ($row['trigger_schema'] != '') {
$fullname = $row['trigger_schema'] . '.' . $row['trigger_name'];
} else {
$fullname = $row['trigger_name'];
}
if ($toggle) {
$bg = $colors[0];
} else {
$bg = $colors[1];
}
$toggle = !$toggle;
echo '<tr>';
echo '<td align="center" style="background: ' . $bg . '" nowrap><input type="checkbox" name="triggers[]" value="' . $fullname . '"></td>';
echo '<td style="background: ' . $bg . '" nowrap>' . $row['trigger_name'] . '</td>';
示例7: die
@mssql_query($query) or die(throwSQLError('unable to lock database', $query));
$query = 'ALTER DATABASE ' . urldecode($_GET[dbname]) . ' SET READ_ONLY';
@mssql_query($query) or die(throwSQLError('unable to make database READ-ONLY', $query));
$query = 'ALTER DATABASE ' . urldecode($_GET[dbname]) . ' SET MULTI_USER';
@mssql_query($query) or die(throwSQLError('unable to re-enable mutli-user mode on database', $query));
echo '<meta http-equiv="refresh" content="0;url=home.php">';
} else {
if ($confirm == 'readwrite') {
$_SESSION['database'] = 'master';
mssql_select_db('master');
$query = 'ALTER DATABASE ' . urldecode($_GET[dbname]) . ' SET SINGLE_USER';
@mssql_query($query) or die(throwSQLError('unable to lock database', $query));
$query = 'ALTER DATABASE ' . urldecode($_GET[dbname]) . ' SET READ_WRITE';
@mssql_query($query) or die(throwSQLError('unable to make database READ-WRITE', $query));
$query = 'ALTER DATABASE ' . urldecode($_GET[dbname]) . ' SET MULTI_USER';
@mssql_query($query) or die(throwSQLError('unable to re-enable mutli-user mode on database', $query));
echo '<meta http-equiv="refresh" content="0;url=home.php">';
} else {
$status_query = @mssql_query('sp_helpdb') or die(throwError('unable to retrive database information'));
while ($row = mssql_fetch_array($status_query)) {
if ($row['name'] == $_GET['dbname']) {
$status = explode(', ', $row['status']);
foreach ($status as $value) {
$split = explode('=', $value);
if ($split[0] == 'Updateability') {
if ($split[1] == 'READ_WRITE') {
$newmode = 'READ_ONLY';
} else {
$newmode = 'READ_WRITE';
}
}
示例8: Copyright
/*
Copyright (C)
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program 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 General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include 'inc/header.php';
@mssql_select_db($_SESSION['database']) or die(throwSQLError('unable to select database'));
if ($_POST['tables'][0] == '') {
@mssql_query('DROP TABLE ' . urldecode($_GET['table']) . ';') or die(throwSQLError('unable to complete drop'));
} else {
for ($counter = 0; $counter < count($_POST['tables']); $counter++) {
@mssql_query('DROP TABLE ' . urldecode($_POST['tables'][$counter]) . ';') or die(throwSQLError('unable to complete drop'));
}
}
if ($_SESSION['expanded'] != '') {
echo '<script language="javascript">parent.left.location.reload();</script>';
}
echo '<meta http-equiv="refresh" content="0;url=database_properties.php?dbname=' . urlencode($_SESSION['database']) . '">';
include 'inc/footer.php';
示例9: throwSQLError
$colquery = 'sp_columns @table_name = N\'' . $tablesep[0] . '\'';
}
$column_query = @mssql_query($colquery) or throwSQLError('unable to retrieve column data');
while ($row = mssql_fetch_array($column_query)) {
if (substr_count($row['TYPE_NAME'], 'identity') > 0) {
$idcol = $row['COLUMN_NAME'];
}
}
// END IDENTITY ISOLATION CODE
if (substr($query, -6) == ' WHERE') {
$query = substr($query, 0, -6);
}
if (!empty($_POST['orderbyfield'])) {
$query .= ' ORDER BY ' . $_POST['orderbyfield'] . ' ' . $_POST['orderbyorder'];
}
$data_query = @mssql_query($query) or throwSQLError('unable to complete query', $query);
if ($data_query) {
echo '<table width="300" cellpadding="3" cellspacing="3" style="border: 1px solid">';
$toggle = true;
$colors = array('#DDDDDD', '#CCCCCC');
$isempty = true;
$fields = array();
while ($row = mssql_fetch_array($data_query)) {
if ($isempty) {
$isempty = false;
}
if ($toggle) {
$bg = $colors[0];
} else {
$bg = $colors[1];
}
示例10: mssql_select_db
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include 'inc/header.php';
if (!empty($_POST['confirm'])) {
$confirm = $_POST['confirm'];
} else {
$confirm = '';
}
if ($confirm == 'detach') {
$_SESSION['database'] = 'master';
mssql_select_db('master');
$result = @mssql_query('sp_detach_db \'' . urldecode($_POST[dbname]) . '\',\'false\'') or die(throwSQLError('unable to detach database'));
if ($result) {
echo '<script language="javascript">parent.left.location.reload();</script>';
echo '<meta http-equiv="refresh" content="0;url=home.php">';
}
} else {
?>
<form name="form1" method="post" action="database_detach.php?dbname=<?php
echo $_GET['dbname'];
?>
">
<input type="hidden" name="dbname" value="<?php
echo $_GET['dbname'];
?>
">
示例11: die
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include 'inc/header.php';
@mssql_select_db($_SESSION['database']) or die(throwSQLError('unable to select database'));
if ($_GET['showall'] != 'yes') {
if (substr_count(urldecode($_GET['table']), '.') > 0) {
$data_query = @mssql_query('SELECT TOP 100 * FROM ' . urldecode($_GET['table'])) or die(throwSQLError('unable to complete query'));
} else {
$data_query = @mssql_query('SELECT TOP 100 * FROM [' . urldecode($_GET['table']) . ']') or die(throwSQLError('unable to complete query'));
}
} else {
if (substr_count(urldecode($_GET['table']), '.') > 0) {
$data_query = @mssql_query('SELECT * FROM ' . urldecode($_GET['table'])) or die(throwSQLError('unable to complete query'));
} else {
$data_query = @mssql_query('SELECT * FROM [' . urldecode($_GET['table']) . ']') or die(throwSQLError('unable to complete query'));
}
}
echo '<table width="' . $_SETTINGS['mobilescreenwidth'] . '" cellpadding="2" cellspacing="0" style="border: 1px solid">';
$toggle = true;
$colors = array('#DDDDDD', '#CCCCCC');
$isempty = true;
$fields = array();
while ($row = mssql_fetch_array($data_query)) {
if ($isempty) {
$isempty = false;
}
if ($toggle) {
$bg = $colors[0];
} else {
$bg = $colors[1];
示例12: mssql_select_db
any later version.
This program 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 General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include 'inc/header.php';
mssql_select_db($_SESSION['database']);
if (!empty($_POST['query'])) {
if (!@mssql_query($_POST['query'])) {
throwSQLError('unable to create procedure');
} else {
echo '<meta http-equiv="refresh" content="0;url=database_properties.php">';
}
} else {
$_POST['query'] = 'CREATE PROCEDURE NewProc;';
}
?>
<form name="form1" method="post" action="procedure_create.php">
<table cellpadding="3" cellspacing="3" style="border: 1px solid">
<tr>
<td align="center" style="background: #D0DCE0">
<b>Create Stored Procedure</b>
</td>
</tr>
<tr>
示例13: die
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
?>
<?php
include 'inc/header.php';
if (empty($_POST['mdf'])) {
$result = @mssql_query('CREATE DATABASE ' . $_POST['dbname']) or die(throwSQLError('unable to create database'));
} else {
if (substr_count($_POST['mdf'], '\\') == 0 || substr_count($_POST['ldf'], '\\') == 0 && $_POST['ldf'] != '') {
mssql_select_db('master');
$path_query = @mssql_query('sp_helpfile') or die(throwSQLError('unable to retrieve file path'));
$path_array = mssql_fetch_array($path_query);
if (substr_count($_POST['mdf'], '\\') == 0) {
$_POST['mdf'] = substr($path_array['filename'], 0, strrpos($path_array['filename'], '\\')) . $_POST['mdf'];
}
if (substr_count($_POST['ldf'], '\\') == 0) {
$_POST['ldf'] = substr($path_array['filename'], 0, strrpos($path_array['filename'], '\\')) . $_POST['ldf'];
}
}
if ($_POST['ldf'] == '') {
$result = @mssql_query('sp_attach_single_file_db \'' . $_POST['dbname'] . '\',\'' . $_POST['mdf'] . '\'') or die(throwSQLError('unable to attach database'));
} else {
$result = @mssql_query('sp_attach_db \'' . $_POST['dbname'] . '\',\'' . $_POST['mdf'] . '\',\'' . $_POST['ldf'] . '\'') or die(throwSQLError('unable to attach database'));
}
}
if ($result) {
echo '<script language="javascript">parent.left.location.reload();</script>';
echo '<meta http-equiv="refresh" content="0;url=database_properties.php?dbname=' . $_POST['dbname'] . '">';
}
include 'inc/footer.php';
示例14: die
$data_query = @mssql_query($_POST['query']) or die(throwSQLError('unable to save view'));
if ($data_query) {
throwSuccess('view saved');
}
} else {
mssql_select_db($_SESSION['database']);
$lines = array();
$doit = false;
$data_query = @mssql_query('sp_helptext \'' . urldecode($_GET['view']) . '\'') or die(throwSQLError('unable to retrieve procedure'));
if (!@mssql_num_rows($data_query)) {
$schema_query = @mssql_query('SELECT TABLE_SCHEMA FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = \'' . urldecode($_GET['view']) . '\';');
if ($schema_query) {
$schema_array = mssql_fetch_array($schema_query);
$_GET['view'] = $schema_array['TABLE_SCHEMA'] . '.' . urldecode($_GET['view']);
unset($data_query);
$data_query = @mssql_query('sp_helptext \'' . $_GET['view'] . '\'') or die(throwSQLError('unable to retrieve view'));
if (@mssql_num_rows($data_query)) {
$doit = true;
}
}
} else {
$doit = true;
}
if ($doit) {
while ($row = mssql_fetch_array($data_query)) {
$lines[] = $row['Text'];
}
} else {
$lines[] = 'I am unable to read this view.';
}
}
示例15: Copyright
/*
Copyright (C)
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program 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 General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include 'inc/header.php';
@mssql_select_db($_SESSION['database']) or die(throwSQLError('unable to select database'));
if (empty($_POST['tablecount'])) {
@mssql_query('DELETE FROM ' . urldecode($_GET['table']) . ';') or die(throwSQLError('unable to complete empty'));
} else {
for ($counter = 0; $counter < $_POST['tablecount']; $counter++) {
if ($_POST['tables'][$counter] == 'yes') {
@mssql_query('DELETE FROM ' . urldecode($_POST['tables'][$counter]) . ';') or die(throwSQLError('unable to complete empty'));
}
}
}
echo '<meta http-equiv="refresh" content="0;url=database_properties.php?dbname=' . urlencode($_SESSION['database']) . '">';
include 'inc/footer.php';