Don't use for to read lines. Use a while read loop.
This will loop over the file and grab the statement name from your ## lines. probably only good for single-line statements
Code:
#!/bin/bash
while read -r sql; do
if [[ $sql = \#* ]]; then
stmt=${sql#* }
elif [[ $sql = *[![:space:]]* ]]; then # has something besides blank
if RunSQL "$sql"; then
echo "$stmt:PASS"
else
echo "$stmt:FAIL"
fi
fi
done < "SQL.dat"
Last edited by neutronscott; 07-08-2015 at 12:06 PM..
Dear Friends,
I need a shell script.
I am facing a problem while selecting the text that is between start and end tags. and insert the paragraph into a file1, next paragraph in file2......
experts please help.
i have a file which contains,
--------------
<abc> 111some text some text
some... (2 Replies)
hi,
i wanted to put the output of file f1 into the pattern space of file f2
f1:
wjwjwjwjwjwjwj //these line go in file f2
jwjwjwjwjwjjwjw
wjwjwjwjjwjwjwj
f2:
Pattern_start
__________ //these are the line to be replaced
__________
Pattern_end
i m... (4 Replies)
# include <stdio.h>
# include <fcntl.h>
# include <stdlib.h>
# include <sys/stat.h>
int main(int argc, char *argv)
{
int fRead, fPadded, padVal;
int btRead;
int BUFFSIZE = 512;
char buff;
if (argc != 4)
{
printf ("Please provide all of the... (3 Replies)
Hi, I'm trying to output all text from the first paragraph in a file that contains a specific string through the last paragraph in that file that contains that string.
Previously, I was outputting just each paragraph with that search string with:
cat in_file | nawk '{RS=""; FS="\n";... (2 Replies)
I have a collection of text files that comprise a mailing list archive. I grep them to find an email that interests me, then open the file in a text editor to find the surrounding paragraph of text. Is there an easy way to do this from the shell instead? (2 Replies)
Hello All,
i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file.
Any inputs are appreciated
... (3 Replies)
Hi,
I am facing issues with the below:
I have a lookup file say lookup.lkp.This lookup.lkp file contains strings delimited by comma(,).
Now i want to read this command from file and execute it.
So my code below is :
Contents in the lookup.lkp file is :
c_e,m,a,`cd $BOX | ls cef_*|tail... (7 Replies)
In the reference section of a research paper(in pdf form), many other paper names are cited which have been used inside the pdf at different places. If I give an input, the name of a paper which has been cited in the reference section and want to display the section (the paragraph) inside the pdf... (1 Reply)
Hi all,
Is there any idea on how to automate convert the paragraph in one line in a file, this will happen after OCR the documents, OCR split every paragraph. I need to join all the paragraph in one line.
#cat file.txtThe Commission on Higher Education (CHED) was created through Republic Act... (7 Replies)
Discussion started by: lxdorney
7 Replies
LEARN ABOUT PHP
sqlsrv_field_metadata
SQLSRV_FIELD_METADATA(3)SQLSRV_FIELD_METADATA(3)sqlsrv_field_metadata - Retrieves metadata for the fields of a statement prepared bysqlsrv_prepare(3)orsqlsrv_query(3)SYNOPSIS
mixed sqlsrv_field_metadata (resource $stmt)
DESCRIPTION
Retrieves metadata for the fields of a statement prepared by sqlsrv_prepare(3) or sqlsrv_query(3). sqlsrv_field_metadata(3) can be called
on a statement before or after statement execution.
PARAMETERS
o $stmt
- The statment resource for which metadata is returned.
RETURN VALUES
Returns an array of arrays is returned on success. Otherwise, FALSE is returned. Each returned array is described by the following table:
Array returned by sqlsrv_field_metadata
+----------+---------------------------------------------------+
| Key | |
| | |
| | Description |
| | |
+----------+---------------------------------------------------+
| Name | |
| | |
| | The name of the field. |
| | |
| Type | |
| | |
| | The numeric value for the SQL type. |
| | |
| Size | |
| | |
| | The number of characters for fields of character |
| | type, the number of bytes for fields of binary |
| | type, or NULL for other types. |
| | |
|Precision | |
| | |
| | The precision for types of variable precision, |
| | NULL for other types. |
| | |
| Scale | |
| | |
| | The scale for types of variable scale, NULL for |
| | other types. |
| | |
|Nullable | |
| | |
| | An enumeration indicating whether the column is |
| | nullable, not nullable, or if it is not known. |
| | |
+----------+---------------------------------------------------+
For more information, see sqlsrv_field_metadata in the Microsoft SQLSRV documentation.
EXAMPLES
Example #1
sqlsrv_field_metadata(3) example
<?php
$serverName = "serverNamesqlexpress";
$connectionInfo = array( "Database"=>"AdventureWorks", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT * FROM Table_1";
$stmt = sqlsrv_prepare( $conn, $sql );
foreach( sqlsrv_field_metadata( $stmt ) as $fieldMetadata ) {
foreach( $fieldMetadata as $name => $value) {
echo "$name: $value<br />";
}
echo "<br />";
}
?>
SEE ALSO sqlsrv_client_info(3).
PHP Documentation Group SQLSRV_FIELD_METADATA(3)