Sponsored Content
Full Discussion: while loop logic
Top Forums Shell Programming and Scripting while loop logic Post 302567479 by vbe on Monday 24th of October 2011 10:04:37 AM
Old 10-24-2011
I may sound silly, but if all you are interested in is knowing the SQL query has finished, why not let the query tell you?(If its being called in a script...)

About your code:
You test :
Code:
while grep -i "no rows selected" reqidstatus_log.txt

will always be true... (You read always the same file that has the condition when you start...
Since we dont know how it is generated (one line every minute?) or his content, it will be difficult to suggest something... but perhaps try to use tail command to read X last lines of file, which may help the condition to change (X one to ?? lines?)

Last edited by vbe; 10-24-2011 at 11:36 AM..
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

While Loop Logic

I would need to with making while loop logic working in shell program when I am new into the shell programing 1) I would need to try to get the file from the remote side ----need to try 15 mins apart for 4 times and terminate the program if file is not available.... I would need to know how I... (4 Replies)
Discussion started by: sambakamba
4 Replies

2. Shell Programming and Scripting

for loop logic with multiple parameters

hi, unix wizards, i have a question about the logic of my inner for loop below. first, what i am trying to do is to write a script called create_account that automatically creates mysql accounts. the user can provide a user_name or a group_id as an argument (and the script can take multiple... (1 Reply)
Discussion started by: ankimo
1 Replies

3. Shell Programming and Scripting

loop logic inside of an inline redirect?

i need to log the feedback from the ftp server as i'm performing some deletes. the only way i know of to do this is with the inline redirect << EOF ... but from there to the closing EOF, it's like i'm at the ftp command prompt, so I don't know how to have ksh script logic in there I have an... (3 Replies)
Discussion started by: tlavoie
3 Replies

4. UNIX for Dummies Questions & Answers

if then else logic with while loop problem

Hi Friends, I have to do write a shell file based on one flag.If that flag value is 'N' then process look in $DATA are and the normal process continue.If vaule is 'P' then it check for the files in different location $CONV and move those file in $DATA area and rest of the process... (2 Replies)
Discussion started by: Param0073
2 Replies

5. Shell Programming and Scripting

Shell/Perl logic for loop

Hi, I have a requirement as follows. Have 3 files. Need to match up the data in each one of them and sum up the data by a field and display it. example given below. File 1 : Name, Emp id File 2 : Empid, Subject, File 3 : Subject, Score, Class Match Emp id in File 1 and File 2 and then... (7 Replies)
Discussion started by: preethgideon
7 Replies
SQLITE_ARRAY_QUERY(3)													     SQLITE_ARRAY_QUERY(3)

sqlite_array_query - Execute a query against a given database and returns an array

SYNOPSIS
array sqlite_array_query (resource $dbhandle, string $query, [int $result_type = SQLITE_BOTH], [bool $decode_binary = true]) DESCRIPTION
array sqlite_array_query (string $query, resource $dbhandle, [int $result_type = SQLITE_BOTH], [bool $decode_binary = true]) Object oriented style (method): array SQLiteDatabase::arrayQuery (string $query, [int $result_type = SQLITE_BOTH], [bool $decode_binary = true]) sqlite_array_query(3) executes the given query and returns an array of the entire result set. It is similar to calling sqlite_query(3) and then sqlite_fetch_array(3) for each row in the result set. sqlite_array_query(3) is significantly faster than the aforementioned. Tip sqlite_array_query(3) is best suited to queries returning 45 rows or less. If you have more data than that, it is recommended that you write your scripts to use sqlite_unbuffered_query(3) instead for more optimal performance. PARAMETERS
o $query - The query to be executed. Data inside the query should be properly escaped. o $dbhandle - The SQLite Database resource; returned from sqlite_open(3) when used procedurally. This parameter is not required when using the object-oriented method. o $result_type -The optional $result_type parameter accepts a constant and determines how the returned array will be indexed. Using SQLITE_ASSOC will return only associative indices (named fields) while SQLITE_NUM will return only numerical indices (ordinal field numbers). SQLITE_BOTH will return both associative and numerical indices. SQLITE_BOTH is the default for this function. o $decode_binary -When the $decode_binary parameter is set to TRUE (the default), PHP will decode the binary encoding it applied to the data if it was encoded using the sqlite_escape_string(3). You should normally leave this value at its default, unless you are interoperating with databases created by other sqlite capable applications. Note Two alternative syntaxes are supported for compatibility with other database extensions (such as MySQL). The preferred form is the first, where the $dbhandle parameter is the first parameter to the function. RETURN VALUES
Returns an array of the entire result set; FALSE otherwise. The column names returned by SQLITE_ASSOC and SQLITE_BOTH will be case-folded according to the value of the sqlite.assoc_case configuration option. EXAMPLES
Example #1 Procedural style <?php $dbhandle = sqlite_open('sqlitedb'); $result = sqlite_array_query($dbhandle, 'SELECT name, email FROM users LIMIT 25', SQLITE_ASSOC); foreach ($result as $entry) { echo 'Name: ' . $entry['name'] . ' E-mail: ' . $entry['email']; } ?> Example #2 Object-oriented style <?php $dbhandle = new SQLiteDatabase('sqlitedb'); $result = $dbhandle->arrayQuery('SELECT name, email FROM users LIMIT 25', SQLITE_ASSOC); foreach ($result as $entry) { echo 'Name: ' . $entry['name'] . ' E-mail: ' . $entry['email']; } ?> SEE ALSO
sqlite_query(3), sqlite_fetch_array(3), sqlite_fetch_string(3). PHP Documentation Group SQLITE_ARRAY_QUERY(3)
All times are GMT -4. The time now is 03:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy