Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

odbc_prepare(3) [php man page]

ODBC_PREPARE(3) 							 1							   ODBC_PREPARE(3)

odbc_prepare - Prepares a statement for execution

SYNOPSIS
resource odbc_prepare (resource $connection_id, string $query_string) DESCRIPTION
Prepares a statement for execution. The result identifier can be used later to execute the statement with odbc_execute(3). Some databases (such as IBM DB2, MS SQL Server, and Oracle) support stored procedures that accept parameters of type IN, INOUT, and OUT as defined by the ODBC specification. However, the Unified ODBC driver currently only supports parameters of type IN to stored procedures. PARAMETERS
o $connection_id -The ODBC connection identifier, see odbc_connect(3) for details. o $query_string - The query string statement being prepared. RETURN VALUES
Returns an ODBC result identifier if the SQL command was prepared successfully. Returns FALSE on error. EXAMPLES
Example #1 odbc_execute(3) and odbc_prepare(3) example In the following code, $success will only be TRUE if all three parameters to myproc are IN parameters: <?php $a = 1; $b = 2; $c = 3; $stmt = odbc_prepare($conn, 'CALL myproc(?,?,?)'); $success = odbc_execute($stmt, array($a, $b, $c)); ?> If you need to call a stored procedure using INOUT or OUT parameters, the recommended workaround is to use a native extension for your database (for example, mssql for MS SQL Server, or oci8 for Oracle). SEE ALSO
odbc_execute(3). PHP Documentation Group ODBC_PREPARE(3)

Check Out this Related Man Page

ODBC_SETOPTION(3)							 1							 ODBC_SETOPTION(3)

odbc_setoption - Adjust ODBC settings

SYNOPSIS
bool odbc_setoption (resource $id, int $function, int $option, int $param) DESCRIPTION
This function allows fiddling with the ODBC options for a particular connection or query result. It was written to help find work around to problems in quirky ODBC drivers. You should probably only use this function if you are an ODBC programmer and understand the effects the various options will have. You will certainly need a good ODBC reference to explain all the different options and values that can be used. Different driver versions support different options. Because the effects may vary depending on the ODBC driver, use of this function in scripts to be made publicly available is strongly dis- couraged. Also, some ODBC options are not available to this function because they must be set before the connection is established or the query is prepared. However, if on a particular job it can make PHP work so your boss doesn't tell you to use a commercial product, that's all that really matters. PARAMETERS
o $id - Is a connection id or result id on which to change the settings. For SQLSetConnectOption(), this is a connection id. For SQLSet- StmtOption(), this is a result id. o $function - Is the ODBC function to use. The value should be 1 for SQLSetConnectOption() and 2 for SQLSetStmtOption(). o $option - The option to set. o $param - The value for the given $option. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 odbc_setoption(3) examples <?php // 1. Option 102 of SQLSetConnectOption() is SQL_AUTOCOMMIT. // Value 1 of SQL_AUTOCOMMIT is SQL_AUTOCOMMIT_ON. // This example has the same effect as // odbc_autocommit($conn, true); odbc_setoption($conn, 1, 102, 1); // 2. Option 0 of SQLSetStmtOption() is SQL_QUERY_TIMEOUT. // This example sets the query to timeout after 30 seconds. $result = odbc_prepare($conn, $sql); odbc_setoption($result, 2, 0, 30); odbc_execute($result); ?> PHP Documentation Group ODBC_SETOPTION(3)
Man Page

15 More Discussions You Might Find Interesting

1. Programming

Exit Code in HP-UX KSH.

In one of my programs another process is called using the system command e.g. lv_error = system("myproc"); where lv_error is declared as an int. myproc would be returning 0 for success and 1 for failure. e.g. if (success) { return(0); }else{ return(1); } When the return code... (3 Replies)
Discussion started by: mbb
3 Replies

2. UNIX for Dummies Questions & Answers

A Terminal Dilemma

Hi everyone, I hope this is the right place to ask this question... I have a contract to convert a mainframe/DB2 application to using AIX/Oracle. Everything went fine but we are now running into a terminal problem. With the Mainframe app, the clients had great response time from remote... (5 Replies)
Discussion started by: rocky_triton
5 Replies

3. Shell Programming and Scripting

Executing multiple Oracle procedures concurrently

I am using KSH with an OS of AIX Version 5.3. From my shell script, that will be scheduled thorugh a CRON, I need to execute 2 Oracle stored procedures concurrently. If we execute them one at a time, the total execution time takes 4 hours or more. Since they are not dependent on each other and... (6 Replies)
Discussion started by: multidogzoomom
6 Replies

4. Solaris

Executing MS-SQL stored procedures from Unix/C Program?

All, We are contemplating a port of an existing software product and would like to expend as little effort as possible. Our new database would be MS-SQL, and we would write stored procedures to perform common db operations. We'd like to call these stored procedures from C or C++ code running... (3 Replies)
Discussion started by: mparks
3 Replies

5. Programming

Getting another process' environment

Suppose that I have an environment variable (call it "EVAR") that I set before running a process (call it "myproc"). "myproc" is run multiple times by multiple users and each may set "EVAR" differently. I.E.: UserA: export EVAR=v1 myproc UserB: export EVAR=v2 myproc Now "myproc" is... (3 Replies)
Discussion started by: DreamWarrior
3 Replies

6. Windows & DOS: Issues & Discussions

Oracle 9i ODBC connection

I am attempting to access an Oracle 9i database located on a Solaris server from an XP client. The server is running Oracle 9i9.2.0.1.0 and the XP is Oracle client 9i 9.2.0.1.0. When I start a listener on the server, the listener starts but I receive a message “The listener supports no services”. I... (3 Replies)
Discussion started by: jkuchar747
3 Replies

7. Shell Programming and Scripting

DBD::ODBC::st fetchrow_hashref failed: [unixODBC][Oracle][ODBC]Numeric value out of r

Here is part of my program code: #Collect the output of test database and count the no #of rows too while(my @array = $tstDbStatementHandle->fetchrow_array) { push @tstDbOutputArray,; $tstDbOutputRows++; } ... (3 Replies)
Discussion started by: sameerstephen
3 Replies

8. Linux

set echo off command issue

Hi all, I am executing a Oracle SQL statement in a shell script and spooling the output of the query into a File with spool command. I want to ensure that only output of the query appears in file excluding the SQL statement but even set echo off command is not working. Please help (7 Replies)
Discussion started by: sumi_mn
7 Replies

9. UNIX for Advanced & Expert Users

Extract Oracle DB Connect and SQL execution log

Hi, I am trying to write a generic script as a part of a framework which will establish Oracle DB connection once and loops in to check for some files which gives the SQL statements to execute. The script is running but I am stuck with capturing errors ( ORA and SP) and outputs. Example: ... (4 Replies)
Discussion started by: mirage0809
4 Replies

10. AIX

ODBC Connectivity between Oracle10g on AIX and Mainframe

Hi, I have a task of setting up connectivity between Oracle 10g (AIX) and Mainframe (1 library). Went through couple of documents, forums, blogs etc. MY understanding is ODBC Generic Connectivity is free from Oracle side. Question: (may be dumb to you) 1. Has anybody done this and would... (3 Replies)
Discussion started by: jvmani_1
3 Replies

11. Shell Programming and Scripting

Problem with tabs expansion

I have to create some fixed width files using UNIX. The data source is an Oracle SQL query. If I use straight SQL and spool to a file everything comes out as expected. Example Desired result (. indicate blank space): V278814831..................................1743049591.10N... (6 Replies)
Discussion started by: dortoh
6 Replies

12. Shell Programming and Scripting

Pass parameter from PL/SQL to Unix "as is"

Hi, I need to pass 4 parameters from Oracle Procedure to Unix Shell script.. procedure signature :- UNIX Shell script: Problem: 1. Suppose pdffile and pdfresult has Null values in Oracle procedures but unix shell will read parameters by spaces so I am getting wrong parameters... (7 Replies)
Discussion started by: sandy162
7 Replies

13. Programming

SQL redesigning

The following request give the expected result (respecting a certain output formatting) But i was wondering if the same result could be produced in a more "optimized way" (Oracle 9i by the way) set feedback off set pagesize 0 set trimspool on ttitle off btitle off set verify off set... (3 Replies)
Discussion started by: ctsgnb
3 Replies

14. Shell Programming and Scripting

Running a select script through UNIX and sending output to file

Hi, (Oracle, AIX) I have googled this and searched this forum, however I haven't had much luck with an answer and have tried several different things. Basically I have a SQL select statement which generates a whole load of UPDATE statements, I want to run the select statement via... (13 Replies)
Discussion started by: dbchud
13 Replies

15. Shell Programming and Scripting

Need help with procedure and parameters in a script

Hi, I'm trying to create a procedure within my script and what I want is something like: myproc () { PARM1=value after -t PARM2=value after -y } myproc -t "PARM1 Value" -y "PARM2 Value" Of course that won't work since there's no such command as "value after -t". But this is... (4 Replies)
Discussion started by: adshocker
4 Replies