dbTalk Databases Forums  

Select, escaping special chars

comp.databases.ingres comp.databases.ingres


Discuss Select, escaping special chars in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] Select, escaping special chars - 10-19-2011 , 04:00 AM






Hi Ian,

My vi won't do ^K but my vim will!

In vi and xvile I've found that ^V is the way to go.
.. By decimal value: ^Vnnn (with 000 <= nnn <= 255)
.. By octal value: ^VOnnn or ^Vonnn (with 000 <= nnn <= 377)
.. By hex value: ^VXnn or ^Vxnn (with 00 <= nn <= FF)
.. By hex value for BMP Unicode codepoints: ^Vunnnn (with 0000 <= nnnn <= FFFF)
.. By hex value for any Unicode codepoint: ^VUnnnnnnnn (with 00000000 <= nnnnnnnn <= 7FFFFFFF)

The Perl pragma charnames is also pretty damn handy.

Marty

-----Original Message-----
From: Ian Kirkham [mailto:Ian.Kirkham (AT) actian (DOT) com]
Sent: 14 October 2011 15:12
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] Select, escaping special chars

Hi Marty,
I use vi to build the diacriticals as my keyboard is not very good with languages, (even English spelling it finds taxing).
In vi use control-k followed by a' or a` or n~ etc. then cut and paste ...
Regards,
Ian
-----Original Message-----
From: info-ingres-bounces (AT) kettleriver...ting (DOT) com [mailto:info-ingres-bounces (AT) kettleriverconsulting (DOT) com] On Behalf Of Martin Bowes
Sent: 14 October 2011 14:38
To: Ingres and related product discussion forum
Cc: Paul Mason
Subject: Re: [Info-Ingres] Select, escaping special chars

Hi Paul,

Oh that's sweet! But I take it that this can't be done after the database is created with another collation.

And on anoter point...how the hell did you enter the á etc at a standard keyboard?

Marty
-----Original Message-----
From: Paul Mason [mailto:Paul.Mason (AT) actian (DOT) com]
Sent: 14 October 2011 11:55
To: Ingres and related product discussion forum
Subject: Re: [Info-Ingres] Select, escaping special chars

One thing you can do - which may not be appropriate depending on your needs - is create a custom collation sequence. The collation sequence determines what "weight" individual characters have and therefore the order in which they sort. It's possible to define similar characters to have the same weight.

You do this by creating a text file that describes the collation sequence (.dsc) and compiling it with aducompile. You then set the collation sequence when you create the database using the -l flag

E.g.

Quote:
cd $II_SYSTEM/ingres/files/collation
cat pm_col.dsc
a:á
a:â
a:ã
a:ä
Quote:
aducompile pm_col.dsc pm_col
createdb collatedb -lpm_col
Creating database 'collatedb' . . .

Creating DBMS System Catalogs . . .
Modifying DBMS System Catalogs . . .
Creating Standard Catalog Interface . . .
Creating Front-end System Catalogs . . .

Creation of database 'collatedb' completed successfully.

Quote:
sql collatedb < test.sql | cat
INGRES TERMINAL MONITOR Copyright 2011 Actian Corporation
Ingres Linux Version II 10.1.0 (int.lnx/00)NPTL login
Fri Oct 14 10:42:03 2011
continue
* * * /* SQL Startup File */
CREATE TABLE test (col1 INTEGER NOT NULL,
col2 VARCHAR(20) NOT NULL)
Executing . . .

continue
* * * * * * * * INSERT INTO test VALUES (1, 'Cháteau');
INSERT INTO test VALUES (2, 'Château');
INSERT INTO test VALUES (3, 'Chãteau');
INSERT INTO test VALUES (4, 'Chäteau');
INSERT INTO test VALUES (5, 'Chateau');
INSERT INTO test VALUES (6, 'xyz');
INSERT INTO test VALUES (7, 'abc');
Executing . . .

(1 row)
(1 row)
(1 row)
(1 row)
(1 row)
(1 row)
(1 row)
continue
* * * SELECT * FROM test
WHERE col2 = 'Chateau'
Executing . . .


+-------------+--------------------+
Quote:
col1 |col2 |
+-------------+--------------------+
1|Cháteau |
2|Château |
3|Chãteau |
4|Chäteau |
5|Chateau |
+-------------+--------------------+
(5 rows)
continue
* * * SELECT * FROM test
WHERE col2 LIKE '%a%'
Executing . . .


+-------------+--------------------+
Quote:
col1 |col2 |
+-------------+--------------------+
1|Cháteau |
2|Château |
3|Chãteau |
4|Chäteau |
5|Chateau |
7|abc |
+-------------+--------------------+
(6 rows)
continue
* * * SELECT * FROM test
ORDER BY col2
Executing . . .


+-------------+--------------------+
Quote:
col1 |col2 |
+-------------+--------------------+
5|Chateau |
4|Chäteau |
1|Cháteau |
3|Chãteau |
2|Château |
7|abc |
6|xyz |
+-------------+--------------------+
(7 rows)
continue
* * SELECT DISTINCT col2 FROM test
Executing . . .


+--------------------+
Quote:
col2 |
+--------------------+
Cháteau |
abc |
xyz |
+--------------------+
(3 rows)
continue
*
Your SQL statement(s) have been committed.

Ingres Version II 10.1.0 (int.lnx/00)NPTL logout
Fri Oct 14 10:42:03 2011

The downsides are that

a) as you can see above you lose the ability to distinguish between those values (see the SELECT DISTINCT query)

b) since it needs setting when the database is created, an existing database would need to be unloaded and then reloaded.

As I say these downsides may outweigh the benefit.

HTH
Paul

Quote:
-----Original Message-----
From: info-ingres-bounces (AT) kettleriver...ting (DOT) com [mailto:info-
ingres-bounces (AT) kettleriverconsulting (DOT) com] On Behalf Of Ingres Forums
Sent: 12 October 2011 08:03
To: info-ingres (AT) kettleriverconsulting (DOT) com
Subject: [Info-Ingres] Select, escaping special chars


Hello everyone
I have to use an Ingres Database to store my data which is in several
languages (like french, german, and so on). In my web site, the user
can
use the function "search".
The problem are the special characters like éÃ*èâ in french, or
öäü in german. The user doesn't enter these characters, but it
should
be found anyway.

For example:
In the database is the word "château".
The user types "chateau" (whithout â)
The program should find the "château", even if "chateau" was typed.

So all accents in the database should be replaced by something more
useful (like "_")

Has someone an idea how to do that?

Ingres database version : 9.2.1

Thanks a lot,
Kakmael


--
Kakmael
-----------------------------------------------------------------------
-
Kakmael's Profile:
http://community.actian.com/forum/me...?userid=111714
View this thread:
http://community.actian.com/forum/sh...ad.php?t=13988


_______________________________________________
Info-Ingres mailing list
Info-Ingres (AT) kettleriverconsulting (DOT) com
http://ext-cando.kettleriverconsulti...fo/info-ingres


_______________________________________________
Info-Ingres mailing list
Info-Ingres (AT) kettleriverconsulting (DOT) com
http://ext-cando.kettleriverconsulti...fo/info-ingres


_______________________________________________
Info-Ingres mailing list
Info-Ingres (AT) kettleriverconsulting (DOT) com
http://ext-cando.kettleriverconsulti...fo/info-ingres

Reply With Quote
  #22  
Old   
Chris
 
Posts: n/a

Default Re: Select, escaping special chars - 10-20-2011 , 04:23 PM






On Oct 18, 3:53*pm, seldomisnice... (AT) gmail (DOT) com wrote:
Quote:
Convert records to ascii using iconv.
Convert search criteria to ascii using iconv.
Then search.
Then map the results back to original and display.
Do you have an example of how to do this? I'm wasn't aware iconv could
do that.

Here is a demo that shows some problems, I'd be interested in any
extra options iconv has that could help:

$ python -c 'mystr = u"Bj\N{LATIN SMALL LETTER O WITH DIAERESIS}
rk";print mystr.encode("utf8")' | iconv --from-code utf8 --to-code us-
ascii
Bjiconv: illegal input sequence at position 2

$ python -c 'mystr = u"Bj\N{LATIN SMALL LETTER O WITH DIAERESIS}
rk";print mystr.encode("utf8")' | iconv --from-code utf8 --to-code us-
ascii -c
Bjrk
$

The later one appear to work but note that it is missing a character!


Chris

Reply With Quote
  #23  
Old   
Andy
 
Posts: n/a

Default [Info-Ingres] PHP and Ingres - 10-20-2011 , 06:15 PM



Hi All,

I have been asked to look into PHP and Ingres for some (small and possibly
large) web solutions required by a client...

I have seen, from time to time, mention of PHP in this forum and was
wondering what people prefer in PHP (free/open source) frameworks?

I am sorry that this is not a direct ingres question but you guys are more
informative than some of the other forums out there.

I have had a little look at things like CodeIgniter, CakePHP, Symfony, etc.
There is any awful lot of information on the web but I am having troubles
making a decision - still not sure what questions to ask.

Any help would be greatly appreciated.

Regards,
Andy.

Reply With Quote
  #24  
Old   
seldomisnice248@gmail.com
 
Posts: n/a

Default Re: Select, escaping special chars - 10-27-2011 , 06:03 PM



yes! It's just
iconv -f iso-88591 -t ascii//translit

I don't have the exact syntax because I'm not on the unix machine right now but something like that.
I guess the translit does the approximation to the ascii character.
Cheers

Reply With Quote
  #25  
Old   
Chris
 
Posts: n/a

Default Re: Select, escaping special chars - 10-28-2011 , 12:34 PM



On Oct 20, 2:23*pm, Chris <Chris.Clark (AT) actian (DOT) com> wrote:
Quote:
On Oct 18, 3:53*pm, seldomisnice... (AT) gmail (DOT) com wrote:

Convert records to ascii using iconv.
Convert search criteria to ascii using iconv.
Then search.
Then map the results back to original and display.

Do you have an example of how to do this? I'm wasn't aware iconv could
do that.

Here is a demo that shows some problems, I'd be interested in any
extra options iconv has that could help:

$ python -c 'mystr = u"Bj\N{LATIN SMALL LETTER O WITH DIAERESIS}
rk";print mystr.encode("utf8")' | iconv --from-code utf8 --to-code us-
ascii
Bjiconv: illegal input sequence at position 2

$ python -c 'mystr = u"Bj\N{LATIN SMALL LETTER O WITH DIAERESIS}
rk";print mystr.encode("utf8")' | iconv --from-code utf8 --to-code us-
ascii -c
Bjrk
$

The later one appear to work but note that it is missing a character!

To follow up, seldomisnice posted the option "//translit" (note the
double slash) to the encoding name, there is a corresponding //IGNORE
(which is the charset name equivalent of using the -c flag).

Demo:

$ python -c 'mystr = u"Bj\N{LATIN SMALL LETTER O WITH DIAERESIS}
rk";print mystr.encode("utf8")' | iconv --from-code utf8 --to-code us-
ascii//translit
Bjork

Reply With Quote
  #26  
Old   
Ingres Forums
 
Posts: n/a

Default Re: Select, escaping special chars - 10-29-2011 , 02:01 AM



I assu 'sf escorts' (http://www.sfasianescorts.com) I accidentally cut
it on with the drives out

'sf asian escorts' (http://www.sfasianescorts.com) Now drives 1-3

and the power button are on constantly and drive 4 is flashing. And I

can't locate it in raidar etc. If so any idea of how long ti would take


all four 'sf escort' (http://www.sfasianescorts.com) I'm waiting to

'sf asian escort' (http://www.sfasianescorts.com) migrate my data to
my Ultra


--
xliang

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.