realbasic-nug
[Top] [All Lists]

RegEx to reliably split SQL lines

To: REALbasic-NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: RegEx to reliably split SQL lines
From: Dr Gerard Hammond <realbasic at macsos dot com dot au>
Date: Thu, 29 Mar 2007 09:25:03 +1000
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Hi,

I have a long file full of INSERT, UPDATE and SELECT statements.
Does anybody have a piece of RegEx code that'll split the lines 
reliably into individual SQL statements.
RegEx and I don't normally get on.

Files typically look like this.

delete from  Attribute;
delete from CodeSet;
INSERT INTO Attribute ( 
AttributeName,TableName,AttributeDisplayName,Type,ImageID,ShortHelp,LongHelp 
) VALUES ( 'UserID','Users','User ID','integer','0','User''s unique 
numerical User ID','This is the User''s unique numerical User ID. It 
is used through out the system.' );
INSERT INTO Attribute ( 
AttributeName,TableName,AttributeDisplayName,Type,ImageID,ShortHelp,LongHelp 
) VALUES ( 'UserName','Users','User Name','varchar','0','User''s 
login name','This is the User''s unique login name. It is used 
through out the system.' );
INSERT INTO Attribute ( 
AttributeName,TableName,AttributeDisplayName,Type,ImageID,ShortHelp,LongHelp 
) VALUES ( 'ShowWizardDialogs','Users','Show Wizard 
Dialogs','integer','0','Show Wizard Dialogs when creating new 
SOPs','A flag that determines if the System should show the Wizard 
Dialogs when creating new SOPs' );
INSERT INTO CodeSet ( DisplayOrder, 
CodeValue,CodeDescription,CodeSetID, isVisible , CodeShortHelp) 
VALUES ( NULL, '8','Engineering','ControlsID','1', 'Engineering 
Controls
     1.    DESIGN. Try to ensure that hazards are -designed out- when 
new materials, equipment and work systems are being planned for the 
workplace.
     2.    REMOVE the hazard or SUBSTITUTE less hazardous materials, 
equipment or substances.
     3.    ADOPT A SAFER PROCESS. Alterations to tools, equipment or 
work systems can often make them much safer.
     4.    ENCLOSE OR ISOLATE THE HAZARD through the use of guards or 
remote handling techniques.
     5.    PROVIDE EFFECTIVE VENTILATION through local or general 
exhaust ventilation systems. Administrative Controls
     6.    ESTABLISH appropriate ADMINISTRATIVE PROCEDURES such as:
             job rotation to reduce exposure or boredom, or timing the 
job so that fewer workers are exposed routine maintenance and 
housekeeping procedures training on hazards and correct work 
procedures');
INSERT INTO CodeSet ( DisplayOrder, 
CodeValue,CodeDescription,CodeSetID, isVisible ) VALUES ( NULL, 
'16','Safe Work Practices','ControlsID','0' );


-- 

Cheers,

Dr Gerard Hammond
MacSOS Solutions
http://www.macsos.com.au
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>