Sponsored Content
Full Discussion: Need some help with this...
Top Forums Programming Need some help with this... Post 302138248 by porter on Sunday 30th of September 2007 05:42:21 PM
Old 09-30-2007
Basically you would be converting the following into C.

Code:
#!/bin/sh

first()
{
        echo $1
}

for n in $@
do
        /usr/bin/alias | while read STR
        do
                NAME=`echo $STR | sed y/=/\ /`
                FIRST=`first $NAME`
                if test "$FIRST" = "$n"
                then
                        echo $STR | sed s/$n=//
                fi
        done

        if test -f $n
        then
                echo $n
        fi

        for d in `echo $PATH | sed y/:/\ /`
        do
                if test -f $d/$n
                then
                        echo $d/$n
                fi
        done
done

 
MSSQL_FETCH_FIELD(3)													      MSSQL_FETCH_FIELD(3)

mssql_fetch_field - Get field information

SYNOPSIS
object mssql_fetch_field (resource $result, [int $field_offset = -1]) DESCRIPTION
mssql_fetch_field(3) can be used in order to obtain information about fields in a certain query result. PARAMETERS
o $result - The result resource that is being evaluated. This result comes from a call to mssql_query(3). o $field_offset - The numerical field offset. If the field offset is not specified, the next field that was not yet retrieved by this function is retrieved. The $field_offset starts at 0. RETURN VALUES
Returns an object containing field information. The properties of the object are: o name - column name. if the column is a result of a function, this property is set to computed#N, where #N is a serial number. o column_source - the table from which the column was taken o max_length - maximum length of the column o numeric - 1 if the column is numeric o type - the column type. EXAMPLES
Example #1 mssql_fetch_field(3) example <?php // Connect to MSSQL and select the database mssql_connect('MANGOSQLEXPRESS', 'sa', 'phpfi'); mssql_select_db('php'); // Send a select query to MSSQL $query = mssql_query('SELECT * FROM [php].[dbo].[persons]'); // Construct table echo '<h3>Table structure for 'persons'</h3>'; echo '<table border="1">'; // Table header echo '<thead>'; echo '<tr>'; echo '<td>Field name</td>'; echo '<td>Data type</td>'; echo '<td>Max length</td>'; echo '</tr>'; echo '</thead>'; // Dump all fields echo '<tbody>'; for ($i = 0; $i < mssql_num_fields($query); ++$i) { // Fetch the field information $field = mssql_fetch_field($query, $i); // Print the row echo '<tr>'; echo '<td>' . $field->name . '</td>'; echo '<td>' . strtoupper($field->type) . '</td>'; echo '<td>' . $field->max_length . '</td>'; echo '</tr>'; } echo '</tbody>'; echo '</table>'; // Free the query result mssql_free_result($query); ?> SEE ALSO
mssql_field_seek(3). PHP Documentation Group MSSQL_FETCH_FIELD(3)
All times are GMT -4. The time now is 04:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy