statements

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) ...

Hibernate, get datas from both tables in a join statement

I want to use below code and want to get datas from both tables, but how? There aren't any association in my hibernate mapping files. SQLQuery query = session.createSQLQuery("SELECT cat.* from cat inner join owner on cat.owner_id = owner.id where owner.name=:username"); query.addEntity(Cat.class); query.setInteger("username",'Duke');...

Is there a VB equivalent to C#'s Continue and Break statements?

For sake of argument, how could I do this in VB? foreach foo in bar { if (foo == null) break; if (foo = "sample") continue; //more code //... } ...

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...

How to check if a variable has any value from a given set?

How can I check if a condition passes multiple values Example: if(number == 1,2,3) I know that commas don't work. EDIT: Thanks! ...

Firebird multiple statements

Hello, is there any way to execute multiple statements (none of which will have to return anything) on Firebird? Like importing a SQL file and executing it. I've been looking for a while and couldn't find anything for this. ...

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...

C#, Are these 2 statements identical?

Do the following 2 code snippets achieve the same thing? My original code: if (safeFileNames != null) { this.SafeFileNames = Convert.ToBoolean(safeFileNames.Value); } else { this.SafeFileNames = false; } What ReSharper thought was a better idea: this.SafeFileNames = safeFileNames != null && Convert.ToBo...

SQL -- How to combine three SELECT statements with very tricky requirements

I have a SQL query with three SELECT statements. A picture of the data tables generated by these three select statements is located at www.britestudent.com/pub/1.png. Each of the three data tables have identical columns. I want to combine these three tables into one table such that: (1) All rows in top table (Table1) are always includ...

How to use the SQLITE3 LIKE statement

hi all, I have problems running a dynamic LIKE statement in my project: this query works like a charm and returns all items with a 't' in there name: const char *sql = "select * from bbc_ipad_v1_node where name LIKE '%%t%%'"; When I try to do this dynamically I do not get erros, but just an empty result. It seems that the value is ...

PL-SQL - Two statements with begin and end, run fine seperately but not together?

Hi all, Just wondering if anyone can help with this, I have two PLSQL statements for altering tables (adding extra fields) and they are as follows: -- Make GC_NAB field for Next Action By Dropdown begin if 'VARCHAR2' = 'NUMBER' and length('VARCHAR2')>0 and length('')>0 then execute immediate 'alter table "SERVICEMAIL6"."ETD_GUESTCAR...

How do you access variables using NMake?

I have a makefile with the following code. I'm trying to set a variable in an if statement. It doesn't error, but %OPTION% just prints "%OPTION" (with only one percentage sign) and the $(OPTION) doesn't print anything. Please help RELEASE_OR_DEBUG=debug init: SET OPTION=test @echo test1 = %OPTION% @echo test2 = $(OPTION)...

Program compiles with and without return 0

Possible Duplicate: What should main() return in C/C++? This is a pretty basic question, I guess. I've been programming for a year now but a friend of mine surprised me with a rather stupefying question. Programs that start with 'int main()' on C++ seem to compile perfectly even with 'return 0;' removed and not replaced by a...

SQL: how to use column name from an outer clause in an inner clause?

How can I use the value from an outer clause inside an inner clause using nested SELECT statements? Eg: SELECT cost AS c, quantity, (SELECT COUNT(1) FROM accounts WHERE cost = c) FROM accounts Can c be referenced in the inner SELECT clause as attempted above? ...

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() ...

SQL Server and Oracle joins tutorials

Hello All, Question 1: I am learning SQL Server and Oracle joins (inner joins, outer joins...) and case statements syntax. Though I can google for the info, but would like to ask for some sites, links, and materials that fully explain the joins and case statments. Once again, thanks. Thanks gentlemen. Question 2: I am running a sim...