第一篇:ICC使用小结
ICC使用小结
(1)ICC的输入文件
MilkyWay(physical library),TLUPlus文件(interconnect文件),lib文件(logical library),netlist,constraints(sdc),floorplan文件(.fp或.def)
由于ICC会使用MilkyWay数据格式,因此有必要先熟悉MilkyWay格式的产生。
(2)ICC的步骤流程
ICC的流程如下:(1)import design(netlist/sdc/database)——(2)create_floorplan或adjust floorplan——(3)placement ——(4)cts——(5)route——(6)final signoff(3)具体每一步过程及注意点(操作点)(4)Import design具体操作:
set_link_library xxx set_target_library xxx create_mu_lib design_library –technology xxx.tf –mw_reference_library ref_library open set_tlu_plus_file –max_tluplus max_file –min_tluplus min_file –tech2itf_map map_file read_verilog xxx.v current_design xxx link read_def xxx.def derive_pg_connection –power_net xxx_power_net –power_pin xxx_power_pin –ground_net xxx_ground_net –ground_pin xxx_ground_pin derive_pg_connection –power_net xxx_power_net –power_pin xxx_power_pin –ground_net xxx_ground_net –ground_pin xxx_ground_pin-tie read_floorplan xxx.fp或新创建一个floorplan接下来的任务了。
(5)Create_floorplan具体操作:
Create_floorplan针对读入的设计以及def,开始进行floorplan的规划,包括IO以及macro的摆放,电源规划等。
首先要创建一个floorplan,创建floorplan之前需要读入IO的约束信息,3101项目将IO视作macro对待。具体的io constraint信号可以使用set_pad_physical_constraints来设置。
Create_floorplan –control_type width_and_height –core_width xxx –core_height xxx Remove_terminal *-keep_macro_place –keep_std_cell_place,只有设置了keep之后,才能create_fp_place完成,否则会报utility超出。
设置好floorplan之后就需要对macro和standcell进行place了。Macro的place可以使用脚本set_obj*和set_attribute来设置,而standcell可以使用create_fP_placement来完成。这个过程中先需要设置placement以及route的blockage。create_place_blockage和create_route_guide来完成blockage的设置。
接着设置在Design Planning的task任务下,进行place macros和standcells。或者使用create_fp_placement –timing_driven –no_hierarchy_gravity 设置完macro和standcell之后,就可以进行电源规划了,可以通过产生power_ring或power_strap来进行。create_power_strap –direction horizontal –net {VDD12 VSS_PAD} –layer M5 –configure step_end_stop –start_at 1290 –stop 2170 –step 50 –width 5 –start_low_ends coordinate –start_low_ends_coordinate 583 –start_high_ends coordinate –start_high_ends_coordinate 1710 –extend_low_ends off –extend_high_ends off –keep_floating_wire_pieces –ignore_parallel_targets –define_parallel_targets_by_wire_directions 下面对上面这个strap的创建进行解释说明下,上面的power_strap表示要在位置区域为{{1290 583} {2170 1710}}的方形区域创建间距为50,线宽为5的水平方向power_strap。
(6)placement的具体操作
place_opt进行之前需要先查看report_constraints –all看看主要的violation是哪些,同时也应该查看congestion情况以选择合适的place_opt策略。也需要检查设计及物理信息,check_physical_design –for_placement以及check_design –physical,设置set_ignore_layers –max/-min,接着create_placement –timing_driven/-congestion等,若有congestion,可以设置set_congestion_options来设置合理的值,设置好placement的一些参数后,可以进行place_opt了。
(7)cts的具体操作
cts可以通过GUI—>New Clock Tree Synthesis Window/New Interactive CTS Window查看时钟树的直观形状,可以设置clock_routing_rule来合理安排时钟树的线宽(NDR,Non-Default Rule)。设置OCV和bc_wc的工作条件。
(8)route的具体操作
需要先check_physical_design –for_routing检查布线的物理设计,以及check_routeability。Set_route_options可以设置route设置相关的选项,route_opt包括route clock nets,route signal nets,set_route_opt_strategy可以设置route相关的策略。分析route的结果可以使用verify_route和verify_drc(使用hercules),postroute delay calculation using Arnoldi algorithm。考虑si的route需要设置set_si_options。Spread_eco_cells/insert_spare_cells,place_freezen_silicon/route_eco
第二篇:ICC(A)中英文对照
承保风险
(风险条款)
本保险承保保险标的损失或损害的一切风险,但不包括下列第4、5、6和7条规定的除外责任
(共同海损条款)
本保险承保根据运输合同、准据法和惯例理算或确定的共同海损和救助费用,其产生是为了避免任何原因造成的损失或与避免任何原因造成的损失有关,但此种原因不是本保险第4,5,6,7条或其他条文除外的危险
(“双方有责碰撞”条款)
本保险扩展赔偿被保险人诸如下文可补偿的损失方面根据运输合同中的“双方有责碰撞”条款的比例责任部分。在船东根据此条款提出索赔的情况下,被保险人同意通知保险人,保险人有权自负费用为被保险人对此种索赔提出答辩。
除外责任
(普通除外条款)4 本保险决不承保;
4.1 可归咎于被保险人的蓄意恶性的损失、损害或费用
4.2 保险标的的通常渗漏、通常重量或体积损失、或通常磨损
4.3 保险标的的包装或准备不足或不当引起的损失、损害或费用(在本款意义上,“包装”应视为包括集装箱或托盘内的积载,但仅适用于此种 积载是在本保险责任开始前进行或是由被保险人或其雇员进行之时)
4.4 保险标的固有缺陷或性质引起的损失、损害或费用
4.5 迟延直接造成的损失、损害或费用,即使该延迟是由承保风险引起的(但根据上述第2条支付的费用除外)
4.6 因船舶的所有人、经理人、承租人或经营人的破产或经济困境产生的损失、损害或费用
4.7 因使用原子或核裂变和/或聚变或其类似反应或放射性力量或物质所制造的战争武器产生的损失、损害或费用。
(不适航和不适运除外条款)
5.1 本保险决不承保损失、损害或费用,如其起因于 5.1.1 船舶或驳船不适航
5.1.2 船舶、驳船、运输工具、集装箱或托盘对保险标的的安全运输不适合,而且在保险标的装于其上时,被保险人或其雇员对此种不适航或不适运有私谋
5.2 保险人放弃载运保险标的到目的港的船舶不得违反默示适航或适运保证,除非被保险人或其雇员对此种不适航或不适运有私谋。
(战争除外条款)
本保险决不承保损失、损害或费用,如其起因于
6.1 战争、内战、革命、造反、判乱或由此引起的内乱或交战方之间的敌对行为 6.2 捕获、扣押、扣留、拘禁或羁押(海盗除外),和此种行为引起的后果或进行此种行为的企图
6.3 被遗弃的水雷、鱼雷、炸弹或其他被遗弃的战争武器。
(罢工除外条款)
本保险决不承保损失、损害或费用
7.1 罢工者、被迫停工工人,或参加工潮、暴动或民变的人员造成者 7.2 罢工、停工、工潮、暴动或民变造成者 7.3 任何恐怖份子或出于政治动机而行为的人员造成者。
保险期间
(运送条款)
8.1 本保险责任始于货物运离载明的仓库或储存处所开始运送之时在通常运送过程中连续终止于: 8.1.1 在载明的目的地或之前交付到收货人的或其他最后仓库或储存处所,8.1.2 在载明的目的地或之前交付到任何其他仓库或储存处所其由被保险人用作 8.1.2.1 通常运送过程以外的储存或 8.1.2.2 分配或分派
8.1.3 或者被保险货物在最后卸货港全部卸离海船满60天,以上各项以先发生者为准。
8.2 如果在最后卸货港卸离海船后,但在本保险终止之前,货物被发送到非本保险承保的目的地,本保险,在依然受前述规定的终止所制约的同时,截止于开始向此种其他目的地运送之时。
8.3 保险人不能控制的迟延、任何绕航、强制卸货、重装或转载期间以及船东或承租人行使根据运输合同赋予的自由权产生的任何航海上的变更期间,本保险继续有效(但须受上述规定的终止和下述第9条规定的制约)。
(运输合同终止条款)
如果由于被保险人不能控制的情况,运输合同在载明的目的地以外的港口或地点终止,或运送在如同上述第8条规定的交付货物前另行终止,那么本保险也终止,但若立即通知了保险人并在本保险有效时提出继续承保的要求,以受保险人要求的附加保险费的约束为前提,本保险继续有效。
9.1 直至货物在此种港口或地点出售并交付,或者,除非另有特别约定,直至被保险货物到达此种港口或地点满60天,二者以先发生者为准,或者
9.2 如果货物在上述60天(或任何约定的延展期间)内被运往载明的目的地或其他目的地,直至根据上述第8条的规定而终止。
(航程改变条款)
如果在本保险责任开始后,被保险人改变了目的地,就按有待重新商定的保险费率和条件续保,但以立即通知保险人为前提。
(保险利益条款)
索赔
11.1为了根据本保险取得赔偿,被保险人在损失发生时对保险标的须具保险利益。11.2 除了上述第1款另有规定外,被保险人有权取得本保险承保期间发生的承保损失的赔偿,尽管该损失产生在本保险合同订立之前,除非当时被保险人知道该损失而保险人不知道。
(续运费用条款)
由于本保险承保的一种风险发生作用的结果,承保的保险标的运送在根据本保险承保的目的地以外的港口或地方终止,承保人将适当合理偿付被保险人在卸下、储存和发运保险标的至所承保的目的地而适当和合理遭受的额外费用
不适用于共同海损或救助费用的本条规定,须受上述第4、5、6和7条包含的除外责任的制约,且不包括由被保险人或其雇员的过失、疏忽、破产或经济困境所引起的费用。
(推定全损条款)
推定全损得不到赔偿,除非因实际全损看来不可避免,或由于把货物恢复、整理和发运保险标的到承保目的地的费用会超过其抵达时的价值,保险标的被合理放弃。
(增加价值条款)
14.1 如果对保险货物由被保险人办理了增加价值保险,货物保险价值就应视为增加至承保损失的本保险和所有增加价值保险的保险金额的总和,本保险的责任按照本保险的保险金额占此保险金额的总和的比例计算。
索赔时被保险人须向保险人提供所有其他保险的保险金额的证据。
14.2 如果本保险是增加价值保险,应适用下述条款:货物的保险价值应视为等于由被保险人对货物办理的承保损失的原始保险和所有增加价值保险的保险金额的总和的比例计算。
索赔时被保险人须向保险人提供所有其他保险的保险金额的证据。
保险受益
(不适用条款)
本保险不使承运人或其他保管人受益。
尽量减少损失
(被保险人的义务条款)
对可取得赔偿的损失,被保险人及其雇员和代理人有义务 16.1 采取为避免或尽量减少此种损失可能是合理的措施,并
16.2 保证对承运人、保管人或其他第三方追偿的所有权利被适当保护和行使而保险人负责在可取得赔偿的损失之外补偿被保险人履行这些义务而适当合理地招致的任何费用。
(弃权条款)
被保险人和保险人采取的旨在拯救、保护或恢复保险标的的措施不得视为放弃或接受委付或在其他方面损害任何一方的权利。
避免迟延
(合理速办条款)
本保险的条件之一是被保险人在所有其力所能及的情况下合理迅速地行动。
法律和惯例
(英国法律和惯例条款)
本保险受英国法和惯例调整。
INSTITUTE CARGO CLAUSES(A)(Risks Claus)RISKS COVERED 1.This insurance covers all risks of loss of or damage to the subject-matter insured except as provided in Clauses 4 5 6 and 7 below(General Average Clause)2.This insurance covers general average and salvage charges adjusted or determined according to the contract of affreightment and/or the governing law and practice incurred to avoid or in connection with the avoidance of loss from any cause except those excluded in Clauses 4 5 6 and 7 or elsewhere in this insurance.(“Both to Blame Collision”Clause)
3.This insurance is extended to indemnify the Assured against such proportion of liability under the contract of affreightment “Both to Blame Collision”Clause as is in respect of a loss recoverable hereunder.In the event of any claim by shipowners under the said Clause the Assured agree to notify the Underwriters who shall have the right at their own cost expense to defend the Assured against such claim.(General Exclusions Clause)EXCLUSIONS 4.In no case shall this insurance cover 4.1 loss damage or expense attributable to wilful misconduct of the Assured 4.2 ordinary leakage ordinary loss in weight or volume or ordinary wear and tear of the subject-matter insured 4.3 loss damage or expense caused by insufficiency or unsuitability of packing or preparation of the subject-matter insured(for the purpose of this Clause 4.3 “packing” shall be deemed to include stowage in a container or liftvan but only when such stowage is carried out prior to attachment of this insurance or by the Assured or their servants)4.4 loss damage or expense caused by inherent vice or nature of the subject-matter insured 4.5 loss damage or expense proximately caused by delay even though the delay be caused by a risk insured against(except expenses payable under Clause 2 above)4.6 loss damage or expense arising from insolvency or financial default of the owners managers charterers or operators of the vessel 4.7 loss damage or expense arising from the use of any weapon of war employing atomic or nuclear fission and/or other like reaction or radioactive force or matter.(Unseaworthiness and Unfitness Exclusion Clause)
5.1 In no case shall this insurance cover loss damage or expense arising from unseaworthiness of vessel or craft.unfitness of vessel craft conveyance container or liftvan for the safe carriage of the subject-matter insured.where the Assured or their servants are privy to such unseaworthiness or unfitness at the time the subject-matter insured is loaded therein.5.2 The Underwriters waive any breach of the implied warranties of seaworthiness of the ship and fitness of the ship to carry the subject-matter insured to destination unless the Assured or their servants are privy to such unseaworthiness or unfitness.(War Exclusion Clause)6 In no case shall this insurance cover loss damage or expense caused by 6.1 war civil war revolution rebellion insurrection or civil strife arising therefrom or any hostile act by or against a belligerent power 6.2 capture seizure arrest restraint or detainment(piracy excepted)and the consequences thereof or any attempt thereat.6.3 derelict mines torpedoes bombs or other derelict weapons of war.(Strikes Exclusion Clause)7 In no case shall this insurance cover loss damage or expense 7.1 caused by strikers locked-out workmen or persons taking part in labour disturbances riots or civil commotions 7.2 resulting from strikes lock-outs labour disturbances riots or civil commotions 7.3 caused by any terrorist or any person acting from a political motive.(Transit Clause)DURATION 8 8.1 This insurance attaches from the time the goods leave the warehouse or place of storage at the place named herein for the commencement of the transit continues during the ordinary course of transit and terminates either 8.1.1 on delivery to the Consignees’ or other final warehouse or place of storage at the destination named herein 8.1.2 on delivery to any other warehouse or place of storage whether prior to or at the destination named herein which the Assured elect to use either 8.1.2.1 for storage other than in the ordinary course of transit or 8.1.2.2 for allocation or distribution.or 8.1.3 on the expiry of 60 days after completion of discharge over side of the goods hereby insured from the oversea vessel at the final port of discharge.Whichever shall first occur.8.2 If after discharge over side from the oversea vessel at the final port of discharge but prior to termination of this insurance the goods are to be forwarded to destination other than that to which they are insured hereunder this insurance whilst remaining subject to termination as provided for above shall not extend beyond the commencement of transit to such other destination.8.3 This insurance shall remain in force(subject to termination as provided for above and to the provisions of Clause 9 below)during delay beyond the control of the Assured any deviation forced discharge reshipment or transshipment and during any variation of the adventure arising from the exercise of a liberty granted to ship owners or charterers under the contract of affreightment.(Termination of Contract of Carriage Clause)9 If owing to circumstances beyond the control of the Assured either the contract of carriage is terminated at a port or place other than the destination named therein or the transit is otherwise terminated before delivery of the goods as provided for in Clause 8 above then this insurance shall also terminate unless prompt notice is given to the Underwriters and continuation of cover is requested when the insurance shall remain in force subject to an additional premium if required by the Underwriters either 9.1 until the goods are sold and delivered at such port or place or unless otherwise specially agreed until the expiry of 60 days after arrival of the goods hereby insured at such port or place whichever shall first occur or 9.2 If the goods are forwarded within the said period of 60 days(or any agreed extension thereof)to the destination named herein or to any other destination until terminated in accordance with provisions of Clause 8 above.(Change of Voyage Clause)10 Where after attachment of this insurance the destination is changed by the Assured held covered at a premium and on conditions to be arranged subject to prompt notice being to the Underwriters.(Insurable Interest Clause)CLAIMS 11 11.1 In order to recover under this insurance the Assured must have an insurable interest in the subject-matter insured at the time of the loss.11.2 Subject to 11.1 above the Assured shall be entitled to recover for insured loss occurring during the period cover by this insurance notwithstanding that the loss occurred before the contract of insurance was concluded unless the Assured were aware of the loss and the Underwriters were not.(Forwarding Charge Clause)12 Where as a result of the operation of a risk covered by this insurance the insured transit is terminated at a port or place other than that to which the subject-matter is covered under this insurance the Underwriters will reimburse the Assured for any extra charges properly and reasonably incurred in unloading storing and forwarding the subject-matter to the destination to which it is insured hereunder.This Clause 12 which does not apply to general average or salvage charges shall be subject to the exclusions contained in Clauses 4 5 6 and 7 above and shall not include charges arising from the fault negligence insolvency or financial default of the Assured or their servants.(Constructive Total Loss)13 No claim for Constructive Total Loss shall be recoverable hereunder unless the subject-matter insured is reasonably abandoned either on account of its actual total loss appearing to be unavoidable or because the cost of recovering reconditioning and forwarding the subject-matter to be destination to which it is insured would exceed its value on arrival.(Increased Value Clause)14 14.1 If any Increased Value insurance is effected by the Assured on the cargo insured herein the agreed value of the cargo shall be deemed to be increased to the total amount insured under this insurance and all Increased Value insurance covering the loss and liability under this insurance shall be in such proportion as the sum insured herein bears to such total amount insured.In the event of claim the Assured shall provide the Underwriters with evidence of the amounts insured under all other insurances.14.2 Where this insurance is on Increased Value the following clause shall apply: The agreed value of the cargo shall be deemed to be equal to the total amount insured under the primary insurance and all Increased Value insurance covering the loss and effected on the cargo by the Assured and liability under this insurance shall be in such proportion as the sum insured herein bears to such total amount insured.In the event of claim the Assured shall provide the Underwriters with evidence of the amounts insured under all other insurances.(Not to inure Clause)BENEFIT OF INSURANCE 15 This insurance shall not insure to the benefit of the carrier or other bailee.(Duty of Assured Clause)MINIMISING LOSSES 16 It is the duty of the Assured and their servants and agents in respect of loss recoverable hereunder 16.1 to take such measures as may be reasonable for the purpose of averting or minimizing such loss and 16.2 to ensure that all rights against carriers bailees or other third parties are properly preserved and exercised and the Underwriters will in addition to any loss recoverable hereunder reimburse the Assured for any charges properly and reasonably incurred in pursuance of these duties.(Waiver Clause)17 Measures taken by the Assured or the Underwriters with the object of saving protecting or recovering the subject-matter insured shall not be considered as a waiver or acceptance of abandonment or otherwise prejudice the rights of either party(Reasonable Dispatch Clause)AVOIDANCE OF DELAY 18 It is a condition of this insurance that the Assured shall act with reasonable dispatch in all circumstances within their control.(English Law and Practice Clause)LAW AND PRACTICE 19 This insurance is subject to English law and practice.
第三篇:sqlldr使用小结
sqlldr使用小结
sqlldr userid=lgone/tiger control=a.ctl
LOAD DATA
INFILE ’t.dat’ // 要导入的文件
// INFILE ’tt.date’ // 导入多个文件
// INFILE * // 要导入的内容就在control文件里 下面的BEGINDATA后面就是导入的内容
INTO TABLE table_name // 指定装入的表
BADFILE ’c:\bad.txt’ // 指定坏文件地址
************* 以下是4种装入表的方式
APPEND // 原先的表有数据 就加在后面
// INSERT // 装载空表 如果原先的表有数据 sqlloader会停止 默认值
// REPLACE // 原先的表有数据 原先的数据会全部删除
// TRUNCATE // 指定的内容和replace的相同 会用truncate语句删除现存数据
************* 指定的TERMINATED可以在表的开头 也可在表的内部字段部分
FIELDS TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’“’
// 装载这种数据: 10,lg,”“"lg”“",”lg,lg“
// 在表中结果: 10 lg ”lg“ lg,lg
// TERMINATED BY X ’0Array’ // 以十六进制格式 ’0Array’ 表示的// TERMINATED BY WRITESPACE // 装载这种数据: 10 lg lg
TRAILING NULLCOLS ************* 表的字段没有对应的值时允许为空
************* 下面是表的字段
(col_1 , col_2 ,col_filler FILLER // FILLER 关键字 此列的数值不会被装载
// 如: lg,lg,not 结果 lg lg)
// 当没声明FIELDS TERMINATED BY ’,’ 时
//(// col_1 [interger external] TERMINATED BY ’,’ ,// col_2 [date ”dd-mon-yyy“] TERMINATED BY ’,’ , // col_3 [char] TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’lg’
//)
// 当没声明FIELDS TERMINATED BY ’,’用位置告诉字段装载数据
//(// col_1 position(1:2),// col_2 position(3:10),// col_3 position(*:16), // 这个字段的开始位置在前一字段的结束位置
// col_4 position(1:16),// col_5 position(3:10)char(8)// 指定字段的类型
//)
BEGINDATA // 对应开始的 INFILE * 要导入的内容就在control文件里
10,Sql,what
20,lg,show
=======================================
//////////// 注意begindata后的数值前面不能有空格***** 普通装载
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’”’
(DEPTNO,DNAME,LOC)
BEGINDATA
10,Sales,“"”USA“"”
20,Accounting,“Virginia,USA”
30,Consulting,Virginia
40,Finance,Virginia
50,“Finance”,“",Virginia // loc 列将为空
60,”Finance“,Virginia // loc 列将为空***** FIELDS TERMINATED BY WHITESPACE 和 FIELDS TERMINATED BY x’0Array’ 的情况
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY WHITESPACE
--FIELDS TERMINATED BY x’0Array’
(DEPTNO,DNAME,LOC)
BEGINDATA Sales Virginia ***** 指定不装载那一列
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’”’
(DEPTNO,FILLER_1 FILLER, // 下面的 “Something Not To Be Loaded” 将不会被装载
DNAME,LOC)
BEGINDATA
20,Something Not To Be Loaded,Accounting,“Virginia,USA” ***** position的列子
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
(DEPTNO position(1:2),DNAME position(*:16), // 这个字段的开始位置在前一字段的结束位置
LOC position(*:2Array),ENTIRE_LINE position(1:2Array))
BEGINDATA
10Accounting Virginia,USA
***** 使用函数 日期的一种表达 TRAILING NULLCOLS的使用
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS // 其实下面的ENTIRE_LINE在BEGINDATA后面的数据中是没有直接对应
// 的列的值的 如果第一行改为
10,Sales,Virginia,1/5/2000, 就不用TRAILING NULLCOLS了
(DEPTNO,DNAME “upper(:dname)”, // 使用函数
LOC “upper(:loc)”,LAST_UPDATED date ’dd/mm/yyyy’, // 日期的一种表达方式 还有’dd-mon-yyyy’ 等
ENTIRE_LINE “:deptno||:dname||:loc||:last_updated”)
BEGINDATA
10,Sales,Virginia,1/5/2000
20,Accounting,Virginia,21/6/1ArrayArrayArray 30,Consulting,Virginia,5/1/2000
40,Finance,Virginia,15/3/2001 ***** 使用自定义的函数 // 解决的时间问题
create or replace
function my_to_date(p_string in varchar2)return date
as
type fmtArray is table of varchar2(25);
l_fmts fmtArray := fmtArray(’dd-mon-yyyy’, ’dd-month-yyyy’,’dd/mm/yyyy’,’dd/mm/yyyy hh24:mi:ss’);
l_return date;
begin
for i in 1..l_fmts.count
loop
begin
l_return := to_date(p_string, l_fmts(i));
exception
when others then null;
end;EXIT when l_return is not null;
end loop;
if(l_return is null)
then
l_return :=
new_time(to_date(’01011Array70’,’ddmmyyyy’)+ 1/24/60/60 *
p_string, ’GMT’, ’EST’);
end if;
return l_return;
end;
/
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO, DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED “my_to_date(:last_updated)” // 使用自定义的函数)
BEGINDATA
10,Sales,Virginia,01-april-2001
20,Accounting,Virginia,13/04/2001
30,Consulting,Virginia,14/04/2001 12:02:02
40,Finance,Virginia,Array872682Array7
50,Finance,Virginia,02-apr-2001
60,Finance,Virginia,Not a date ***** 合并多行记录为一行记录
LOAD DATA
INFILE *
concatenate 3 // 通过关键字concatenate 把几行的记录看成一行记录
INTO TABLE DEPT
replace
FIELDS TERMINATED BY ’,’
(DEPTNO, DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED date ’dd/mm/yyyy’)
BEGINDATA
10,Sales, // 其实这3行看成一行 10,Sales,Virginia,1/5/2000
Virginia,1/5/2000
// 这列子用 continueif list=“,” 也可以
告诉sqlldr在每行的末尾找逗号 找到逗号就把下一行附加到上一行
LOAD DATA
INFILE *
continueif this(1:1)= ’-’ // 找每行的开始是否有连接字符-有就把下一行连接为一行
// 如-10,Sales,Virginia,// 1/5/2000 就是一行 10,Sales,Virginia,1/5/2000
// 其中1:1 表示从第一行开始 并在第一行结束 还有continueif next 但continueif list最理想
INTO TABLE DEPT replace
FIELDS TERMINATED BY ’,’
(DEPTNO,DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED date ’dd/mm/yyyy’)
BEGINDATA // 但是好象不能象右面的那样使用
-10,Sales,Virginia,-10,Sales,Virginia,1/5/2000 1/5/2000
-40, 40,Finance,Virginia,13/04/2001
Finance,Virginia,13/04/2001 ***** 载入每行的行号
load data
infile *
into table t
replace
(seqno RECNUM //载入每行的行号
text Position(1:1024))
BEGINDATA fsdfasj //自动分配一行号给载入 表t 的seqno字段 此行为 1
fasdjfasdfl // 此行为 2...Array ***** 载入有换行符的数据
注意: unix 和 windows 不同 \\n & /n
< 1 > 使用一个非换行符的字符
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO,DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED “my_to_date(:last_updated)”,COMMENTS “replace(:comments,’\n’,chr(10))” // replace 的使用帮助转换换行符)
BEGINDATA
10,Sales,Virginia,01-april-2001,This is the Sales\nOffice in Virginia
20,Accounting,Virginia,13/04/2001,This is the Accounting\nOffice in Virginia
30,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting\nOffice in Virginia
40,Finance,Virginia,Array872682Array7,This is the Finance\nOffice in Virginia
< 2 > 使用fix属性
LOAD DATA
INFILE demo17.dat “fix 101”
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO,DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED “my_to_date(:last_updated)”,COMMENTS)
demo17.dat 10,Sales,Virginia,01-april-2001,This is the Sales
Office in Virginia
20,Accounting,Virginia,13/04/2001,This is the Accounting
Office in Virginia
30,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting
Office in Virginia
40,Finance,Virginia,Array872682Array7,This is the Finance
Office in Virginia
// 这样装载会把换行符装入数据库 下面的方法就不会 但要求数据的格式不同
LOAD DATA
INFILE demo18.dat “fix 101”
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’“’
TRAILING NULLCOLS
(DEPTNO, DNAME ”upper(:dname)“,LOC ”upper(:loc)“,LAST_UPDATED ”my_to_date(:last_updated)“,COMMENTS)
demo18.dat
10,Sales,Virginia,01-april-2001,”This is the Sales
Office in Virginia“
20,Accounting,Virginia,13/04/2001,”This is the Accounting
Office in Virginia“
30,Consulting,Virginia,14/04/2001 12:02:02,”This is the Consulting
Office in Virginia“
40,Finance,Virginia,Array872682Array7,”This is the Finance
Office in Virginia“
< 3 > 使用var属性
LOAD DATA
INFILE demo1Array.dat ”var 3“
// 3 告诉每个记录的前3个字节表示记录的长度 如第一个记录的 071 表示此记录有 71 个字节
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO,DNAME ”upper(:dname)“,LOC ”upper(:loc)“,LAST_UPDATED ”my_to_date(:last_updated)“,COMMENTS)
demo1Array.dat
07110,Sales,Virginia,01-april-2001,This is the Sales
Office in Virginia
07820,Accounting,Virginia,13/04/2001,This is the Accounting
Office in Virginia
08730,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting
Office in Virginia
07140,Finance,Virginia,Array872682Array7,This is the Finance
Office in Virginia
< 4 > 使用str属性
// 最灵活的一中 可定义一个新的行结尾符 win 回车换行 : chr(13)||chr(10)
此列中记录是以 a|\r\n 结束的select utl_raw.cast_to_raw(’|’||chr(13)||chr(10))from dual;
结果 7C0D0A
LOAD DATA
INFILE demo20.dat ”str X’7C0D0A’“
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO,DNAME ”upper(:dname)“,LOC ”upper(:loc)“,LAST_UPDATED ”my_to_date(:last_updated)",COMMENTS)
demo20.dat 10,Sales,Virginia,01-april-2001,This is the Sales
Office in Virginia|
20,Accounting,Virginia,13/04/2001,This is the Accounting
Office in Virginia|
30,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting
Office in Virginia|
40,Finance,Virginia,Array872682Array7,This is the Finance
Office in Virginia|
================================
象这样的数据 用 nullif 子句
10-jan-200002350Flipper seemed unusually hungry today.10510-jan-20000ArrayArray45Spread over three meals.id position(1:3)nullif id=blanks // 这里可以是blanks 或者别的表达式
// 下面是另一个列子 第一行的 1 在数据库中将成为 null
LOAD DATA INFILE *
INTO TABLE T
REPLACE
(n position(1:2)integer external nullif n=’1’,v position(3:8))
BEGINDATA 10
20lg
-----------------------------
第四篇:GridCtrl使用小结
http://www.xiexiebang.com/
GridCtrl使用详解
CGridCtrl类主要是通过grid样式显示数据 在单文档中的使用方法
步骤一 初始化 在CView类的.h头文件中包含文件:
#include “Gridctrl.h” 并且手写加入如下的成员函数:
CGridCtrl * m_pGridCtrl;步骤二 构造与析构 构造函数中:
m_pGridCtrl = NULL;析构函数中:
if(m_pGridCtrl)
delete m_pGridCtrl;步骤三 如果需要打印功能的话添加同名打印函数代码 在CView类的OnBeginPrinting()函数中添加如下代码: if(m_pGridCtrl)
m_pGridCtrl->OnBeginPrinting(pDC,pInfo);//简单吧,这就是类的好处其它两个打印函数也一样的做法.步骤四 在OnInitaUpdate()函数中或者你自己添加的要显示Grid的消息函数中如下初始化: //创建非模式对话框 CDlg *dlg;dlg=new CDlg();dlg->Create(IDD_Dlg,this);
//初始化GridCtrl控件 if(m_pGridCtrl!=NULL){ deletem_pGridCtrl;m_pGridCtrl=NULL;} if(m_pGridCtrl == NULL){ // Create the Gridctrl object m_pGridCtrl = new CGridCtrl;if(!m_pGridCtrl)return 0;// Create the Gridctrl window CRectrect;GetClientRect(rect);m_pGridCtrl->Create(rect, this, 100);// fill it up with stuff m_pGridCtrl->SetEditable(false);m_pGridCtrl->SetTextBkColor(RGB(0xFF, 0xFF, 0xE0));//黄色背景 m_pGridCtrl->EnableDragAndDrop(false);try { m_pGridCtrl->SetRowCount(k);//设置行数为k行 m_pGridCtrl->SetColumnCount(4);//k列
m_pGridCtrl->SetFixedRowCount(1);//标题行为一行
http://www.xiexiebang.com/
m_pGridCtrl->SetFixedColumnCount(1);//同上 } catch(CMemoryException* e){ e->ReportError();e->Delete();return 0;} //填充列标题 int row=0;for(int col=0;col<4;col++){ GV_ITEM Item;Item.mask = GVIF_TEXT|GVIF_FORMAT;Item.row = row;Item.col = col;if(col==0){ Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.strText.Format(_T(“【类别】”),col);} else if(col==1){ Item.nFormat = DT_LEFT|DT_WORDBREAK;Item.strText.Format(_T(“第一列”),col);} else if(col==2){ Item.nFormat = DT_LEFT|DT_WORDBREAK;Item.strText.Format(_T(“第二列”),col);} m_pGridCtrl->SetItem(&Item);} // fill rows/cols with text for(row = 1;row < k;row++)for(col = 0;col < h;col++){ GV_ITEM Item;Item.mask = GVIF_TEXT|GVIF_FORMAT;Item.row = row;Item.col = col;if(col < 1){ //行标题头
Item.nFormat = DT_CENTER|DT_VCENTER |DT_SINGLELINE|DT_END_ELLIPSIS |DT_NOPREFIX;Item.strText.Format(_T(“%d”),row);
http://www.xiexiebang.com/
} else if(col==1){ //第一列的值 Item.nFormat = DT_CENTER|DT_VCENTER |DT_SINGLELINE|DT_END_ELLIPSIS |DT_NOPREFIX;str=“aa”;Item.strText.Format(_T(“%s”),str);}else if(col==2){ //第二列第值 Item.nFormat = DT_CENTER|DT_VCENTER |DT_SINGLELINE|DT_END_ELLIPSIS |DT_NOPREFIX;CStringstr;str=“bb”;Item.strText.Format(_T(“%s”),str);} m_pGridCtrl->SetItem(&Item);} m_pGridCtrl->AutoSize();
//--------------设置行列距------------------for(int a=1;a
步骤五: 添加WM_SIZE消息,调整控件的界面占屏幕大小
if(m_pGridCtrl->GetSafeHWnd())
{
CRectrect;
GetClientRect(rect);
m_pGridCtrl->MoveWindow(rect);
}
在对话框中的使用方法 步骤一 创建数据显示表格对话框
在资源管理器中新创建一个对话框,假设为CDlgTestReportBox。从工具箱中加入Custom Control,就是人头像的那个,将其区域拉伸至要显示数据表格的大小,充满整个对话框。
在CDlgTestReportBox类的头文件中: #include “GridCtrl.h”
http://www.xiexiebang.com/
再定义成员变量: CGridCtrl* m_pGrid;添加OnShowWindow()消息处理函数如下:
voidCDlgTestReportBox::OnShowWindow(BOOL bShow, UINT nStatus){ CDialog::OnShowWindow(bShow, nStatus);// TODO: Add your message handler code here if(m_pGrid!=NULL){ deletem_pGrid;m_pGrid=NULL;} if(m_pGrid==NULL){ m_pGrid=new CGridCtrl;CRectrect;GetDlgItem(IDC_ReportAera)->GetWindowRect(rect);//得到显示区域 ScreenToClient(&rect);m_pGrid->Create(rect,this,100);m_pGrid->SetEditable(false);m_pGrid->SetTextBkColor(RGB(0xFF, 0xFF, 0xE0));//黄色背景 try { m_pGrid->SetRowCount(10);//初始为10行
m_pGrid->SetColumnCount(11);//初始化为11列 m_pGrid->SetFixedRowCount(1);//表头为一行 m_pGrid->SetFixedColumnCount(1);//表头为一列 } catch(CMemoryException* e){ e->ReportError();e->Delete();// return FALSE;} for(int row = 0;row
http://www.xiexiebang.com/
{ Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.szText.Format(_T(“报表显示”),col);} else if(row < 1)//设置0行表头显示 { Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.szText.Format(_T(“ 项目%d”),col);} else if(col < 1)//设置0列表头显示 { if(row
步骤二 嵌入上面的对话框 显示数据
在你需要显示数据的对话框上的头文件中,假设为CDlgTest,加入 #include ”GridCtrl.h“ CDlgTestReportBox* m_pTestReportBox;将数据显示对话框放入你的对话框相应位置上,在CDlgTest::OnInitDialog()中:
if(!m_pTestReportBox){
m_pTestReportBox=new CDlgTestReportBox(this);} m_pTestReportBox->Create(IDD_DlgTestReportBox,this);
http://www.xiexiebang.com/
//定义区域变量 CRectrectDraw;GetDlgItem(IDC_AeraReport)->GetWindowRect(rectDraw);ScreenToClient(&rectDraw);//动态测试数据显示区域rectDraw //将对应的对话框放到指定区域 m_pTestReportBox->MoveWindow(rectDraw);m_pTestReportBox->ShowWindow(SW_SHOW);自定义填充数据的函数:CDlgTest::FillGrid()如下: CGridCtrl* pGrid=m_pTestReportBox->m_pGrid;for(int row = pGrid->GetRowCount()-1;row >= pGrid->GetRowCount()-3;row--){ for(int col = 1;col <= pGrid->GetColumnCount();col++){ GV_ITEM Item;Item.mask = GVIF_TEXT|GVIF_FORMAT;Item.row = row;Item.col = col;if(row==pGrid->GetRowCount()-3&&col>0)//平均值 { if(col==10){ Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.szText.Format(_T(” %6.2f “),avjch);} else{ Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.szText.Format(_T(” %6.2f “),av[col-1]);} } pGrid->SetItem(&Item);//提交数据 if(row==0||col==0){ COLORREF clr = RGB(0, 0, 0);pGrid->SetItemBkColour(row, col, clr);pGrid->SetItemFgColour(row, col, RGB(255,0,0));} }//循环结束
pGrid->Invalidate();} CGRIFCTRL原理:
DBGRID和一般的GRID的不同之处在于,一般的GRID并不适合显示大的数据量,如果一个表中有上万条记录都要插入到GRID中,这将是一个很慢的过程,并且在GRID中移动滚动条时,它的记录的滚动也是很慢。而DBGRID并不会真正把这些记录的数据全部插入到控件中,当DBGRID的滚动条滚动时,它会根据DBGRID的显示面积的大小和查询得到的总记录数计算出当前应该显示哪些行,然后插入
http://www.xiexiebang.com/
到表格中,这样一来,速度肯定快,而且没有数据量多少的限制。幸运的是,CGridCtrl类已经为我们提供了这种机制,它是采用虚模式实现的。使用这种方式,即使你向这个该控件插入一百万条数据,它并不会真的生成一百万行,而是随着你的滚动条的滚动,计算出在屏幕上要显示的行和列,然后会向你提供一个接口,通过这个接口,你可以在这儿设置你要显示的数据。下面给出使用CGridCtrl控件的虚模式的步骤: 步骤一 初始化
在视图的初始化函数里添加如下代码:
void SetVirtualMode(TRUE)
设为虚模式
BOOL SetRowCount(intnRows)
设置总的行数。
BOOL SetFixedRowCount(intnFixedRows = 1)
设置固定的行数据 BOOL SetColumnCount(intnCols)
设置列数 BOOL SetFixedColumnCount(intnFixedCols = 1)设置固定的列数 步骤二 响应消息 显示数据
我们假设CGridCtrl是放在单文档视图中,而且它关联的变量是m_GridCtrl,利用ClassWizard添加视图的OnNotify响应函数。这个响应函数的写法是固定的,类似下面的代码:
BOOL CGridCtrlTestView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult){ if(wParam ==(WPARAM)m_Grid.GetDlgCtrlID()){ *pResult = 1;GV_DISPINFO *pDispInfo =(GV_DISPINFO*)lParam;if(GVN_GETDISPINFO == pDispInfo->hdr.code){ //这是添加的函数,在这个函数里设置当前要显示的数据 SetGridItem(pDispInfo);return TRUE;} } returnCGridCtrlTestView::OnNotify(wParam, lParam, pResult);} 在上面的代码中,SetGridItem(pDispInfo)是添加的函数,在这个函数里我们设置当前要显示的数据。pDispInfo是一个GV_DISPINFO的结构体对象,它包含了每个单元格的信息,如行号,列号,有没有位图,背景色,前景色等。CGRIDCTRL会把当前要显示那个单元格行号,列号传递给我们,我们只要设置里面显示的数据就可以了。如下面是一个显示数据的例子。
voidCGridCtrlTestView::SetGridItem(GV_DISPINFO *pDispInfo){
pDispInfo->item.strText.Format(”row%d,col%d",pDispInfo->it
http://www.xiexiebang.com/
em.row, pDispInfo->item.col);}
第五篇:git使用小结
git使用小结
1.git-config 配置git,一般需要配置的是user.name,user.email,有时sendemail.smtpserver也要配置,比如,我使用msmtp:
git-config –global sendemail.smtpserver /usr/local/bin/msmtp 如果你仅仅是想给这一个项目配置,把–global选项去掉。查看配置的选项是–list。2.git-pull git-pull没必要带后面那长长的url(-_-b 我那么用了好多次,不过我用的是!git-pull)。如果你在给Linux内核这样的项目工作,记得git-pull之前检查是不是在master分支。3.git-format-patch 如果发送多于一个补丁,最好用[PATCH n/m]的形式,加上-n。加signed-off-by那行是-s。指定为几次commit生成补丁,直接加数字,比如,$ git-format-patch-3 检查补丁是–check,最好加上这个。4.git-send-email 如果一次提交补丁比较多,最好用–no-chain-reply-to,因为如果不用的话,在thread嵌套会太深,不利于别人阅读。这个也可以通过选项sendemail.chainreplyto来控制。–signed-off-by-cc,要加上,可以省去手工处理的麻烦。–compose用来编辑[PATCH 0/m],这个一般是对整个patchset的描述。–smtp-server,如果你不想用git-config指定的话,用它也行。–cc和–to就不用说了。5.git-commit 在git-commit之前最好git-add。git-commit几个常用的选项有:-s 会增加Signed-off-by行,-e编辑commit message,-a表示all,-m是指定commit信息。同样,删除文件是先git-rm。查看commit列表用git-rev-list,查看某个commit用git-show,查看commit的日志用git-log,-p是以补丁的形式查看。6.其它 git-diff也可以比较不同版本之间的差异,某个版本的某个文件的差异,如: $ git-diff v2.6.22 $ git diff v2.6.20 init/main.c $ git-diff v2.6.23 v2.6.24-rc1 init/main.c git-whatchanged也差不多: $ git-whatchanged-p init/main.c 7.错误提交了commit怎么办? a)git-revert 这个本身就会产生一个commit,如果用得多了会让你的log看起来不那么干净。;-)b)git-reset 用这个要当心,它会把那个commit之后的commit全部删除。一个好的办法是:先建立一个临时的分支,然后再git-reset,再git-rebase,最后再删除临时的分支。详细可以看这里。