Author Archives: tunpishuang
正则表达式 mysql字段转oracle一例
某mysql字段如下: `test_id` int(11) not null auto_increment comment '自增字段', 而且有大量的这样字段需要转到oracle,首先我们知道oracle的字段描述里面是没有comment的,但是同时也需要保留comment信息。使用正则表达式来转换,用notepad++正则表达式替换: 查找目标: comment(.*), 替换为: ,comment\1 \1表示的是(.*)的内容 最后替换为: `staff_id` int(11) not null auto_increment ,– '自增字段' 然后去掉反引号,去掉auto_increment,手动加上constraint primary key。
sql语句格式化工具 SQL formatting tool
SQL Review – SQL formatting tool 一个java写的gui程序(运行需要安装jre),支持java,perl,php,c#,vb(asp)的语法输出。 支持设定关键字和语句的大小写 支持设定“字段分割符”逗号设定在头部还是尾部 支持设定压缩空格 设定行号 自定义包裹字段名的符号(默认是反引号) 自定义缩进 SQL Formatter 在线java applet,无需安装,免费,非开源。 和SQL Review一样,支持各种语言输出 原SQL支持:DB2/UDB/Oracle/Access/SQL Server/MySQL/Sybase/PostgreSQL/Informix 自定义缩进 各种复杂的换行配置 各种语句的空格、逗号设置 SQLFormat – Online SQL Formatting Service appspot站点,需要翻墙,有源码、API 去掉注释 语法高亮 支持文件上传 支持各种语言输出 T-SQL Tidy 各种各样的复杂设置 SQL and … Continue reading
oracle给not null约束指定名称
一般我们建表结构的时候都是使用以下的形式: create table test( menuid number(8) default '0' not null, name varchar2(40) not null, id_parent number(10) not null, url varchar2(300) null, constraint pk_test primary key(menuid) ); 执行后,查看这个test表的所有约束: select constraint_name,table_name from user_constraints 发现命名都是SYS_CXXXXXX(XXXXXX表示数字),这些是oracle自动给约束的命名,我感觉为了提高以后数据库的可维护性,还是需要给not null约束指定名称,语法很简单: create table test( menuid number(8) default '0' … Continue reading
oracle没有create or replace table
SQL> create or replace table testTb; create or replace table testTb ORA-00922: 选项缺失或无效 只能使用先drop再create来代替 drop table testTb; create teble testTb( fid varchar2(4), fname varchar2(10) ); 可以用create or replace的对象有:functions, procedures, packages, types, synonyms, trigger and views,就是没有table,也没有sequence。 drop掉一个并不存在的表报错: SQL> drop table non_exists; … Continue reading
支持firefox 4的autoproxy扩展
版本 0.4b1.0+.2011032419 March 24, 2011 114.7 KB 0.4b2.2011041023 发布了。 所有版本:https://addons.mozilla.org/zh-CN/firefox/addon/autoproxy/versions/ 支持 Firefox 4 ,还没有通过firefox addon审核。
#167 codeigniter oci8 database driver do not support setting charset and session_mode while ocilogon() to oracle db
system/database/drivers/oci8/oci8_driver.php line 80 db_connect() function did not support set the charset and session mode while connecting to oracle db. function db_connect() { return @ocilogon($this->username, $this->password, $this->hostname); } function db_pconnect() { return @ocilogon($this->username, $this->password, $this->hostname); } here is the prototype of … Continue reading
codeigniter配置oracle数据库连接
Connection Parameters Not all of the parameters in application/config/database.php are used as one might expect. Namely, $db[‘default’][‘database’] isn’t used at all. The value used for $db[‘default’][‘hostname’] depends on whether the Oracle client’s tnsnames.ora file exists and contains information about the … Continue reading
codeigniter字符集编码问题
codeigniter里面的php文件都是ansi编码,其实我们在添加controller,model,view等php文件的时候,php文件的编码成了一个问题。其实这个关系不大。 如果真个项目采用utf-8,那么就将php文件的编码设置为utf-8 without bom,然后html模板文件meta写成: <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> mysql数据库统一字符集utf-8,校队:utf8_general_ci 就可以了,系统可以在“标准规范模式”正常浏览不出现乱码。 可能在后期处理上传的ms office文档的时候有转码的需要。
4次重装oracle的教训(OracleDBConsoleORCL启动错误:系统错误3)
安装前请确定机子的ip不是dhcp获取的,否则当重新获得了ip,就无法连接,就杯具了。 最好是拔点网线,然后停用vmware的所有虚拟网站和无线网卡 D:\oracle\product\10.2.0\db_1 目录下有个x.x.x.x_orcl目录,那个x.x.x.x就是你安装时候oracle获取你的主机ip,如果获取的是dhcp ip就杯具了。如果是主机名_orcl或者是localhost_orcl就ok。不过我估计即便是被dhcp悲剧了也能手动修改回来的,我也尝试了,但是失败,应该还有我没有触及到的神秘文件。
CodeIgniter用Xdebug调试的问题:The URI you submitted has disallowed characters.
最近玩codeigniter,使用netbeans写代码,调试器使用xdebug(貌似netbeans不支持zend debugger?之前用过的zend studio支持zend debugger),写了一个demo,然后ctrl+F5调试的时候,进过(F8)了几步之后出现如图上的问题:”The URI you submitted has disallowed characters.”,因为codeigniter对$_GET、$_POST等外来参数有一个“白名单”的机制来加强了安全性,如果你的参数没有加入“白名单”,那肯定是有问题了。 而xdebug调试的时候自动加上了参数 XDEBUG_SESSION_START,所以肯定报错。 http://ci-study/index.php?XDEBUG_SESSION_START=tun-xdebug An Error Was Encountered The URI you submitted has disallowed characters. 在CI 2.0的/application/config/config.php Line 112有以下内容: /*|————————————————————————–| Allowed URL Characters|————————————————————————–|| This lets you specify with a regular expression … Continue reading