prepared

Java: creating a date object from a string and inserting into MySQL

Anytime I have to handle dates/times in java it makes me sad I'm trying to parse a string and turn it into a date object to insert in a preparepared statement. I've been trying to get this working but am having no luck. I also get the helpful error message when I go to compile the class. "Exception in thread "main" java.lang.Error: Un...

PHP Mysqli prepared not creating statement object

Hi, I am using the php mysqli extension with prepared statements, but on one query it is not creating the query object. Here is the code: $sqlq = "SELECT id,name FROM productcategories JOIN products ON productcategories.productid = products.id WHERE categoryid=?"; if($allsubcats) { foreach($allsubcats as $key => $data) ...

PDO Prepared Inserts multiple rows in single query

Hello, I am currently using this type of SQL on MySQL to insert multiple rows of values in one single query: INSERT INTO tbl (key1,key2) VALUES ('r1v1','r1v2'),('r2v1','r2v2'),... On the readings on PDO PDO, the use prepared statements should give me a better security than static queries. I would therefore like to know whether ...

prepared Statement in ejb3

Hi, i want to use prepared statement with ejb3 to insert data in oracle. is it possible to use. i try to find some example on net but i could not find any good example. Please help me to use it. or is there any other way to use parameter query (as we use ? in prepared statement) in ejb3 Thanks and regards ...

Getting "final" prepared statement from MySqlCommand

I have the following MySqlCommand: Dim cmd As New MySqlCommand cmd.CommandText = "REPLACE INTO `customer` VALUES( ?customerID, ?firstName, ?lastName)" With cmd.Parameters .AddWithValue("?customerID", m_CustomerID) .AddWithValue("?firstName", m_FirstName) .AddWithValue("?lastName", m_LastName) End With I have a class that handles e...

Get the Actual SQL of a Prepared Statement with mysqli??

Is there any way to get the actual SQL that is the result of preparing a statement when using the mysqli extension? My problem: I am using prepared statements. In all cases, they SHOULD update a record. I am not catching any errors. However, when I check for affected rows, there are none. So, I want to see the actual SQL that woul...

In SQLite, do prepared statements really improve performance?

I have heard that prepared statements with SQLite should improve performance. I wrote some code to test that, and did not see any difference in performance with using them. So, I thought maybe my code was incorrect. Please let me know if you see any errors in how I'm doing this... [self testPrep:NO dbConn:dbConn]; [self testP...

prepared statement with aggregate function

how to use prepared statement with aggregate functions ? ...

What is the syntax for counting number of rows in PHP Prepared Statement?

Hi, In using PHP Prepared Statement, what is the syntax for counting number of rows? $stmt = $conn->stmt_init(); $query = "SELECT * FROM TableName"; if($stmt->prepare($query)){ $stmt->num_row(); //SOMETHING SIMILAR TO THIS.... } ...

PHP PDO - output the prepared statment

Hallo, I use a prepared statment wiht PDO. and the method execute. I want to display the statment before it is executed, with the data replaced - the real 1:1 statment as a string? Any ideas? ...

MySQLi prepared statements error reporting

I'm trying to get my head around MySQli and I'm confused by the error reporting. I am using the return value of the MySQLi 'prepare' statement to detect errors when executing SQL, like this: $stmt_test = $mysqliDatabaseConnection->stmt_init(); if($stmt_test->prepare("INSERT INTO testtable VALUES (23,44,56)")) { $stmt_test->execute(); ...

Prepared Statements in MySql 5.1

This one is really puzzling. I can't seem to be able to run any prepared statement on MySql 5.1. Any simple select I'm writing runs fine but when I'm trying to run it from a prepared statement I'm getting Query returned no result set. What Am I doing wrong? Exmaple: prepare s from 'select * from t'; execute s; Thanks! ...

mysql bind param needs a persistent(from bind to execution) object?

Hi, when i use prepared statement, i see mysql takes a pointer to MYSQL_BIND.buffer For example, to bind an integer i need to provide the pointer to integer rather than integer itself. Does it mean that the integer address should be accessible until the query ends? It would be convenient to bind a temporary object and then execute it...

Using prepared statement without ROW_NUMBER() and OVER() functions in Db2.

Let's say I have a table T_SWA .This is my prepared statement. Select version from (Select id, version,creator,created_date ROW_NUMBER() OVER(order by created_date) cnt From T_SWA where cnt=3 and id=35); I need to select the 3rd recent version from the T_SWA table..Can anyone suggest a replacement for this query without using ROW_NUM() ...