Re: [Zope-DB] ZPTs and database accesses

2005-05-19 Thread Jaroslav Lukesh
Dne čtvrtek, 28. dubna 2005 20:17 Andreas Jung <[EMAIL PROTECTED]> 
napsal(a):
> You have not read the book correctly. First statement just said that you
> can't SQL queries using ZPT. In Zope you specify SQL queries using
> *ZSQL methods* that use DTML as markup language...this is not the same
> as defining SQL inside DTML methods/documents or Page Templates.

with discuss about security it is possible to query sql directly from dtml/zpt 
with yourZSQLmethod like this:


sqlquery:string



and corresponding dtml method:



...


-- 

    Jaroslav Lukesh
  ---
  This e-mail can not contain any viruses because I use Linux

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Connect to ms sql server from zope 2.8 on windows server

2005-07-19 Thread Jaroslav Lukesh
Dne úterý, 21. června 2005 5:14 ЦЗЛ УЭХК <[EMAIL PROTECTED]> napsal(a):
> I use zope 2.8 on windows server and ms sql server.
> What kind of database adapter could connect zope to ms sql server?
>
> P.S. (How i can conect to ms sql server from zope)

It is few ways to go.

One is ODBC (and here are few ways to go too).
Second is TDS (FreeTDS)

Both I has some problems with parallel access and with big tables.

Third and the best one is the native access to MSSQL.

http://mail.zope.org/pipermail/zope/2004-May/149810.html

Note, that I was sometime mentioned 4k text limit which I could not get rid 
off - it is limit of MSSQL server via TCP interface, which could be overriden 
with sql command (right in ZSQL method)

set textsize 65535

select datetype_text from table...

I use it on production server with sybase ASE 11.9.2 (ASE is not running as 
service, only libraries and config file(s?) are needed).

One caveat is only, that I could not get list of tables from database. But it 
could be some kind of limits in MSSQL - Iam not msssql admin.

-- 

        Jaroslav Lukesh
  ---
  This e-mail can not contain any viruses because I use Linux
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Connect to ms sql server from zope 2.8 on windows server

2005-07-20 Thread Jaroslav Lukesh
Dne středa, 20. července 2005 16:50 "M.-A. Lemburg" <[EMAIL PROTECTED]> 
napsal(a):
> Jaroslav Lukesh wrote:
> > Third and the best one is the native access to MSSQL.
> >
> > http://mail.zope.org/pipermail/zope/2004-May/149810.html
>
> ... for some definition of "best" (see the comments on the MSSQL
> page: http://www.object-craft.com.au/projects/mssql/) ;-)

Sorry, I use zope on Linux, so I forgot if it have some problems with windows 
client side.

> Getting the Sybase ct-lib to work on Linux is a nightmare and is
> not well-supported, which is why the FreeTDS project was started.

??? I was have hightmare with FreeTDS... I was download and setup sybase (with 
some Xwindow program), add lines into interfaces file like that public mssql 
server I was use for testing:

dbpublic
master tcp ether sql.aspweb.cz 1433
query tcp ether sql.aspweb.cz 1433

> However, the original question was "how to connect to MS SQL Server
> from Windows": on Windows, ODBC is the easiest to setup and
> administer and it is well-supported by all database vendors, with
> regular updates, etc.

Sure, but I was get some bad things with parallel access into ODBC, so I was 
get out from them. ODBC is great, but for development purposes or signle 
user, not as general database connector (at windows).

> > Note, that I was sometime mentioned 4k text limit which I could not get
> > rid off - it is limit of MSSQL server via TCP interface, which could be
> > overriden with sql command (right in ZSQL method)
> >
> > set textsize 65535
> > 
> > select datetype_text from table...
>
> If you do things like this (ie. use SET VARIABLE value), you should
> be aware that the setting will in many cases apply to the connection,
> not only the cursor you're using to run the query.
>
> As a result, other completely unrelated queries on the same
> connection will use the same settings. Things get even more
> complicated if you use connection pooling - the results
> are intermittent errors that are extremely hard to track
> down.

textsize is not as so strange variable...

> In short: Don't do this :-)

it is reccomended by Microshift ;-) because TCP connections have these limits 
at MSSQL server side by default due, uahaha, mickeysoft security meanings.

-- 

Jaroslav Lukesh
  ---
  This e-mail can not contain any viruses because I use Linux
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] free database adapters ,...

2006-10-01 Thread Jaroslav Lukesh


- Original Message - 
From: "Chris Withers" <[EMAIL PROTECTED]>

Are there
any database adapters and drivers that are free for connecting Zope with
MS*SQL server and MSDE?


Don't be a numpty, mxODBC is the best there is...

Pay for it, it's really very cheap for what it is!



Totally free and the best solution I was find for MS*SQL is to use Sybase 
(for linux is free) and zope ms*sql database adaptor product from 
object-craft.com. I was not try mxODBC, because mx does not send me trial 
licence.


There are more ways, using rudiments, TDS, socket servrer... But sybase and 
object-craft works well for 2 years in multiuser heavy read-write web 
application.


Regards, JL. 


___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] free database adapters ,...

2006-10-02 Thread Jaroslav Lukesh


- Original Message - 
From: "Chris Withers" <[EMAIL PROTECTED]>




Jaroslav Lukesh wrote:


object-craft.com. I was not try mxODBC, because mx does not send me 
trial licence.


That doesn't sound like eGenix... what reason did they give?




evaluating, testing - as I remember, it was 2 years ago or more

JL.
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] free database adapters ,...

2006-10-02 Thread Jaroslav Lukesh
- Original Message - 
From: "Charlie Clark" <[EMAIL PROTECTED]>

Am 02.10.2006, 16:52 Uhr, schrieb Jaroslav Lukesh <[EMAIL PROTECTED]>:

 - Original Message - From: "Chris Withers" 
<[EMAIL PROTECTED]>

  Jaroslav Lukesh wrote:
 object-craft.com. I was not try mxODBC, because mx does not send me 
trial licence.

 That doesn't sound like eGenix... what reason did they give?
   evaluating, testing - as I remember, it was 2 years ago or more


We did send Jaroslav an evaluation licence! It was on 2004-05-07.

We're happy that he's got alternative solution for his environment but 
feel obliged to correct the statement that we never sent him a licence.




I am very sorry, but I lost it. Many thanks for your response, now I have 
friendly mind with mx :-)


SIncerelly, JL.

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Sybase Adapter error :: alternatives?

2006-12-27 Thread Jaroslav Lukesh
Use MS*SQL database adapter from object-craft, which use syb*ase as DB 
connector.


googling tip - remove * from string below
mss*ql syb*ase zope luk*esh

It working fine for Zope 2.5.1, for Zope 2.9.4 and plain python (2.1.3 ... 
2.4) too.


Regards, JL.

- Original Message - 
From: "Pablo Avalos" <[EMAIL PROTECTED]>

Sadly I'm stuck here at work with some Sybase DB, and I need to get some
info to the intranet plone-site..

I've found the SybDAv2 but it's dead old and doesn't work..

a) Has anyone made it work (recently)
b) any alternatives to get connect to a Sybase DB?


___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Re: Sybase Adapter error :: alternatives?

2006-12-27 Thread Jaroslav Lukesh

object-craft have mssql adapter too. And for that adapter exist Zope DA...

- Original Message - 
From: "Pablo Avalos" <[EMAIL PROTECTED]>




actually I have the object-craft's sybase-python-module (...working)

but how do you do to use it as a Zope DB Adapter?? O.o?

?
Jaroslav Lukesh escribió:

Use MS*SQL database adapter from object-craft, which use syb*ase as DB
connector.


___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Re: Sybase Adapter error :: alternatives?

2006-12-27 Thread Jaroslav Lukesh

Did you use google for string that I was specified?

- Original Message - 
From: "Pablo Avalos" <[EMAIL PROTECTED]>




Hmm the only Adapter for MS*SQL I see here
(http://www.plope.com/Books/2_7Edition/RelationalDatabases.stx)
is for windows only... I should have specified the zope server is
running Gentoo Linux =/


___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Using s in ZSQL methods?

2007-06-15 Thread Jaroslav Lukesh

It is just because 'delete_this' is a string, not the list, or vice versa?

- Original Message - 
From: "Ken Winter" <[EMAIL PROTECTED]>

To: "'Zope-DB List'" 
Sent: Saturday, June 16, 2007 5:15 AM
Subject: [Zope-DB] Using s in ZSQL methods?


Here's the definition of a ZSQL method, "people_delete_by_id.zsql":

"

 title: Method to delete People by ids given in a comma-separated list
 connection_id: my_database
 arguments:
id_list


delete from person
where person_id in ()
"


Here's the puzzle:

When I define and test this ZSQL method through the ZMI, passing it a string
such as "9765, 10058, 11333", it indeed deletes the rows with those values
on person_id.

BUT when I invoke the same ZSQL method from a Python script with the
following code:

"
p = context.REQUEST.get('delete_this')
if p:
   s = ', '.join([str(x) for x in p])
   context.people_delete_by_id(id_list=s)
"

...and with a REQUEST variable 'delete_this' that comes from this snippet of
a form in a page template:

"







   
   
...


...

"

...and with the same three person_ids (9765, 10058, 11333) the 4th line of
the Python script evokes an error:

"
KeyError: 'id_list'
"

The core idea is that the string id_list is passed into the ZSQL method,
where it is spliced into the "delete...where" clause via the ) to provide the list of person_ids to delete.


Here's the question:

WHY?

~ TIA
~ Ken

P.S.  I know that  rather than  is an
unorthodox and apparently undocumented construct to use within a ZSQL
definition.  But I need it because  malformats the string.
And if doing this trick is a no-no, how come it works in the ZMI test but
not when called from Python?  More importantly, how can I get it to work
from Python?

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db 


___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Problem with feature

2008-02-14 Thread Jaroslav Lukesh

Try to set url_name as ['HI','RF'] and use property without datatype, like


url_name
...


And of course, look at ZopeBook.

Personally I dont use sqltest nor sqlgroup because there are many caveats 
with queries to cooperate with other zope unfriendly SQL developers. I use 
dtml-in inside ZSQL method with parameters defined as above.


- Original Message - 
From: "Ken Winter" <[EMAIL PROTECTED]>


select
   organization_id, name, url_name, short_name
from
   organization






doesn't work properly when I give it "a sequence of values to test the
condition against", which is what the "multiple" tag is supposed to allow
according to http://www.plope.com/Books/2_7Edition/AppendixA.stx#1-15 .
When I enter (for example) the string "HI, RF" (without the surrounding
quotes) into the url_name field on the ZSQL method's ZMI Test tab, it
returns no records and says that the SQL it generated was:

select
   organization_id, name, url_name, short_name
from
   organization
where
url_name = 'HI, RF'

If I enter a series of integers such as "11530, 11531" (again, minus the "s)
into the organization_id field, it returns the error message:

Invalid integer value for organization_id

Entering a single value into any of these fields works fine.  I have tried
various ways of quoting, delimiting, and otherwise punctuating my
multiple-value arguments, to no avail.

Is this problem just because the "multiple" feature doesn't work when tested
in the ZMI?  If so, can you tell me the correct way to type and format the
multiple-valued arguments when calling the ZSQL method from Python or from a
Page Template?

b 


___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


[Zope-DB] Re: [Zope] Bug in ZSQL test?

2008-07-10 Thread Jaroslav Lukesh

Hi all,

many years I use patched files - here are (see attachment) from my Zope 251 
at

ZOPEROOT/lib/python/Shared/DC/ZRDB/dtml

But it is not able to handle to lng queries, for long queries it 
needs one more little mod with FORM tag. So see the little nuances with your 
newer zope sources ;-)


Regards, JL.

- Original Message - 
From: "Garry Saddington" <[EMAIL PROTECTED]>




On Thursday 10 July 2008 20:47, Allen Schmidt Sr. wrote:

I know, I know...too old to worry about...
Zope 2.8.9.1 on RedHat and MySQL5

In the Test tab of a ZSQL method, where the query has parameters, when
we enter parameters that generate a result of more than 20 rows, we get
the link for next 20 results. However, the parameters are not getting
passed in and the next page shows all the rows as if no parameters 
passed.


Anyone else seen this?

Yes Zope 2.9 gives error for the missing parameters on second page. I have
just lived with it having seen the error before on this list.


connectionTestForm.dtml
Description: Binary data


customDefaultReport.dtml
Description: Binary data
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] ZSQL Question - Insert multiple rows in one statement?

2010-08-24 Thread Jaroslav Lukesh

- Puvodní zpráva - 
Od: "Andreas Jung" 


> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I would assume that you can use DTML-IN for looping and generating
> multiple SQL statements of the same kind. You have to ensure that
> the statements having a proper delimiter (there was something in DTML?!
> DTML-SQLDELIMITER?...no idea, you need to checks the docs of this
> ancient technology).

DTML is mature, not ancient. For ZSQL is DTML the best one. For HTML, css, 
javascripts too. Only for large XML trees the ZPT should be better.

Did you try to make many small dynamic javascript in one page with ZPT? 
Yeah, python scripts calling, instead of placing small dtml code into 
javascript in page...

ZPT is more academic platform, than for everyday usage.

> Mark Phillips wrote:
>> When I retrieve multiple values from a selection box, I need to create a
>> loop somewhere to insert the multiple values (rows) into a table. Is
>> there a way to do this within a ZSQL statement, or is it best to do the
>> looping in a Python script?

use this:

query1

query2

query3

___
Zope-DB mailing list
Zope-DB@zope.org
https://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] ZSQL Question - Insert multiple rows in one statement?

2010-08-24 Thread Jaroslav Lukesh
- Puvodní zpráva - 
Od: "Shane Hathaway" 


> On 08/24/2010 04:04 PM, Jaroslav Lukesh wrote:
>> ZPT is more academic platform, than for everyday usage.
>
> Wow, I have never heard that opinion before.  I have had quite the
> opposite experience: I find ZPT more productive and less error-prone
> than all other web templating languages.  I have a project that pulls in
> several templating languages, due to dependencies, and ZPT is easily the
> best and most practical of them all.
>
> I should clarify that I use Chameleon and BFG, so expressions in
> templates are in Python, and BFG's view machinery lets me put all
> non-trivial template code in normal Python modules.
>
> I suppose I would agree with the statement "Zope 2 page templates are
> academic", since the full practical value of ZPT was not realized until
> it was reimplemented a few times.  (See Kid, Genshi, Chameleon, and
> possibly others.)
>
> Anyway, sorry for posting this to the wrong list.
>
> Shane

Thanks for clarify, you are true, I use Zope 2 only. If Zope3 ZPT is so 
good, then it is good news.

Regards, JL. 

___
Zope-DB mailing list
Zope-DB@zope.org
https://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] How to extract users info from ZODB?

2012-01-25 Thread Jaroslav Lukesh
Look at management page dtml source of your Zope server (on the disk,not in 
ZoDB).


- Puvodní zpráva - 
Od: "smita kamdar" 




Hi,

Thanks a lot for your response.

My exact query is when i open ZMI, there is 1 folder named
'acl_users'. When i open that folder , there is a list of users
defined there. I want to extract the details of those users in the
list. How do I extract those details? Here I am not sure that those
user details exist in ZODB or some other location.



___
Zope-DB mailing list
Zope-DB@zope.org
https://mail.zope.org/mailman/listinfo/zope-db


[Zope-DB] manipulate ZSQL results in Zope code

2013-09-30 Thread Jaroslav Lukesh

Hi all,

I have switched from years old database adapter to SQLRelay, yep, it is 
rugged stable on unstable connections, but this adapter get all number 
values as strings (older version where numbers are numbers does not work 
with cp1250 - problem solved in 0.51 this year). I need numbers as numbers, 
of course, because application have thousands of queries.


I was try to change source in SQLrelay, but no success probably due 
academy-like code.


So as I know that Zope have readable code... I was make changes in 
/lib/python/Shared/DC/ZRDB in files RDB, Results, Aqueduct (*.py)


Again, all my changes are unsuccessfull seems like I was change some 
differ place, but no, if I make syntax error, zope wont start and changes in 
column names was OK too.


Would you like to help me, where is the right place to manipulate result 
values from ZSQL methods, please?


Many thanks,

J. Lukesh 


___
Zope-DB mailing list
Zope-DB@zope.org
https://mail.zope.org/mailman/listinfo/zope-db