<?php
/**
V4.65 22 July 2005 (c) 2000-2005 John Lim (jlim@natsoft.com.my). All rights reserved.
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence.
Set tabs to 4 for best viewing.
DOCUMENTATION:
See adodb/tests/test-datadict.php for docs and examples.
Modified 3 October, 2005 for use with ADOdb Lite by Mark Dickenson
*/
/*
Test script for parser
*/
// security - hide paths
if (!defined('ADODB_DIR')) die();
if (!function_exists('ctype_alnum')) {
function ctype_alnum($text) {
return preg_match('/^[a-z0-9]*$/i', $text);
}
}
function _array_change_key_case($an_array)
{
if (is_array($an_array)) {
$new_array = array();
foreach($an_array as $key=>$value)
$new_array[strtoupper($key)] = $value;
return $new_array;
}
return $an_array;
}
/**
Parse arguments, treat "text" (text) and 'text' as quotation marks.
To escape, use "" or '' or ))
Will read in "abc def" sans quotes, as: abc def
Same with 'abc def'.
However if `abc def`, then will read in as `abc def`
@param endstmtchar Character that indicates end of statement
@param tokenchars Include the following characters in tokens apart from A-Z and 0-9
@returns 2 dimensional array containing parsed tokens.
*/
function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-')
{
$pos = 0;
$intoken = false;
$stmtno = 0;
$endquote = false;
$tokens = array();
$tokens[$stmtno] = array();
$max = strlen($args);
$quoted = false;
while ($pos < $max) {
$ch = substr($args,$pos,1);
switch($ch) {
case ' ':
case "\t":
case "\n":
case "\r":
if (!$quoted) {
if ($intoken) {
$intoken = false;
$tokens[$stmtno][] = implode('',$tokarr);
}
break;
}
$tokarr[] = $ch;
break;
case '`':
if ($intoken) $tokarr[] = $ch;
case '(':
case ')':
case '"':
case "'":
if ($intoken) {
if (empty($endquote)) {
$tokens[$stmtno][] = implode('',$tokarr);
if ($ch == '(') $endquote = ')';
else $endquote = $ch;
$quoted = true;
$intoken = true;
$tokarr = array();
} else if ($endquote == $ch) {
$ch2 = substr($args,$pos+1,1);
if ($ch2 == $endquote) {
$pos += 1;
$tokarr[] = $ch2;
} else {
$quoted = false;
$intoken = false;
$tokens[$stmtno][] = implode('',$tokarr);
$endquote = '';
}
} else
$tokarr[] = $ch;
}else {
if ($ch == '(') $endquote = ')';
else $endquote = $ch;
$quoted = true;
$intoken = true;
$tokarr = array();
if ($ch == '`') $tokarr[] = '`';
}
break;
default:
if (!$intoken) {
if ($ch == $endstmtchar) {
$stmtno += 1;
$tokens[$stmtno] = array();
break;
}
$intoken = true;
$quoted = false;
$endquote = false;
$tokarr = array();
}
if ($quoted) $tokarr[] = $ch;
else if (ctype_alnum($ch) || strpos($tokenchars,$ch) !== false) $tokarr[] = $ch;
else {
if ($ch == $endstmtchar) {
$tokens[$stmtno][] = implode('',$tokarr);
$stmtno += 1;
$tokens[$stmtno] = array();
$intoken = false;
$tokarr = array();
break;
}
$tokens[$stmtno][] = implode('',$tokarr);
$tokens[$stmtno][] = $ch;
$intoken = false;
}
}
$pos += 1;
}
if ($intoken) $tokens[$stmtno][] = implode('',$tokarr);
return $tokens;
}
class ADODB_DataDict {
var $connection;
var $debug = false;
var $dropTable = 'DROP TABLE %s';
var $renameTable = 'RENAME TABLE %s TO %s';
var $dropIndex = 'DROP INDEX %s';
var $addCol = ' ADD';
var $alterCol = ' ALTER COLUMN';
var $dropCol = ' DROP COLUMN';
var $renameColumn = 'ALTER TABLE %s RENAME COLUMN %s TO %s'; // table, old-column, new-column, column-definitions (not used by default)
var $nameRegex = '\w';
var $nameRegexBrackets = 'a-zA-Z0-9_\(\)';
var $schema = false;
var $serverInfo = array();
var $autoIncrement = false;
var $invalidResizeTypes4 = array('CLOB','BLOB','TEXT','DATE','TIME'); // for changetablesql
var $blobSize = 100; /// any varchar/char field this size or greater is treated as a blob
/// in other words, we use a text area for editting.
var $metaTablesSQL;
var $metaColumnsSQL;
var $debug_echo = true;
var $fetchMode;
var $raiseErrorFn;
function SetFetchMode($mode)
{
GLOBAL $ADODB_FETCH_MODE;
$old = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = $mode;
return $old;
}
function outp($text)
{
$this->debug_output = "<br>\n(" . $this->dbtype . "): ".htmlspecialchars($text)."<br>\n";
if($this->debug_echo)
echo $this->debug_output;
}
function GetCommentSQL($table,$col)
{
return false;
}
function SetCommentSQL($table,$col,$cmt)
{
return false;
}
/**
* @param ttype can either be 'VIEW' or 'TABLE' or false.
* If false, both views and tables are returned.
* "VIEW" returns only views
* "TABLE" returns only tables
* @param showSchema returns the schema/user with the table name, eg. USER.TABLE
* @param mask is the input mask - only supported by oci8 and postgresql
*
* @return array of tables for current database.
*/
function MetaTables()
{
global $ADODB_FETCH_MODE;
$false = false;
if ($mask) {
return $false;
}
if ($this->metaTablesSQL) {
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
$rs = $this->Execute($this->metaTablesSQL);
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
if ($rs === false) return $false;
$arr =& $rs->GetArray();
$arr2 = array();
if ($hast = ($ttype && isset($arr[0][1]))) {
$showt = strncmp($ttype,'T',1);
}
for ($i=0; $i < sizeof($arr); $i++) {
if ($hast) {
if ($showt == 0) {
if (strncmp($arr[$i][1],'T',1) == 0) $arr2[] = trim($arr[$i][0]);
} else {
if (strncmp($arr[$i][1],'V',1) == 0) $arr2[] = trim($arr[$i][0]);
}
} else
$arr2[] = trim($arr[$i][0]);
}
$rs->Close();
return $arr2;
}
return $false;
}
/**
* List columns in a database as an array of ADOFieldObjects.
* See top of file for definition of object.
*
* @param table table name to query
* @param upper uppercase table name (required by some databases)
* @schema is optional database schema to use - not supported by all databases.
*
* @return array of ADOFieldObjects for current table.
*/
function MetaColumns($table, $upper=true, $schema=false)
{
global $ADODB_FETCH_MODE;
$false = false;
if (!empty($this->metaColumnsSQL)) {
$schema = false;
$this->_findschema($table,$schema);
$save = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
$rs = $this->connection->Execute(sprintf($this->metaColumnsSQL,($upper)?strtoupper($table):$table));
if (isset($savem)) $this->SetFetchMode($savem);
$ADODB_FETCH_MODE = $save;
if ($rs === false || $rs->EOF) return $false;
$retarr = array();
while (!$rs->EOF) { //print_r($rs->fields);
$fld = new ADOFieldObject();
$fld->name = $rs->fields[0];
$fld->type = $rs->fields[1];
if (isset($rs->fields[3]) && $rs->fields[3]) {
if ($rs->fields[3]>0) $fld->max_length = $rs->fields[3];
$fld->scale = $rs->fields[4];
if ($fld->scale>0) $fld->max_length += 1;
} else
$fld->max_length = $rs->fields[2];
if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
else $retarr[strtoupper($fld->name)] = $fld;
$rs->MoveNext();
}
$rs->Close();
return $retarr;
}
return $false;
}
function
没有合适的资源?快使用搜索试试~ 我知道了~
基于MVC的PHP框架
共56个文件
php:32个
inc:23个
html:1个
5星 · 超过95%的资源 需积分: 9 133 下载量 201 浏览量
2008-03-18
16:40:09
上传
评论
收藏 74KB RAR 举报
温馨提示
http://blog.csdn.net/liq330
资源推荐
资源详情
资源评论
收起资源包目录
com.rar (56个子文件)
com
views
index.php 305B
cache
config.php 740B
class
base.class.php 2KB
session.class.php 0B
error.class.php 784B
image.class.php 0B
html.class.php 0B
db
adodb.config.php 2KB
generic_modules
menu_module.inc 5KB
pear_module.inc 4KB
object_module.inc 1KB
adodb-errorhandler.inc.php 3KB
adodb-errorpear.inc.php 2KB
adodb-datadict.inc.php 27KB
adodbSQL_drivers
sybase
sybase_extend_module.inc 3KB
sybase_date_module.inc 7KB
sybase_transaction_module.inc 3KB
sybase_driver.inc 13KB
sybase_datadict.inc 4KB
odbc
odbc_transaction_module.inc 3KB
odbc_driver.inc 13KB
odbc_extend_module.inc 4KB
odbc_date_module.inc 6KB
odbc_datadict.inc 2KB
mysql
mysql_date_module.inc 7KB
mysql_datadict.inc 11KB
mysql_driver.inc 13KB
mysql_extend_module.inc 4KB
mysql_transaction_module.inc 2KB
mssql
mssql_date_module.inc 9KB
mssql_transaction_module.inc 3KB
mssql_datadict.inc 7KB
mssql_driver.inc 14KB
mssql_extend_module.inc 4KB
adodb-exceptions.inc.php 2KB
adodb.inc.php 9KB
control.class.php 678B
params.class.php 705B
model.class.php 187B
log.class.php 0B
mail.class.php 0B
pdf.class.php 0B
template
class.smarttemplateparser.php 10KB
class.smarttemplate.php 9KB
class.smarttemplatedebugger.php 12KB
upfile.class.php 0B
user.class.php 0B
models
controls
admin
views
test.html 6B
index.php 429B
cache
test_html.php 29B
models
member.php 182B
controls
test.php 176B
includes
router.inc.php 567B
includes
defines.inc.php 382B
framework.inc.php 451B
router.inc.php 567B
共 56 条
- 1
资源评论
- xiaodiejinghong2011-12-04仅仅是一个框架,里面任何内容都没有!!
- modoucomcn2012-02-10楼上说的对,这就是一个简单的框架!
- lvjuan19912013-02-24这只是一个简单的框架
liq330
- 粉丝: 54
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功