parameterized

Plain SQL output from NHibernate

I need: Plain SQL that I can run without modification with sqlcmd.exe to insert testdata into testdatabase. I have: Service calls and entities to generate the insert operations with NHibernate. Not working solution: Log output to text-file. NHibernate generates parameterized sql but logs them in a format not runnable by sqlcmd.exe. ...

How to set query parameters in MySQL Query Browser?

Can the MySQL Query Browser set parameters of a parameterized query? If so, how? I tried populating the Parameter Browser tab but it doesn't seem to actually set parameters when I execute the query. I searched for quite a while in Google (e.g. mySQL Query Browser parameterized) but had no luck finding the answer. I found this threa...

performance of parameterized queries for different db's

A lot of people know that it is important to use parameterized queries to prevent sql injection attacks. Parameterized queries are also much faster in sqlite and oracle when doing online transaction processing because the query optimizer doesn't have to reparse every parameterized sql statement before executing. I've seen sqlite becomi...

Java List parameterized?

Hi, I am quite new to Java ... I wrote a class called DLPFile which is basically a container of other objects like Strings, ints, floats, etc. When putting my files into a List and then saving it in my session (which is from Map class) variable is easy; DLPFile file = new DLPFile(); List <DLPFile >fileList = new ArrayList <DLPFile>...

If I pass an object to a thread via ParameterizedThreadStart, can I access it later?

If I start a thread in the following manner Thread newThread = new Thread(new ParameterizedThreadStart(MyThreadMethod)); Object myObject = new Object(); newThread.Start(myObject); Can I find out what has it done to myObject after it has finished the task? // at some point later if(newThread.ThreadState == ThreadState.Stopped) { //acc...

Are all Refactorings parameterized?

The question is about refactorings. Consider a rename method refactoring. This refactoring can be visualized as meta-method that takes old and new names, and changes the old method name to the new. so, for refactoring foo() { ......... ......... } to boo() { ......... ......... } the meta method for refactoring would be ... renam...

How do SQL parameters work internally?

A coworker and I were browsing SO when we came across a question about SQL Injection, and it got us wondering: how do parametrized queries work internally? Does the API you are using (assuming it supports parametrized queries) perform concatenation, combining the query with the parameters? Or do the parameters make it to the SQL engine...

Binding params with Kohana's Database library

I know I can bind params in Kohana like this $this->db->query('SELECT * FROM products WHERE id = ?', array(14)); But is there a way to do it with identifiers (or whatever they are called?) As in $this->db->query('SELECT * FROM products WHERE id = :id', array(':id' => 14)); Thanks ...

Parameterized Query: Check if field is in array of values in SELECT statement

I'm trying to configure a parameterized query to the effect of: SELECT field1 FROM myTable WHERE field2 IN (1,2,3,4) The database I'm using is Postgres. This query run successfully unparameterized, but I'd like to use a parameterized query with a JdbcTemplate to fill in the list for valid field2 values (which are integers). Trying v...

Use NamedParameterJdbcTemplate to update array field

I have a double precision array field dblArrayFld in a table myTable and I'd like to update it using Spring's NamedParameterJdbcTemplate (I'm using Postgres). I'm running code like this: SqlParameterSource params = (new MapSqlParameterSource()) .addValue("myarray", myDblArrayListVar) .addValue("myid", 123); namedJdbcTemplate.updat...

SQL Server query plan differences

I'm having trouble understanding the behavior of the estimated query plans for my statement in SQL Server when a change from a parameterized query to a non-parameterized query. I have the following query: DECLARE @p0 UniqueIdentifier = '1fc66e37-6eaf-4032-b374-e7b60fbd25ea' SELECT [t5].[value2] AS [Date], [t5].[value] AS [New] FROM ( ...

Executing LINQ-to-SQL Debug Output?

When you log LINQ-to-SQL's query output via the "Log" property on the DataContext object, you get output similar to: SELECT [t0].[fullaname], [t0].[Worker], [t0].[Office] FROM [dbo].[Workers] AS [t0] WHERE [t0].[OfficeID] = @p0 ORDER BY [t0].[Name] -- @p0: Input Int (Size = 0; Prec = 0; Scale = 0) [412] -- Context: SqlProvider(Sql2005) ...

How do I use paramertized generic types in an inner class?

Hello, I am trying to implement an inner class that has generic parameterized type. Here is my code (short version): public class AVLTree<T extends Comparable<? super T>> implements Iterable<T> { ... private class BinaryNode<T extends Comparable<? super T>> { ... } private class TreePreOrderIterator<E extends Comparable<? super...

Strange behaviour with parameterized method on abstract class

Hi. Can someone tell my why this gives a compile error? I don't see why the cast to A in the second for-loop causes strings() to return a general List of Objects. import java.util.ArrayList; import java.util.List; public class E { public static void main(String[] args) { for (String s : new D().strings()) { Sys...

Table-Valued Functions in ORACLE 11g ? ( parameterized views )

Hi all, I've seen discussions about this in the past, such as here. But I'm wondering if somewhere along the line, maybe 10g or 11g (we are using 11g), ORACLE has introduced any better support for "parameterized views", without needing to litter the database with all sorts of user-defined types and/or cursor definitions or sys_context va...

What's the best way to choose a table name dynamically at runtime?

I am using MySQL Connector/Net and I want to write a query against a table whose name will be specified at runtime. This example is off the top of my head (not tested): public class DataAccess { public enum LookupTable { Table1, Table2, Table3 } public int GetLookupTableRowCount(LookupTable tabl...

Why can't I use wildcard with methods receiving a parameterized argument?

For example, I use a method Measure.doubleValue(Unit<?> unit) which returns the double value of a measurement, expressed in the specified Unit. If I pass a Unit<?> variable to it, I get the still very cryptic (to me) error message: The method doubleValue(Unit<capture#27-of ?>) in the type Measurable<capture#27-of ?> is not app...

How to do a parameterized query

[ Status: Learner ] I am attempting to implement a parameterized query but I am having problems. Jonathan Sampson recently hinted at how this could be done (#2286115), but I'm not following his suggestion correctly. Here is my script $cGrade = "grade" ; include_once ( "db_login.php" ) ; $sql = "SELECT last_name AS last_name ...

parameterized query in ms access 2003 using vba

Ok. I want to use parameterized queries to avoid dealing with embedded double or single quotes (" or ') in my data. As a simple example, what would the VBA code look like for the parameterized verion of this? Dim qstr as String Dim possiblyDangerousString as String qstr = "SELECT MyTable.LastName from MyTable WHERE MyTable.LastName ...

parametrized query jqgrid

Hey, I have this mysql tables I want to display with jqgrid. The problem appears when I want to display a parametrized query. For example lets say I want to display all students older than 21. I have this variable named age which I want to pass to server.php file where I can construct the XML or JSON. On server I see some variables l...