Sponsored Content
Full Discussion: insert query help
Top Forums Programming insert query help Post 302558449 by mogabr on Friday 23rd of September 2011 02:59:09 PM
Old 09-23-2011
Quote:
Originally Posted by Corona688
That really depends on what the contents of DEBUG.txt are. Its contents may need to be modified with a shell script or the like before insertion.
Code:
mysql -uroot -Dxy -p259 -e "TRUNCATE allev; 
load data infile '/tmp/test.log' into table 
  allev (server_name,test_name,start_Date,end_date,outage_time,old_status,current_status,error_code)
  set pk_number=CONCAT("test_name","start_Date") FIELDS TERMINATED BY ' ';"

why this query give me error ?
the fields terminated by space,, but cant do this

Last edited by Scott; 09-23-2011 at 04:06 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I insert x'0D' ?

I'm directing output to a *.dat file. The first byte is a variable, the second must be a carriage-return (x'0D'). Is there a UNIX equivalent of an ASCII command that will allow me to output this byte? (2 Replies)
Discussion started by: rchuttke
2 Replies

2. Shell Programming and Scripting

add the output of a query to a variable to be used in another query

I would like to use the result of a query in another query. How do I redirect/add the output to another variable? $result = odbc_exec($connect, $query); while ($row = odbc_fetch_array($result)) { echo $row,"\n"; } odbc_close($connect); ?> This will output hostnames: host1... (0 Replies)
Discussion started by: hazno
0 Replies

3. Shell Programming and Scripting

need to create a insert query for a file

Hi Guys, I need to create a insert query for the below file Fri Sep 4 06:25:51 2009 ACTION : 'CREATE INDEX S100S_DC.PLInsuranceReportRules_testI1 ON S100S_DC.PLInsuranceReportRules_test1(ENTITY_KEY)' DATABASE USER: '/' PRIVILEGE : SYSDBA CLIENT USER: oracle CLIENT TERMINAL: pts/3... (6 Replies)
Discussion started by: mac4rfree
6 Replies

4. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

5. Programming

SQL : Fine tune Insert by query

i would like to know how can i fine tune the following query since the cost of the query is too high .. insert into temp temp_1 select a,b,c,d from xxxx .. database used is IDS.. (1 Reply)
Discussion started by: expert
1 Replies

6. Shell Programming and Scripting

How to use a variable in insert query?

My script contains as follows, VALUE=`sqlplus un/pwd <<EOF > OB.txt set pagesize 0 feedback off verify off heading off echo off select max(1) from table1; exit; EOF` insert into table2 values(1, 'The max value is $value',...); i need the value of VALUE to be inserted after 'The max... (2 Replies)
Discussion started by: savithavijay
2 Replies

7. Shell Programming and Scripting

Forming an insert query using awk

Hi, I'm trying to form an insert sql query using shell programming. I have table named company with four columns 'company name', 'company id', 'company code' and 'last change id' I have to read the company name, company code and last change id from a file delimited by | which has around 10... (4 Replies)
Discussion started by: rakesh_s
4 Replies

8. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

9. Shell Programming and Scripting

Insert query with shell variable with AWK

Hi, I'm a first timer with Unix so pardon my ignorance. I'm trying to read a comma separated file from the same folder where the script is and insert the value in a DB2 table. I'm using AWK for the same. I'm getting `)' not expected error. I'm not sure but for me it doesn't look like detailed... (8 Replies)
Discussion started by: Kabira Speaking
8 Replies

10. Shell Programming and Scripting

From sql Insert Query to XML format

Hi How do I translate Let say Cat inserts.sql gives Insert into PM9_TAXATION_ROUNDING (STATE_GECODE, TAX_TYPE, TAX_AUTHORITY, SYS_CREATION_DATE, SYS_UPDATE_DATE, APPLICATION_ID, DL_SERVICE_CODE, ROUNDING_METHOD) Values ('xx', 'xx', 'x', TO_DATE('10/26/2012 13:01:20',... (3 Replies)
Discussion started by: anuj87in
3 Replies
Dancer::Test(3pm)					User Contributed Perl Documentation					 Dancer::Test(3pm)

NAME
Dancer::Test - Test helpers to test a Dancer application SYNOPSYS
use strict; use warnings; use Test::More tests => 2; use MyWebApp; use Dancer::Test; response_status_is [GET => '/'], 200, "GET / is found"; response_content_like [GET => '/'], qr/hello, world/, "content looks good for /"; DESCRIPTION
This module provides test helpers for testing Dancer apps. Be careful, the module loading order in the example above is very important. Make sure to use "Dancer::Test" after importing the application package otherwise your appdir will be automatically set to "lib" and your test script won't be able to find views, conffiles and other application content. For all test methods, the first argument can be either an array ref of the method and route, or a scalar containing the route (in which case the method is assumed to be "GET"), or a Dancer::Response object. # all 3 are equivalent response_status_is [ GET => '/' ], 200, 'GET / status is ok'; response_status_is '/', 200, 'GET / status is ok'; my $resp = dancer_response GET => '/'; response_status_is $resp => 200, 'GET / status is ok'; METHODS
route_exists([$method, $path], $test_name) Asserts that the given request matches a route handler in Dancer's registry. route_exists [GET => '/'], "GET / is handled"; route_doesnt_exist([$method, $path], $test_name) Asserts that the given request does not match any route handler in Dancer's registry. route_doesnt_exist [GET => '/bogus_path'], "GET /bogus_path is not handled"; response_exists([$method, $path], $test_name) Asserts that a response is found for the given request (note that even though a route for that path might not exist, a response can be found during request processing, because of filters). response_exists [GET => '/path_that_gets_redirected_to_home'], "response found for unknown path"; response_doesnt_exist([$method, $path], $test_name) Asserts that no response is found when processing the given request. response_doesnt_exist [GET => '/unknown_path'], "response not found for unknown path"; response_status_is([$method, $path], $status, $test_name) Asserts that Dancer's response for the given request has a status equal to the one given. response_status_is [GET => '/'], 200, "response for GET / is 200"; response_status_isnt([$method, $path], $status, $test_name) Asserts that the status of Dancer's response is not equal to the one given. response_status_isnt [GET => '/'], 404, "response for GET / is not a 404"; response_content_is([$method, $path], $expected, $test_name) Asserts that the response content is equal to the $expected string. response_content_is [GET => '/'], "Hello, World", "got expected response content for GET /"; response_content_isnt([$method, $path], $not_expected, $test_name) Asserts that the response content is not equal to the $not_expected string. response_content_isnt [GET => '/'], "Hello, World", "got expected response content for GET /"; response_content_is_deeply([$method, $path], $expected_struct, $test_name) Similar to response_content_is(), except that if response content and $expected_struct are references, it does a deep comparison walking each data structure to see if they are equivalent. If the two structures are different, it will display the place where they start differing. response_content_is_deeply [GET => '/complex_struct'], { foo => 42, bar => 24}, "got expected response structure for GET /complex_struct"; response_content_like([$method, $path], $regexp, $test_name) Asserts that the response content for the given request matches the regexp given. response_content_like [GET => '/'], qr/Hello, World/, "response content looks good for GET /"; response_content_unlike([$method, $path], $regexp, $test_name) Asserts that the response content for the given request does not match the regexp given. response_content_unlike [GET => '/'], qr/Page not found/, "response content looks good for GET /"; response_headers_are_deeply([$method, $path], $expected, $test_name) Asserts that the response headers data structure equals the one given. response_headers_are_deeply [GET => '/'], [ 'X-Powered-By' => 'Dancer 1.150' ]; response_headers_include([$method, $path], $expected, $test_name) Asserts that the response headers data structure includes some of the defined ones. response_headers_include [GET => '/'], [ 'Content-Type' => 'text/plain' ]; dancer_response($method, $path, { params => $params, body => $body, headers => $headers, files => [{filename => '/path/to/file', name => 'my_file'}] }) Returns a Dancer::Response object for the given request. Only $method and $path are required. $params is a hashref, $body is a string and $headers can be an arrayref or a HTTP::Headers object, $files is an arrayref of hashref, containing some files to upload. A good reason to use this function is for testing POST requests. Since POST requests may not be idempotent, it is necessary to capture the content and status in one shot. Calling the response_status_is and response_content_is functions in succession would make two requests, each of which could alter the state of the application and cause Schrodinger's cat to die. my $response = dancer_response POST => '/widgets'; is $response->{status}, 202, "response for POST /widgets is 202"; is $response->{content}, "Widget #1 has been scheduled for creation", "response content looks good for first POST /widgets"; $response = dancer_response POST => '/widgets'; is $response->{status}, 202, "response for POST /widgets is 202"; is $response->{content}, "Widget #2 has been scheduled for creation", "response content looks good for second POST /widgets"; It's possible to test file uploads: post '/upload' => sub { return upload('image')->content }; $response = dancer_response(POST => '/upload', {files => [{name => 'image', filename => '/path/to/image.jpg'}]}); In addition, you can supply the file contents as the "data" key: my $data = 'A test string that will pretend to be file contents.'; $response = dancer_reponse(POST => '/upload', { files => [{name => 'test', filename => "filename.ext", data => $data}] }); read_logs my $logs = read_logs; Returns an array ref of all log messages issued by the app since the last call to "read_logs". For example: warning "Danger! Warning!"; debug "I like pie."; is_deeply read_logs, [ { level => "warning", message => "Danger! Warning!" }, { level => "debug", message => "I like pie.", } ]; error "Put out the light."; is_deeply read_logs, [ { level => "error", message => "Put out the light." }, ]; See Dancer::Logger::Capture for more details. LICENSE
This module is free software and is distributed under the same terms as Perl itself. AUTHOR
This module has been written by Alexis Sukrieh <sukria@sukria.net> SEE ALSO
Test::More perl v5.14.2 2012-03-31 Dancer::Test(3pm)
All times are GMT -4. The time now is 08:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy