<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請(qǐng)您在轉(zhuǎn)載時(shí)注明出處http://www.tkk7.com/sxyx2008/謝謝合作!!!

    雪山飛鵠

    溫馨提示:您的每一次轉(zhuǎn)載,體現(xiàn)了我寫此文的意義!!!煩請(qǐng)您在轉(zhuǎn)載時(shí)注明出處http://www.tkk7.com/sxyx2008/謝謝合作!!!

    BlogJava 首頁(yè) 新隨筆 聯(lián)系 聚合 管理
      215 Posts :: 1 Stories :: 674 Comments :: 0 Trackbacks

    #

    創(chuàng)建數(shù)據(jù)庫(kù)的語(yǔ)法
    1、基本語(yǔ)法
    create database tour character set gbk;

    use tour;
    無主鍵自增長(zhǎng)的
    create table EMB_T_Employee
    (
       emb_c_operatorID     int not null,
       emb_c_empCode        varchar(255) not null,
       emb_c_gender         int not null,
       emb_c_email          varchar(255) not null,
       emb_c_empMPhone      varchar(255) not null,
       emb_c_empTel         varchar(255),
       emb_c_empZipCode     varchar(50),
       emb_c_empPID         varchar(50),
       emb_c_empBirthDate   datetime,
       emb_c_empAddress     varchar(512),
       emb_c_regDate        datetime not null,
       emb_c_displayOrder   int not null,
       primary key (emb_c_operatorID)
    )engine=INNODB default charset=gbk;
    有主鍵自增長(zhǎng)不控制主鍵的起點(diǎn)
    create table emb_t_dictBusType
    (
       emb_c_busTypeID      int not null auto_increment,
       emb_c_busTypeEnName  varchar(255) not null,
       emb_c_busTypeZhName  varchar(255) not null,
       primary key(emb_c_busTypeID)  
    )engine=INNODB  default charset=gbk;
    有主鍵自增長(zhǎng)控制主鍵的起點(diǎn)
    create table emb_t_dictBusType
    (
       emb_c_busTypeID      int not null auto_increment,
       emb_c_busTypeEnName  varchar(255) not null,
       emb_c_busTypeZhName  varchar(255) not null,
       primary key(emb_c_busTypeID)  
    )engine=INNODB auto_increment=1001 default charset=gbk;
    2、查看當(dāng)前所有的數(shù)據(jù)
    show databases;
    3、查看當(dāng)前數(shù)據(jù)庫(kù)的所有表
    show tables;
    4、查看表結(jié)構(gòu)
    desc emb_t_dictBusType ;
    5、查看字符集
    show variables like 'collation_%';
    show variables like 'character_set_%';
    6、修改數(shù)據(jù)庫(kù)的字符集
    alter database tour character set utf-8;
    posted @ 2010-06-27 01:36 雪山飛鵠 閱讀(2044) | 評(píng)論 (0)編輯 收藏

    創(chuàng)建數(shù)據(jù)庫(kù)表
    use master --切換到master數(shù)據(jù)庫(kù)
    go
    --檢測(cè)是否存在同名的數(shù)據(jù)庫(kù)
    if exists(select 1 from sysdatabases where name = 'tour')
    begin
      drop database tour
    end
    go
    create database tour
    on --數(shù)據(jù)文件
    (
      name = 'tour_mdf', --數(shù)據(jù)文件邏輯名
      filename = 'D:\tour.mdf',--數(shù)據(jù)文件存放路徑
      size = 1MB,--初始大小
      maxsize = 10MB,--最大大小
      filegrowth = 1MB--增長(zhǎng)速度
    )
    log on --日志文件
    (
      name = 'tour_ldf', --日志文件邏輯名
      filename = 'D:\tour.ldf',--日志文件存放路徑
      size = 1MB,--初始大小
      maxsize = 10MB,--最大大小
      filegrowth = 1MB--增長(zhǎng)速度
    )
    go
    use tour
    go
    創(chuàng)建數(shù)據(jù)庫(kù)表
    if exists(select * from sysobjects where name='stuInfo') drop table stuInfo
    create table   stuInfo    /*-創(chuàng)建學(xué)員信息表-*/
    (

    stuNo   varchar(6) not null unique,   --學(xué)號(hào),非空(必填)
    stuName  varchar(20) not null ,  --姓名,非空(必填)
    stuAge  int  not null,  --年齡,INT類型默認(rèn)為4個(gè)字節(jié)
    stuID  NUMERIC(18,0),     --身份證號(hào)
    stuSeat   int  IDENTITY (1,1),   --座位號(hào),自動(dòng)編號(hào)
    stuAddress   text   --住址,允許為空,即可選輸入
    )
    go

    if exists(select * from sysobjects where name='stuMarks') drop table stuMarks
    create table  stuMarks
    (
    ExamNo  varchar(6)  not null foreign key references stuInfo(stuNo) ,  --考號(hào)
    stuNo  varchar(6) not null,   --學(xué)號(hào)
    writtenExam  int  not null,  --筆試成績(jī)
    LabExam  int  not null    --機(jī)試成績(jī)
    )
    go

    if exists(select * from sysobjects where name='users') drop table users
    create table users
    (
        userID int not null primary key identity(1,1),
        userName varchar(255) not null unique,
        userPWD varchar(255) not null,
        userAge int,
        userBirthDay datetime,
        userEmail varchar(255)
    )
    go
    posted @ 2010-06-27 01:34 雪山飛鵠 閱讀(4511) | 評(píng)論 (0)編輯 收藏

    --創(chuàng)建臨時(shí)表空間
    create temporary tablespace tour_temp tempfile 'd:\OracleData\tour_temp.dbf' size 10m autoextend on next 10m maxsize unlimited extent

    management local;
    --創(chuàng)建數(shù)據(jù)表空間
    create tablespace tour_data logging datafile 'd:\OracleData\tour_data.dbf' size 20m autoextend on next 20m maxsize unlimited extent

    management local;
    --創(chuàng)建用戶并指定表空間
    create user tour identified by tour default tablespace tour_data temporary tablespace tour_temp;
    --給用戶授予權(quán)限
    grant connect,resource,dba to tour;
    --連接用戶或用戶登錄
    conn tour/tour;

    創(chuàng)建表
    非主鍵自增長(zhǎng)
    主表
    create table EMB_T_Role
    (
       emb_c_roleID         int not null,
       emb_c_roleEnName     varchar2(255) not null,
       emb_c_roleZhName     varchar2(255) not null,
       emb_c_displayOrder   int not null,
       primary key (emb_c_roleID)
    )tablespace tour_data;
    字表
    create table EMB_T_RoleMenu
    (
       emb_c_roleID         int not null,
       emb_c_menuID         int not null
    )tablespace tour_data;
    外鍵
    alter table EMB_T_RoleMenu add constraint FK_role_rmenu_roleID foreign key (emb_c_roleID)
          references EMB_T_Role (emb_c_roleID);

    主鍵自增長(zhǎng)
    創(chuàng)建表
    CREATE TABLE EG_THEME
    (
       THEMEID              INTEGER,
       THEMENAME            varchar2(256),
       MEMO                 varchar2(1000),
       constraint PK_THEME_ID primary key (THEMEID)
    ) tablespace dataInfo_data;
    創(chuàng)建序列
    create sequence seq_THEME_THEMEID increment by 1 start with 10001 maxvalue 999999999 minvalue 1;
    創(chuàng)建出發(fā)器
    create or replace trigger tri_THEME_THEMEID
    before insert on EG_THEME for each row
    begin
    select seq_THEME_THEMEID.nextval into:new.THEMEID from dual;
    end;
    /

    在oracle中只有創(chuàng)建序列和觸發(fā)器才可以解決主鍵自增長(zhǎng)的問題
    posted @ 2010-06-27 01:33 雪山飛鵠 閱讀(1923) | 評(píng)論 (0)編輯 收藏

    grant alter system to sxyx2008;
    grant audit system to sxyx2008;

    grant create session to sxyx2008;
    grant alter session to sxyx2008;
    grant restricted session to sxyx2008;
    grant debug connect session to sxyx2008;

    grant create tablespace to sxyx2008;
    grant alter tablespace to sxyx2008;
    grant manage tablespace to sxyx2008;
    grant drop tablespace to sxyx2008;
    grant unlimited tablespace to sxyx2008;

    grant create user to sxyx2008;
    grant become user to sxyx2008;
    grant alter user to sxyx2008;
    grant drop user to sxyx2008;

    grant create rollback segment to sxyx2008;
    grant alter rollback segment to sxyx2008;
    grant drop rollback segment to sxyx2008;

    grant create table to sxyx2008;
    grant create any table to sxyx2008;
    grant alter any table to sxyx2008;
    grant backup any table to sxyx2008;
    grant drop any table to sxyx2008;
    grant lock any table to sxyx2008;
    grant comment any table to sxyx2008;
    grant select any table to sxyx2008;
    grant insert any table to sxyx2008;
    grant update any table to sxyx2008;
    grant delete any table to sxyx2008;
    grant under any table to sxyx2008;
    grant flashback any table to sxyx2008;

    grant create cluster to sxyx2008;
    grant create any cluster to sxyx2008;
    grant alter any cluster to sxyx2008;
    grant drop any cluster to sxyx2008;

    grant create any index to sxyx2008;
    grant alter any index to sxyx2008;
    grant drop any index to sxyx2008;

    grant create synonym to sxyx2008;
    grant create any synonym to sxyx2008;
    grant drop any synonym to sxyx2008;
    grant create public synonym to sxyx2008;
    grant drop public synonym to sxyx2008;

    grant create view to sxyx2008;
    grant create any view to sxyx2008;
    grant drop any view to sxyx2008;
    grant under any view to sxyx2008;
    grant merge any view to sxyx2008;
    grant drop any materialized view to sxyx2008;
    grant create materialized view to sxyx2008;
    grant create any materialized view to sxyx2008;
    grant alter any materialized view to sxyx2008;

    grant create sequence to sxyx2008;
    grant create any sequence to sxyx2008;
    grant alter any sequence to sxyx2008;
    grant drop any sequence to sxyx2008;
    grant select any sequence to sxyx2008;

    grant create database link to sxyx2008;
    grant create public database link to sxyx2008;
    grant drop public database link to sxyx2008;
    grant alter database to sxyx2008;
    grant administer database trigger to sxyx2008;
    grant export full database to sxyx2008;
    grant import full database to sxyx2008;


    grant create role to sxyx2008;
    grant drop any role to sxyx2008;
    grant grant any role to sxyx2008;
    grant alter any role to sxyx2008;

    grant force transaction to sxyx2008;
    grant force any transaction to sxyx2008;
    grant select any transaction to sxyx2008;

    grant create procedure to sxyx2008;
    grant create any procedure to sxyx2008;
    grant alter any procedure to sxyx2008;
    grant drop any procedure to sxyx2008;
    grant execute any procedure to sxyx2008;
    grant debug any procedure to sxyx2008;

    grant create trigger to sxyx2008;
    grant create any trigger to sxyx2008;
    grant alter any trigger to sxyx2008;
    grant drop any trigger to sxyx2008;

    grant create profile to sxyx2008;
    grant alter profile to sxyx2008;
    grant drop profile to sxyx2008;
    grant drop any sql profile to sxyx2008;
    grant alter any sql profile to sxyx2008;
    grant create any sql profile to sxyx2008;

    grant create type to sxyx2008;
    grant create any type to sxyx2008;
    grant alter any type to sxyx2008;
    grant drop any type to sxyx2008;
    grant execute any type to sxyx2008;
    grant under any type to sxyx2008;

    grant create any directory to sxyx2008;
    grant drop any directory to sxyx2008;

    grant create library to sxyx2008;
    grant create any library to sxyx2008;
    grant alter any library to sxyx2008;
    grant drop any library to sxyx2008;
    grant execute any library to sxyx2008;

    grant create operator to sxyx2008;
    grant create any operator to sxyx2008;
    grant alter any operator to sxyx2008;
    grant drop any operator to sxyx2008;
    grant execute any operator to sxyx2008;

    grant create indextype to sxyx2008;
    grant create any indextype to sxyx2008;
    grant alter any indextype to sxyx2008;
    grant drop any indextype to sxyx2008;
    grant execute any indextype to sxyx2008;

    grant create dimension to sxyx2008;
    grant create any dimension to sxyx2008;
    grant alter any dimension to sxyx2008;
    grant drop any dimension to sxyx2008;

    grant manage any queue to sxyx2008;
    grant enqueue any queue to sxyx2008;
    grant dequeue any queue to sxyx2008;

    grant query rewrite to sxyx2008;
    grant global query rewrite to sxyx2008;

    grant create any context to sxyx2008;
    grant drop any context to sxyx2008;
    grant create evaluation context to sxyx2008;
    grant create any evaluation context to sxyx2008;
    grant alter any evaluation context to sxyx2008;
    grant drop any evaluation context to sxyx2008;
    grant execute any evaluation context to sxyx2008;

    grant create any outline to sxyx2008;
    grant alter any outline to sxyx2008;
    grant drop any outline to sxyx2008;

    grant create rule set to sxyx2008;
    grant create any rule set to sxyx2008;
    grant alter any rule set to sxyx2008;
    grant drop any rule set to sxyx2008;
    grant execute any rule set to sxyx2008;
    grant create rule to sxyx2008;
    grant create any rule to sxyx2008;
    grant alter any rule to sxyx2008;
    grant drop any rule to sxyx2008;
    grant execute any rule to sxyx2008;

    grant administer sql tuning set to sxyx2008;
    grant administer any sql tuning set to sxyx2008;

    grant manage file group to sxyx2008;
    grant manage any file group to sxyx2008;
    grant read any file group to sxyx2008;

    grant create job to sxyx2008;
    grant create any job to sxyx2008;
    grant create external job to sxyx2008;

    grant select any dictionary to sxyx2008;
    grant analyze any dictionary to sxyx2008;

    grant grant any privilege to sxyx2008;
    grant grant any object privilege to sxyx2008;

    grant exempt access policy to sxyx2008;
    grant exempt identity policy to sxyx2008;

    grant alter resource cost to sxyx2008;
    grant administer resource manager to sxyx2008;

    grant sysdba to sxyx2008;

    grant sysoper to sxyx2008;

    grant audit any to sxyx2008;

    grant analyze any to sxyx2008;

    grant on commit refresh to sxyx2008;

    grant resumable to sxyx2008;

    grant advisor to sxyx2008;

    grant execute any program to sxyx2008;

    grant execute any class to sxyx2008;

    grant manage scheduler to sxyx2008;

    grant change notification to sxyx2008;

    posted @ 2010-06-27 01:31 雪山飛鵠 閱讀(3666) | 評(píng)論 (0)編輯 收藏

    --創(chuàng)建臨時(shí)表空間
    create temporary tablespace eos_temp tempfile 'D:\oracle\product\10.2.0\oradata\orcl\eos_temp.dbf' size 10m autoextend on next 10m maxsize unlimited extent management local;
    --創(chuàng)建數(shù)據(jù)表空間
    create tablespace eos_space logging datafile 'D:\oracle\product\10.2.0\oradata\orcl\eos_data.dbf' size 20m autoextend on next 20m maxsize unlimited extent management local;
    --創(chuàng)建用戶并指定表空間
    create user eos identified by eos default tablespace eos_space temporary tablespace eos_temp;
    --給用戶授予權(quán)限
    grant connect,resource,dba to eos;
    --連接用戶或用戶登錄
    conn eos/eos;
    --查詢?cè)撚脩裘械谋?br /> select table_name from user_tables where user='eos';
    posted @ 2010-06-27 01:22 雪山飛鵠 閱讀(289) | 評(píng)論 (0)編輯 收藏

    "^\d+$"  //非負(fù)整數(shù)(正整數(shù) + 0)
    "^[0-9]*[1-9][0-9]*$"  //正整數(shù)
    "^((-\d+)|(0+))$"  //非正整數(shù)(負(fù)整數(shù) + 0)
    "^-[0-9]*[1-9][0-9]*$"  //負(fù)整數(shù)
    "^-?\d+$"    //整數(shù)
    "^\d+(\.\d+)?$"  //非負(fù)浮點(diǎn)數(shù)(正浮點(diǎn)數(shù) + 0)
    "^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$"  //正浮點(diǎn)數(shù)
    "^((-\d+(\.\d+)?)|(0+(\.0+)?))$"  //非正浮點(diǎn)數(shù)(負(fù)浮點(diǎn)數(shù) + 0)
    "^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$"  //負(fù)浮點(diǎn)數(shù)
    "^(-?\d+)(\.\d+)?$"  //浮點(diǎn)數(shù)
    "^[A-Za-z]+$"  //由26個(gè)英文字母組成的字符串
    "^[A-Z]+$"  //由26個(gè)英文字母的大寫組成的字符串
    "^[a-z]+$"  //由26個(gè)英文字母的小寫組成的字符串
    "^[A-Za-z0-9]+$"  //由數(shù)字和26個(gè)英文字母組成的字符串
    "^\w+$"  //由數(shù)字、26個(gè)英文字母或者下劃線組成的字符串
    "^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$"    //email地址
    "^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$"  //url
    /^(d{2}|d{4})-((0([1-9]{1}))|(1[1|2]))-(([0-2]([1-9]{1}))|(3[0|1]))$/   //  年-月-日
    /^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$/   // 月/日/年
    "^([w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$"   //Emil
    /^((\+?[0-9]{2,4}\-[0-9]{3,4}\-)|([0-9]{3,4}\-))?([0-9]{7,8})(\-[0-9]+)?$/     //電話號(hào)碼
    "^(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5])$"   //IP地址

    匹配中文字符的正則表達(dá)式: [\u4e00-\u9fa5]
    匹配雙字節(jié)字符(包括漢字在內(nèi)):[^\x00-\xff]
    匹配空行的正則表達(dá)式:\n[\s| ]*\r
    匹配HTML標(biāo)記的正則表達(dá)式:/<(.*)>.*<\/\1>|<(.*) \/>/
    匹配首尾空格的正則表達(dá)式:(^\s*)|(\s*$)
    匹配Email地址的正則表達(dá)式:\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
    匹配網(wǎng)址URL的正則表達(dá)式:^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$
    匹配帳號(hào)是否合法(字母開頭,允許5-16字節(jié),允許字母數(shù)字下劃線):^[a-zA-Z][a-zA-Z0-9_]{4,15}$
    匹配國(guó)內(nèi)電話號(hào)碼:(\d{3}-|\d{4}-)?(\d{8}|\d{7})?
    匹配騰訊QQ號(hào):^[1-9]*[1-9][0-9]*$


    元字符及其在正則表達(dá)式上下文中的行為:

    \ 將下一個(gè)字符標(biāo)記為一個(gè)特殊字符、或一個(gè)原義字符、或一個(gè)后向引用、或一個(gè)八進(jìn)制轉(zhuǎn)義符。

    ^ 匹配輸入字符串的開始位置。如果設(shè)置了 RegExp 對(duì)象的Multiline 屬性,^ 也匹配 ’\n’ 或 ’\r’ 之后的位置。

    $ 匹配輸入字符串的結(jié)束位置。如果設(shè)置了 RegExp 對(duì)象的Multiline 屬性,$ 也匹配 ’\n’ 或 ’\r’ 之前的位置。

    * 匹配前面的子表達(dá)式零次或多次。

    + 匹配前面的子表達(dá)式一次或多次。+ 等價(jià)于 {1,}。

    ? 匹配前面的子表達(dá)式零次或一次。? 等價(jià)于 {0,1}。

    {n} n 是一個(gè)非負(fù)整數(shù),匹配確定的n 次。

    {n,} n 是一個(gè)非負(fù)整數(shù),至少匹配n 次。

    {n,m} m 和 n 均為非負(fù)整數(shù),其中n <= m。最少匹配 n 次且最多匹配 m 次。在逗號(hào)和兩個(gè)數(shù)之間不能有空格。

    ? 當(dāng)該字符緊跟在任何一個(gè)其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面時(shí),匹配模式是非貪婪的。非貪婪模式盡可能少的匹配所搜索的字符串,而默認(rèn)的貪婪模式則盡可能多的匹配所搜索的字符串。

    . 匹配除 "\n" 之外的任何單個(gè)字符。要匹配包括 ’\n’ 在內(nèi)的任何字符,請(qǐng)使用象 ’[.\n]’ 的模式。
    (pattern) 匹配pattern 并獲取這一匹配。

    (?:pattern) 匹配pattern 但不獲取匹配結(jié)果,也就是說這是一個(gè)非獲取匹配,不進(jìn)行存儲(chǔ)供以后使用。

    (?=pattern) 正向預(yù)查,在任何匹配 pattern 的字符串開始處匹配查找字符串。這是一個(gè)非獲取匹配,也就是說,該匹配不需要獲取供以后使用。

    (?!pattern) 負(fù)向預(yù)查,與(?=pattern)作用相反

    x|y 匹配 x 或 y。

    [xyz] 字符集合。

    [^xyz] 負(fù)值字符集合。

    [a-z] 字符范圍,匹配指定范圍內(nèi)的任意字符。

    [^a-z] 負(fù)值字符范圍,匹配任何不在指定范圍內(nèi)的任意字符。

    \b 匹配一個(gè)單詞邊界,也就是指單詞和空格間的位置。

    \B 匹配非單詞邊界。

    \cx 匹配由x指明的控制字符。

    \d 匹配一個(gè)數(shù)字字符。等價(jià)于 [0-9]。

    \D 匹配一個(gè)非數(shù)字字符。等價(jià)于 [^0-9]。

    \f 匹配一個(gè)換頁(yè)符。等價(jià)于 \x0c 和 \cL。

    \n 匹配一個(gè)換行符。等價(jià)于 \x0a 和 \cJ。

    \r 匹配一個(gè)回車符。等價(jià)于 \x0d 和 \cM。

    \s 匹配任何空白字符,包括空格、制表符、換頁(yè)符等等。等價(jià)于[ \f\n\r\t\v]。

    \S 匹配任何非空白字符。等價(jià)于 [^ \f\n\r\t\v]。

    \t 匹配一個(gè)制表符。等價(jià)于 \x09 和 \cI。

    \v 匹配一個(gè)垂直制表符。等價(jià)于 \x0b 和 \cK。

    \w 匹配包括下劃線的任何單詞字符。等價(jià)于’[A-Za-z0-9_]’。

    \W 匹配任何非單詞字符。等價(jià)于 ’[^A-Za-z0-9_]’。

    \xn 匹配 n,其中 n 為十六進(jìn)制轉(zhuǎn)義值。十六進(jìn)制轉(zhuǎn)義值必須為確定的兩個(gè)數(shù)字長(zhǎng)。

    \num 匹配 num,其中num是一個(gè)正整數(shù)。對(duì)所獲取的匹配的引用。

    \n 標(biāo)識(shí)一個(gè)八進(jìn)制轉(zhuǎn)義值或一個(gè)后向引用。如果 \n 之前至少 n 個(gè)獲取的子表達(dá)式,則 n 為后向引用。否則,如果 n 為八進(jìn)制數(shù)字 (0-7),則 n 為一個(gè)八進(jìn)制轉(zhuǎn)義值。

    \nm 標(biāo)識(shí)一個(gè)八進(jìn)制轉(zhuǎn)義值或一個(gè)后向引用。如果 \nm 之前至少有is preceded by at least nm 個(gè)獲取得子表達(dá)式,則 nm 為后向引用。如果 \nm 之前至少有 n 個(gè)獲取,則 n 為一個(gè)后跟文字 m 的后向引用。如果前面的條件都不滿足,若 n 和 m 均為八進(jìn)制數(shù)字 (0-7),則 \nm 將匹配八進(jìn)制轉(zhuǎn)義值 nm。

    \nml 如果 n 為八進(jìn)制數(shù)字 (0-3),且 m 和 l 均為八進(jìn)制數(shù)字 (0-7),則匹配八進(jìn)制轉(zhuǎn)義值 nml。

    \un 匹配 n,其中 n 是一個(gè)用四個(gè)十六進(jìn)制數(shù)字表示的Unicode字符。

    匹配中文字符的正則表達(dá)式: [u4e00-u9fa5]

    匹配雙字節(jié)字符(包括漢字在內(nèi)):[^x00-xff]

    匹配空行的正則表達(dá)式:n[s| ]*r

    匹配HTML標(biāo)記的正則表達(dá)式:/<(.*)>.*</1>|<(.*) />/

    匹配首尾空格的正則表達(dá)式:(^s*)|(s*$)

    匹配Email地址的正則表達(dá)式:w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*

    匹配網(wǎng)址URL的正則表達(dá)式:http://([w-]+.)+[w-]+(/[w- ./?%&=]*)?

    利用正則表達(dá)式限制網(wǎng)頁(yè)表單里的文本框輸入內(nèi)容:

    用正則表達(dá)式限制只能輸入中文:onkeyup="value=value.replace(/[^u4E00-u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^u4E00-u9FA5]/g,''))"

    用正則表達(dá)式限制只能輸入全角字符: onkeyup="value=value.replace(/[^uFF00-uFFFF]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^uFF00-uFFFF]/g,''))"

    用正則表達(dá)式限制只能輸入數(shù)字:onkeyup="value=value.replace(/[^d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^d]/g,''))"

    用正則表達(dá)式限制只能輸入數(shù)字和英文:onkeyup="value=value.replace(/[W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^d]/g,''))"

    =========常用正則表達(dá)式

    匹配中文字符的正則表達(dá)式: [\u4e00-\u9fa5]

    匹配雙字節(jié)字符(包括漢字在內(nèi)):[^\x00-\xff]

    匹配空行的正則表達(dá)式:\n[\s| ]*\r

    匹配HTML標(biāo)記的正則表達(dá)式:/<(.*)>.*<\/\1>|<(.*) \/>/

    匹配首尾空格的正則表達(dá)式:(^\s*)|(\s*$)

    匹配IP地址的正則表達(dá)式:/(\d+)\.(\d+)\.(\d+)\.(\d+)/g //

    匹配Email地址的正則表達(dá)式:\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

    匹配網(wǎng)址URL的正則表達(dá)式:http://(/[\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?

    sql語(yǔ)句:^(select|drop|delete|create|update|insert).*$

    1、非負(fù)整數(shù):^\d+$

    2、正整數(shù):^[0-9]*[1-9][0-9]*$

    3、非正整數(shù):^((-\d+)|(0+))$

    4、負(fù)整數(shù):^-[0-9]*[1-9][0-9]*$

    5、整數(shù):^-?\d+$

    6、非負(fù)浮點(diǎn)數(shù):^\d+(\.\d+)?$

    7、正浮點(diǎn)數(shù):^((0-9)+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$

    8、非正浮點(diǎn)數(shù):^((-\d+\.\d+)?)|(0+(\.0+)?))$

    9、負(fù)浮點(diǎn)數(shù):^(-((正浮點(diǎn)數(shù)正則式)))$

    10、英文字符串:^[A-Za-z]+$

    11、英文大寫串:^[A-Z]+$

    12、英文小寫串:^[a-z]+$

    13、英文字符數(shù)字串:^[A-Za-z0-9]+$

    14、英數(shù)字加下劃線串:^\w+$

    15、E-mail地址:^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$

    16、URL:^[a-zA-Z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\s*)?$
    或:^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$

    17、郵政編碼:^[1-9]\d{5}$

    18、中文:^[\u0391-\uFFE5]+$

    19、電話號(hào)碼:^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$

    20、手機(jī)號(hào)碼:^((\(\d{2,3}\))|(\d{3}\-))?13\d{9}$

    21、雙字節(jié)字符(包括漢字在內(nèi)):^\x00-\xff

    22、匹配首尾空格:(^\s*)|(\s*$)(像vbscript那樣的trim函數(shù))

    23、匹配HTML標(biāo)記:<(.*)>.*<\/\1>|<(.*) \/>

    24、匹配空行:\n[\s| ]*\r

    25、提取信息中的網(wǎng)絡(luò)鏈接:(h|H)(r|R)(e|E)(f|F) *= *('|")?(\w|\\|\/|\.)+('|"| *|>)?

    26、提取信息中的郵件地址:\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

    27、提取信息中的圖片鏈接:(s|S)(r|R)(c|C) *= *('|")?(\w|\\|\/|\.)+('|"| *|>)?

    28、提取信息中的IP地址:(\d+)\.(\d+)\.(\d+)\.(\d+)

    29、提取信息中的中國(guó)手機(jī)號(hào)碼:(86)*0*13\d{9}

    30、提取信息中的中國(guó)固定電話號(hào)碼:(\(\d{3,4}\)|\d{3,4}-|\s)?\d{8}

    31、提取信息中的中國(guó)電話號(hào)碼(包括移動(dòng)和固定電話):(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}

    32、提取信息中的中國(guó)郵政編碼:[1-9]{1}(\d+){5}

    33、提取信息中的浮點(diǎn)數(shù)(即小數(shù)):(-?\d*)\.?\d+

    34、提取信息中的任何數(shù)字 :(-?\d*)(\.\d+)?

    35、IP:(\d+)\.(\d+)\.(\d+)\.(\d+)

    36、電話區(qū)號(hào):/^0\d{2,3}$/

    37、騰訊QQ號(hào):^[1-9]*[1-9][0-9]*$

    38、帳號(hào)(字母開頭,允許5-16字節(jié),允許字母數(shù)字下劃線):^[a-zA-Z][a-zA-Z0-9_]{4,15}$

    39、中文、英文、數(shù)字及下劃線:^[\u4e00-\u9fa5_a-zA-Z0-9]+$

    posted @ 2010-06-25 22:21 雪山飛鵠 閱讀(3113) | 評(píng)論 (0)編輯 收藏

            近期在做多個(gè)數(shù)據(jù)庫(kù)應(yīng)用交互系統(tǒng),其中數(shù)據(jù)交互采用了webservice的方式,說到webservice項(xiàng)目中不得不用到xfire這個(gè)框架,有了它我們幾乎不用寫代碼,就可以很快速的創(chuàng)建自己的webservice
            但在使用的過程中遇到一些小細(xì)節(jié)上的問題:
    就是在寫webservice接口的時(shí)候,通常大家都會(huì)定義一些方法的參數(shù),但是根據(jù)xfire的xsd文件描述情況來看,它的參數(shù)命名通常是in0,in1等等,一次類推,很不友好。
            按照XFire-Spring生成的WSDL文檔中接口參數(shù)名極不友好:
    <xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="xsd:string" />
    <xsd:element maxOccurs="1" minOccurs="1" name="in1" nillable="true" type="xsd:string" />
    <xsd:element maxOccurs="1" minOccurs="1" name="in2" nillable="true" type="xsd:string" />
    <xsd:element maxOccurs="1" minOccurs="1" name="in3" nillable="true" type="xsd:string" />
            大家都知道,作為一個(gè)合格的程序員,在寫代碼的時(shí)候方法參數(shù)命名什么的要盡量做到見名知意,顯然他這種風(fēng)格是不適合我們的。因此我們要?jiǎng)?chuàng)新,這就有了下文。
            如何自動(dòng)將in0與in1替換成友好的參數(shù)名稱呢 ?
            方法如下:
      1.在與接口類同一包下面建一個(gè)接口類名稱.aegis.xml 的文件,內(nèi)容如下
    <?xml version="1.0" encoding="UTF-8"?>  
    <mappings>  
        <mapping>  
           <method name="settleMessage">  
               <parameter index="0"  mappedName="id" />
               <parameter index="1"  mappedName="username" />
               <parameter index="2"  mappedName="pass" /> 
           </method>
       </mapping>  
    </mappings> 

            注意:
                    name為接口中方法名稱
                    index為方法中第一個(gè)參數(shù)
                    mappedName為替換后的名稱
                    該XML文件的位置一定要與你定義的webservice的接口位于同一個(gè)目錄(包下)否則不起作用

     

    posted @ 2010-06-07 10:13 雪山飛鵠 閱讀(2868) | 評(píng)論 (5)編輯 收藏

            Android模擬器(simulator)把它自己作為了localhost,也就是說,代碼中使用localhost或者127.0.0.1來訪問,都是訪問模擬器自己!這是不行的!
            如果你想在模擬器simulator上面訪問你的電腦,那么就使用android內(nèi)置的IP 10.0.2.2 吧,10.0.2.2 是模擬器設(shè)置的特定ip,是你的電腦的別名alias

            記住,在模擬器上用10.0.2.2訪問你的電腦本機(jī)。

            詳細(xì)請(qǐng)參考Android文檔android-sdk-windows\docs\guide\developing\devices\emulator.html下的Emulator Networking

              
    Network Address Description
    10.0.2.1 Router/gateway address
    10.0.2.2 Special alias to your host loopback interface (i.e., 127.0.0.1 on your development machine)
    10.0.2.3 First DNS server
    10.0.2.4 / 10.0.2.5 / 10.0.2.6 Optional second, third and fourth DNS server (if any)
    10.0.2.15 The emulated device's own network/ethernet interface
    127.0.0.1 The emulated device's own loopback interface

    posted @ 2010-06-06 16:29 雪山飛鵠 閱讀(5872) | 評(píng)論 (2)編輯 收藏

    int startPage=1  //起始頁(yè)
    int endPage;     //終止頁(yè)
    int pageSize=5;  //頁(yè)大小
    int pageNumber=1 //請(qǐng)求頁(yè)

    startPage=(pageNumber-1)*pageSize+1
    endPage=(startPage+pageSize);


    select * from (select 字段1,字段2,字段3,字段4,字段5,rownumber() over(order by 排序字段 asc ) as rowid  from 表名 )as a where a.rowid >= startPage AND a.rowid <endPage

    //以下sql表示取5條數(shù)據(jù) 從1取到5
    select * from (select dslsid,zzjgdm,frmc,frlx,mc,frzs,fddbrxm,clrq,frzch,nsrglm,swdjrq,bgbs,bgcz,bgrq,swdjjgdm,orgdeptname,nsrsbh ,rownumber() over(order by dslsid asc ) as rowid  from FR_V_DSLS )as a where a.rowid BETWEEN 1 AND 6

    不好意思,犯了個(gè)低級(jí)錯(cuò)誤,上面的sql語(yǔ)句是有誤的,原因在于對(duì)between and的錯(cuò)誤理解
    本人記得between and是包含前者,不包含后者,實(shí)驗(yàn)表明,between and 前后兩者都包含。
    所以上述語(yǔ)句應(yīng)修改為:
    select * from (select dslsid,zzjgdm,frmc,frlx,mc,frzs,fddbrxm,clrq,frzch,nsrglm,swdjrq,bgbs,bgcz,bgrq,swdjjgdm,orgdeptname,nsrsbh ,rownumber() over(order by dslsid asc ) as rowid  from FR_V_DSLS )as a where a.rowid >= 1 AND  a.rowid < 6

    留著上面的語(yǔ)句加深印象。

     

    posted @ 2010-06-04 15:11 雪山飛鵠 閱讀(11859) | 評(píng)論 (3)編輯 收藏

    // 讀取PDF的內(nèi)容
     public String getPdfContent(String filePath) {
      
      // 設(shè)置pdftotext所在的路徑
      String excute = "E:\\JAR\\xpdf\\xpdf-3.02pl4-win32\\pdftotext.exe";
      //構(gòu)造命令行里面的命令
      String[] cmd = new String[] { excute, "-enc", "UTF-8", "-q", filePath,"-" };
      Process p = null;
      try {
       // 調(diào)用本地命令,類似于在cmd里面敲上述命令
       p = Runtime.getRuntime().exec(cmd);
      } catch (IOException e) {
       e.printStackTrace();
      }
      //封裝成字符流
      BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
      InputStreamReader reader = null;

      try {
       reader = new InputStreamReader(bis, "UTF-8");
      } catch (UnsupportedEncodingException e1) {
       e1.printStackTrace();
      }

      StringBuffer sb = new StringBuffer();
      BufferedReader br = new BufferedReader(reader);
      String line;
      
      try {
       line = br.readLine();
       sb = new StringBuffer();
       while (line != null) {
        sb.append(line);
        sb.append(" ");
        line = br.readLine();
       }
      } catch (IOException e) {
       e.printStackTrace();
      }
      return sb.toString();
     }

    posted @ 2010-05-31 09:10 雪山飛鵠 閱讀(3334) | 評(píng)論 (5)編輯 收藏

    僅列出標(biāo)題
    共22頁(yè): First 上一頁(yè) 14 15 16 17 18 19 20 21 22 下一頁(yè) 
    主站蜘蛛池模板: 久久精品国产亚洲5555| 精品免费国产一区二区三区| 国产乱人免费视频| 最新国产精品亚洲| 日韩吃奶摸下AA片免费观看| 亚洲综合久久1区2区3区| 无码国产精品一区二区免费16| 久久精品国产69国产精品亚洲| 一级做a爱过程免费视频高清| 亚洲情侣偷拍精品| 人成午夜免费视频在线观看| 久久精品国产亚洲av日韩| 最近在线2018视频免费观看| 国产免费av片在线播放| 精品亚洲成A人在线观看青青| 日韩在线免费播放| 免费无码AV一区二区| 亚洲精品尤物yw在线影院| a级在线免费观看| 亚洲精品一卡2卡3卡三卡四卡| 91精品免费久久久久久久久| 亚洲久悠悠色悠在线播放| 国产精品免费视频播放器| 九九免费精品视频在这里| 亚洲精品无码精品mV在线观看| 无码中文字幕av免费放dvd| 亚洲精品熟女国产| 日韩一区二区免费视频| 免费无码又爽又黄又刺激网站| 亚洲精品中文字幕无码蜜桃| 91福利免费视频| 亚洲AV无码资源在线观看| 亚洲日本中文字幕一区二区三区| 久久免费观看国产精品| 亚洲看片无码在线视频 | 精品国产日韩亚洲一区91| 国产精品亚洲不卡一区二区三区| 久久精品无码精品免费专区| 色天使亚洲综合在线观看| 亚洲麻豆精品国偷自产在线91| 小草在线看片免费人成视久网|