parameterized

Any way to access the type of a Scala Option declaration at runtime using reflection?

So, I have a Scala class that looks like this: class TestClass { var value: Option[Int] = None } and I'm tackling a problem where I have a String value and I want to coerce it into that Option[Int] at runtime using reflection. So, in another piece of code (that knows nothing about TestClass) I have some code like this: def setField...

Parameterized SQL statements vs. very simple method

When I started to write the first SQL-Statements in my programs I felt quite comfortable with protecting myself against SQL-Injection with a very simple method that a colleague showed me. It replaced all single quotes with two single quotes. So for example there is a searchfield in which you can enter a customername to search in the cus...

PHP: prepared statement, IF statement help needed

I have the following code: $sql = "SELECT name, address, city FROM tableA, tableB WHERE tableA.id = tableB.id"; if (isset($price) ) { $sql = $sql . ' AND price = :price '; } if (isset($sqft) ) { $sql = $sql . ' AND sqft >= :sqft '; } if (isset($bedrooms) ) { $sql = $sql . ' AND bedrooms >= :bedrooms '; } $stmt = $dbh->pre...

VB.Net MySql command parameter MD5

Is it possible to execute a command like this? select * from tbl where col1=somefunction(@param1) or will the parameter throw off the function? I have been unsuccessful in getting the command to work so far. Please let me know if this needs any further explanation and thank you in advance! ...

How do I update selective fields in SQL (leaving some unchanged)?

I would like to update a record with two dates, leaving existing data intact if I do not have a new value to update with. Here is a sample table record: id last_foo last_bar -- ---------- ---------- 1 2010-05-30 2010-05-30 And the query I am using: UPDATE sampledates SET last_foo = @LastFoo, last_bar = @LastBar ...

Hudson: how do i use a parameterized build to do svn checkout and svn tag?

I'm setting up a parameterized build in hudson v1.362. the parameter i'm creting is used to determine which branch to checkout in subversion. I can set my svn repository url like this: https://my.svn.server/branches/${branch} and it does the checkout and the build just fine. now I want to tag the build after it finishes. i'm using the...

Are input sanitization and parameterized queries mutually exclusive?

I'm working updating some legacy code that does not properly handle user input. The code does do a minimal amount of sanitization, but does not cover all known threats. Our newer code uses parameterized queries. As I understand it, the queries are precompiled, and the input is treated simply as data which cannot be executed. In that cas...

Is C++ OTL SQL database library using parameterized queries under the hood, or string concat?

I've been looking at the OTL library for C++ database access. I'm unsure of whether the query I pass in is converted to a parameterized query for the underlying database, or if it's basically just concatenating all the arguments into one big string and passing the query to the database that way. I see that the query you pass in to it c...

[zend][db] fetchAll with multiple variables

Hi everybody, I'm trying to use fetchAll on a query that has 2 variables. I can't figure out the syntax. I can manage with only 1 variable: $sql = "SELECT * FROM mytable WHERE field1 = ?"; $this->_db->fetchAll($sql,$value1); # that works However I'm having some issues when query has multiple variables $sql = "SELECT * FROM mytable ...

Compilation problem when working with java.util.Map

Hi, I am trying to compile this program. It works perfectly for 2 Strings(Name, phone number) But not for 3 Strings (Name, phone number and sex). CODE (Not working code - 3 Strings (Name, phone number and sex)) import java.util.Map; import java.util.TreeMap; public class Ann { String name, phone; public Ann() { } public static ...

Returning an objects subclass with generics.

With an abstract class I want to define a method that returns "this" for the subclasses: public abstract class Foo { ... public <T extends Foo> T eat(String eatCake) { ... return this; } } public class CakeEater extends Foo {} I want to be able to do things like: CakeEater phil = new CakeEater(); phil.e...

PDO and Microsoft SQL: Must declare the table variable "@P1"

I'm trying to use binding in PDO to select some entries from a Microsoft SQL database. The code I'm using looks like it's similar to what I've found in the documentation. However, when I run it, I get the warning below: Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[42000]: Syntax error or access violation: 1087 [M...

Parameterized queries on iteration

Hello. I am inserting a web form into the database and so using parameterized queries. I have a CheckBoxList. How can I iterate over CheckBoxList, create an insert statement for every checked thing (many-to-many), and keep this parameterized and executed in one swoop? I have this right now: string query = "INSERT INTO resources (url, s...

SQL Server Performance of Parameterized Queries with leading wildcards

I have a SQL 2008 R2 Database with about 2 million rows in one of the tables and am struggling with the performance of a specific query when using parameterized SQL. In the table, there's a field containing a name in it: [PatientsName] nvarchar NULL, There's also a simple index on the field: CREATE NONCLUSTERED INDEX [IX_Study_...

What is the difference between a parameterized class and a metaclass (code examples in Python please)?

Hello Stack Overflow contributers, I'm a novice programmer learning Python right now, and I came upon this site which helps explain object-oriented paradigms. I know that metaclasses are classes of classes (like how meta-directories are directories of directories, etc. etc.), but I'm having trouble with something: What is the actual dif...

Command parameters are unsupported with the current provider - What do I do?!

I'm trying to query the Microsoft Indexing Service catalog, and I've found a bunch of really helpful articles about it (like this one), but every example I find they just use string concatenation to build queries, and it feels so wrong on so many different levels. I clearly want to use parameterized queries, but it looks like the MS Ind...