Odbc_exec vs odbc_excute

from php manual:

odbc_exec Prepare and execute the SQL statement.

odbc_execute - execute prepared statement

which is prepared by odbc_prepare

and what else? why not use odbc_exec directly?

+4
source share
1 answer

If you want to execute the same statement several times with different parameters, then you prepare it once and execute the prepared statement several times. Some RDBMSs will compile an expression in its preparation, and this saves time in its execution. This is useful when you have a loop executing the same query inside a loop with different parameters.

For instance:

$stm = odbc_prepare($conn, 'INSERT INTO users (id, name, email) VALUES (?, ?, ?)'); foreach($users as $user) { $success = odbc_execute($stm, array($user['id'], $user['name'], $user['email'])); } 
+8
source

Source: https://habr.com/ru/post/1447616/


All Articles