That makes sense about the varchar. ... thanks.

Still getting nothing in my result sets. See anything wrong with my
prepared statement? Debug looks good.

Connect to *LOCAL
Connected to *LOCAL with ID .
SQL: select CMEMAIL, CMLNAME, CMFNAME, CMFCOMP, CMFADD1, CMFADD2, CMFCITY,
CMFSTATE, CMFZIP, CMFCNT, CMNOTES from bvscomp.cstmstpf where
UCASE(CMEMAIL) like ?
Bind Parameter [1] = %STONE%
SQLExecute() rc=0.
SQLRowCount() rc=0.

var sql = 'select * from cstmstpf where UCASE(CMEMAIL) like ?';

db.init();
db.conn(DBname);
db.prepare(sql);
db.bindParam([
['%' + email + '%', db.SQL_PARAM_INPUT, 0],
]);

try {
db.execute(function callback(out) {
console.log(out);
res.render('customerList', {customerList: out});
});
} catch(e){
console.log('error: ' + e + ' for sql statement ' + sql);
}

I've tried a few different SQL statements, even ones without any parameters
and they don't work when using the prepare... but if I run the same SQL
statement through exec it works fine.

On Mon, Apr 4, 2016 at 5:03 AM, Justin Dearing <zippy1981@xxxxxxxxx> wrote:

On Sun, Apr 3, 2016 at 3:19 PM Bradley Stone <bvstone@xxxxxxxxx> wrote:

I'm aware of SQL injection, just testing while I'm getting started.


Good.


Have to TRIM() all the values... fun. :)


Well that's a matter of how things are stored in the table. If they are
char and not vachar columns, then there is nothing you can do. If they are
varchar columns, then you need to fix whatever program enters that data.
Creating a view will move all those TRIM statements out of your code.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.