Re: [Zope-DB] [Zope-db]Zope_Database_Issue

2010-11-24 Thread Charlie Clark
Am 24.11.2010, 12:27 Uhr, schrieb smita kamdar smita.kamda...@gmail.com:

 On my LINUX Red Hat machine, I had installed postgresql, zope, psycopg,
 egenix many times  then uninstalled it  that too at different  
 locations.
 Due to multiple installations  uninstallations, the complete setup of  
 the
 LINUX box has changed. Many things that were working earlier are not  
 working
 now. What do you suggest? Should I format the LINUX box  again start  
 afresh
 with new installations? Or u suggest something else?

Dear Smita,

if you have complete control of the box then it probably makes sense to  
reinstall completely. If so, then you should be able to use more recent  
packages of Postgres and psycopg2. I don't know much about RHEL, I think  
Debian and SuSE are more common in Europe, but Michele pointed out which  
packages you might use and you should have someone at Mahindra Tech who  
can help you as this mailing list isn't the right place for further  
discussion of such basics.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
 Python/Zope Consulting and Support ...http://www.egenix.com/
 mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


::: Try our new mxODBC.Connect Python Database Interface for free ! 


eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
 http://www.egenix.com/company/contact/
___
Zope-DB mailing list
Zope-DB@zope.org
https://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Zope_Database_issue

2010-11-19 Thread Charlie Clark
Am 19.11.10 12:32, schrieb smita kamdar:
 Do you think I have done right? Or is this some other error?
 

Dear Smita,

there was no need to set root as owner of the Postgres libraries. You just
need to have permissions that are readable by the Zope user which is what
Michele described. Once this is the case then Zope should start or at least
give a different error.

Please note that the errors you are experiencing are not related to Zope,
Python or Postgres but unix and you should see if you can get some help from a
sys admin in your company.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

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


Re: [Zope-DB] Zope_Database_issue

2010-11-18 Thread Charlie Clark
Am 18.11.10 10:13, schrieb smita kamdar:
 But I can see the library �libpq.so.3� in the Postgres lib directory  also
 while installing Psycopg I gave the same path of Postgres library.
 
 Now what else I need to do?

Hi Smita,

the problem is not with Zope but with the underlying psycopg library that
you've installed. It cannot find the Postgres libraries and so cannot connect
to the server. Once you've fixed this you ZPsycopgDA should work fine. Andreas
has pointed out what you need to do.

BTW. I think that you may well be better off with psycopg2 as the library.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

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


Re: [Zope-DB] Fwd: Zope_Database_issue

2010-11-17 Thread Charlie Clark
Am 17.11.10 12:07, schrieb smita kamdar:
 Hi,
 
 Thanks a lot for your suggestion!!
 
 But I am specifically told to use ZPsycopgDA to connect zope  postgres. I
 am trying a lot to add a new ZPsycopg database connection from Zope
 Management Interface screen, But that option does not exist in Add drop -box
 of Zope Management Interface screen. Should Zope software home  zope
 Instance home be same?? If no then where should I install ZPsycopgDA??
 
 Also do I need to install anything else other than ZPsycopgDA to connect
 zope  postgres?
 
 I am using Zope 2.11.4, python 2.4.4, Postgres 7.4.13, egenix 2.0.6 
 Psycopg 1.1.6
 
 I am really in a mess! Really need your help!

Hi Smita,

if you can start Zope from the shell:

bin/zopetcl fg

You should get a Python traceback that says what is stopping the ZPsycopgDA
starting.

Charlie Clark
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

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


Re: [Zope-DB] My ORM is better than yours!

2010-08-25 Thread Charlie Clark
Hi,

I think the discussion is always useful but prefer it to be less polemic.

Am 25.08.10 12:43, schrieb Andreas Jung:

 SQL can become *very complicated* - ever tried to understand complex
 SQL queries of other people? Working with a proper database model
 on the Python level is much easier.

When mapping classes to relations, sure. OTOH. I have no problem
understanding properly modelled relational schema. As Chris Date points
out a relation is an object.

I'm not a big fan of SQL per se - I think it manages to make a travesty
of the declarative approach and makes some things which should be easy
tricky. Things are improving with things like windowing functions.

 Yes, you are moving complexity from
 SQL to Python and ORM configuration can be confusing as well. However
 a descriptive model of a database in Python with its relations is much
 easier to handle than dealing with it on the SQL layer directly.

Depending on how the mapping (it's actually the generation of SQL on
the fly) happens this can lead to extremely weird modelling. The SA
modelling of subclasses is weird, incorrect in my view. At Europython
Hannu Krosing showed some stats of direct access over the active record
approach. From what I recall of Trac and Django the iterating over large
sets can indeed present a bottleneck which only a good SQL query can remove.

  ORM encourages lazy programming = problems later
  down the line.

 Nonsense - using SQLAlchemy for more than four years now in four or five
 larger projects and it is a major win regarding productivity, software
 architecture, implementation and testing.

I think SA has the advantage over some approaches in that it lets you do
all the schema in the database, gives you some control over whether
queries should be lazy or not, etc. and letting you write handcrafted
SQL when necessary (it's a great convenience not to have to write them
for getters and setters).

Nevertheless, any programmer working with a relational database should
have a good understanding of the relational model and the core SQL
constructs.

Furthermore, in my view any good Python programmer should be prepared to
look at other approaches; indeed, I think this is a core advantage of
Python. The Muldis-D project (which is based on the Tutorial D pseudo
language) and Hannu's proposed DORA both offer significant advantages
over SQL and, therefore, SQL generation.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

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


Re: [Zope-DB] Run Wxpython Script in Zope

2009-03-31 Thread Charlie Clark
Am 31.03.2009, 11:27 Uhr, schrieb Chris Withers ch...@simplistix.co.uk:

 get python running in the browser, which sadly is never going to happen)

There is always Grail http://grail.sourceforge.net/

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
 Python/Zope Consulting and Support ...http://www.egenix.com/
 mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


::: Try our new mxODBC.Connect Python Database Interface for free ! 


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/


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


Re: [Zope-DB] [Zope] Stored Procedures Versus ZSQL Methods

2009-02-18 Thread Charlie Clark
Am 18.02.2009, 00:58 Uhr, schrieb jpe...@ykksnap-america.com:

 Using external methods will be more work for the zope writer.
 I don't know enough to comment seriously on security issues,
 but I think that using procedures, like using bind variables, will
 make  SQL Injection much harder.

The mxODBC Zope DA makes the execute() method available to connection object 
instances which allows for parameter binding and the next release will make 
this available for PythonScripts. Rather than use ExternalMethods, however, I'd 
suggest that you use Views instead which make tying everything together a lot 
easier.

Regarding performance: the comparisons we did a few years ago suggested that 
parameter binding is around 40% faster for non-cached access from Zope as Zope 
does quite a lot of work to turn ZSQL methods into usable queries. If the 
caching works for you then you will have pretty good performance because Zope 
will only actually run the query for something that isn't in the cache. Stored 
procedures can offer a performance improvement if you plan to manipulate the 
data in any way, ie. if you want to get data out of several views and do 
something with it before you pass it to the browser. But most importantly - in 
the Zope world the RDBMS is unlikely ever to be your bottleneck.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
 Python/Zope Consulting and Support ...http://www.egenix.com/
 mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


::: Try our new mxODBC.Connect Python Database Interface for free ! 


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/


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


Re: [Zope-DB] [Zope] Stored Procedures Versus ZSQL Methods

2009-02-18 Thread Charlie Clark
Am 18.02.2009, 20:24 Uhr, schrieb Allen Schmidt Sr. 
aschm...@fredericksburg.com:

 Hey Charlie,

 What timing. I am having my server guys drop the trial egenix zope da in  
 place as I write this. Seeing too many errors and oddities with the  
 ancient MySQLDA we use now. Planning on converting all our mysql  
 connections to the mxodbc connectors, but utilize the exact same name so  
 we don't have to change every ZSQL method. Is this a sound practice? Or  
 do you have any other solutions.

If MySQL is to stay as your RDBMS then this work perfectly. It's one of the 
nice things about Zope that you tend to overlook: some replacement components 
really can just be dropped in - the ZSQL methods just know the id of the 
connection. To be honest the 3.0 version of the ZMySQLDA isn't bad and some of 
the errors may be related to other things - I've recently had a project with 
key errors on cached ZSQL results which are independent of the DA. But I'm 
pretty confident that the mxODBC Zope DA is the best around but being able to 
access more of the underlying driver can be a real life-saver. One thing I 
would recommend is moving all you ZSQL to the file system if you haven't 
already done this.

  Thanks and sorry for bothering you directly. Please let me know if not  
 appropriate.

While I don't mind the e-mail at all. It's always good to keep discussions like 
this on list so to that others can join in or benefit.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
 Python/Zope Consulting and Support ...http://www.egenix.com/
 mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


::: Try our new mxODBC.Connect Python Database Interface for free ! 


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/


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


Re: [Zope-DB] [Zope] Stored Procedures Versus ZSQL Methods

2009-02-18 Thread Charlie Clark
Am 18.02.2009, 21:36 Uhr, schrieb Allen Schmidt Sr. 
aschm...@fredericksburg.com:

 I understand. Thanks.

 Did not realize there was a new version of the python/zmysqlda  
 available. Thanks for that info. Would really like to use the mx  
 connectors but at this point if I can use an updated free one and it  
 works, then I need to do that.

Ours works better! ;-) Which specific errors have you been experiencing?

 And no, all our stuff is in the ZODB as ZSQL methods. Always has been.  
 We do some stuff in straight python on the filesystem and some external  
 methods but the vast majority is still done the same old way. Currently  
 running on 2.8.9.1

I think DirectoryView, FSObject and FSZSQLMethod are available separately, 
otherwise just get the latest version of CMFCore that will run on your version 
of Zope. It takes about five minutes to move a ZODB ZSQL-Method to the file 
system and it's worth it, especially if you can remove your dependency on 
ExternalMethods as well.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
 Python/Zope Consulting and Support ...http://www.egenix.com/
 mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


::: Try our new mxODBC.Connect Python Database Interface for free ! 


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/


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


Re: [Zope-DB] Help me.

2008-03-11 Thread Charlie Clark

Am 11.03.2008, 16:13 Uhr, schrieb Cu Vinh Loc [EMAIL PROTECTED]:


  Dear friends,
 I am using plone for deploying the website, but I have some problems
such as:
   - Using relational (internal) database Gadfly database: I do not  
know

where the database is stored in the Zope. Can I manipulate directly
this database visual?
   - Users and groups: How to assign this permissions to my website.
 Could you show me how to implement that easily.


Dear Cu Vin Loc,

you have simply reposted your e-mail to the Archetypes list this morning  
apparently without looking at the documentation I suggested.


While you are reading up on the basics of using Zope and relational  
databases it might be an idea to let us know exactly what you want to do.  
As a kick-start on using Zope you might also wish to look at my  
presentation at EuroPython last year. It covers the very basics of using  
ZSQL in Zope and there is a download with code for your to play with.


http://www.egenix.com/library/presentations/EuroPython2007-Zope-and-RDBMS/

Good luck!

Charlie
--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] ZMYSQLDA problem: Zope restarts after trying to open Z Mysql connection

2007-12-04 Thread Charlie Clark

Am 04.12.2007, 10:28 Uhr, schrieb Irina [EMAIL PROTECTED]:


event.log and error.log tell nothing.
I have no access to shell.
I will be gratefull for any advice. Why Zope is restarting ? What can be
done ? My practical experience with Zope is not great.


My guess is that the Python process is crashing for some reason. You need  
to enable debugging in zope.conf to get something in your event log but  
without shell access it might be difficult to trace the problem.


Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Automatic capture of user ids for auditing

2007-11-07 Thread Charlie Clark

Am 07.11.2007, 21:11 Uhr, schrieb Ken Winter [EMAIL PROTECTED]:


Charlie, thanks for the encouraging response!


Encouraging? Not sure if that's quite the right word! ;-)

Just assuming you did have connections per user, how would you go about  
this?



What you suggest (below) is definitely the way I'd like to do this.
However, ZPsycopgDA and its communications with PostgreSQL are currently
black boxes for me, so I think I need some help taking the next steps.
A few hours of poking around have led me to the following fragmentary  
ideas.



* I have found what may be a likely candidate for the code that could be
customized: the method DB.query(self, query_string, max_rows=None,
query_data=None) defined (on my Windows system) in C:\Program Files\Plone
2\Data\Products\ZPsycopgDA\db.py.


Yep, that's the place.

* One idea is to parse the query_string in DB.query and, if it contains  
an

INSERT or UPDATE command, splice a clause to record the current user's id
into it (e.g. put last_updated_by = request.AUTHENTICATED_USER into the
SET clause of an UPDATE).  Doing it this way should require nothing  
special
on the PostgreSQL side, since the user identifier would come through as  
part

of the INSERT or UPDATE statement.


This is going to be your quickest way assuming you can write a good enough  
parser so you don't catch statements with INSERT or UPDATE as part of  
the parameters! Using the underlying .execute(SQLStatement, (paras,))  
method on the cursor might be preferable and would be available from our  
mxODBC Zope DA but this is unfortunately not compatible with ZSQL methods  
which predate the Python DB-API. You might, however, be able to use a  
stored procedure on the database to execute the query as rendered by the  
ZSQL method with the user passed as a parameter to the stored procedure.  
Again the mxODBC Zope DA would give you access to the .callproc(). No idea  
whether you could write such a stored procedure but I don't see why not.


* The idea of extending the DA pass the current ZOPE user seems  
cleaner.
However, I don't know how to get the DA to pass an additional parameter,  
and
I don't know how to get PostgreSQL to pick up the parameter so it can  
store

it as required.  In other words, I don't understand this API, and I don't
know where it is documented.


Zope doesn't support it and unfortunately relational databases aren't  
getting the attention they deserve in the Zope world at the moment.


Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] ImportError: libmysqlclient_r.so.15

2007-11-07 Thread Charlie Clark
Am 07.11.2007, 21:31 Uhr, schrieb Michele Marcionelli  
[EMAIL PROTECTED]:


If I do the same after setting the LD_LIBRARY_PATH to  
/usr/local/lib/mysql, I did not get error messages anymore!
 Now the problem: I included the LD_LIBRARY_PATH to my startup-script  
zopectl (see below) but I still get the same error message in the  
event.log file:


Sounds like a permissions problem: the Zope user might not be allowed to  
access /usr/local/lib/mysql.


Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Automatic capture of user ids for auditing

2007-11-06 Thread Charlie Clark

Am 06.11.2007, 20:12 Uhr, schrieb Ken Winter [EMAIL PROTECTED]:

Hi Ken,

an interesting problem although probably not unique!


It seems like the components that might be able to pass this info to the
database are the ZSQL methods and/or the database adapter (PsycopgDA, in
this case).  So, questions:
1. Is there any way to get the info across with either of these  
components

as they currently exist?  If so, how?


Not currently as far as I know.

2. Would it be possible to modify or add on to either of the to do what  
is

needed?  If so, how?


Yes, you could quite easily extend the DA to pass the current Zope user  
and possibly extend any statements as required. Not sure if that is how  
you would want to do it that way. Have you an idea how you want to do this  
on the PostgreSQL side? Any chance of accepting an additional parameter?


3. Is having one Dhatabase user per Zope-level end user an alternative  
worth

considering?


I would think not as it is very much against the connection pool principle.


4. Any other ideas about how to solve this problem?


You might want to authenticate users for PostrgreSQL and Zope against the  
same system say using mod_auth? for apache and either XUF or PAS for Zope,  
as both allow you to hold your users outside of Zope. I'm not sure whether  
you wouldn't still be stuck with the problem of having the connection tied  
to a one user while wanting to log another.


Charlie
--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Reading Oracle BLOBS from Zope

2007-09-08 Thread Charlie Clark

Am 07.09.2007, 21:08 Uhr, schrieb Kenneth A. Englund [EMAIL PROTECTED]:

I am trying to read a BLOB from an Oracle database.  I have noticed that  
when I test the ZSQL, I get the following error:


The error seems to be missing from your post. The code itself looks  
reasonable.


Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread Charlie Clark

Am 27.08.2007, 15:59 Uhr, schrieb onsombal [EMAIL PROTECTED]:


changed_field1 = form.get('field1')
changed_field1 = a new computed value
field1 = changed_field1
#create a new record with form field results for field2  field3, and a
computed value for field1
context.insertNew()

^

This is really bad as it undoes all your good work of checking the the  
values in your script. All ZSQL methods also have access to the REQUEST  
object by default so your ZSQL method sees context.REQUEST.field1. Way  
back when ZSQL was developed support for request objects was given to ZSQL  
to allow funky parameters in the URL as well as the other usual special  
methods such as manage and edit. Personally I think this is a bad idea and  
always pass my parameters in as named arguments as Maciej suggests or as a  
dictionary for neatness if there is a lot of them.


Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread Charlie Clark

Am 27.08.2007, 21:59 Uhr, schrieb onsombal [EMAIL PROTECTED]:


I'm assuming the form results are stored as an object represented as a
dictionary.  If so, then there must be a way for my python script to  
change

the key | value pair for field1 before I call my Z SQL Method.  Is this
reasonable, or am I just going down a rat-hole?


All form values are in the context.REQUEST.form dictionary which can  
overwrite to your heart's content.


Charlie
--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Reference DTML-sqlvar in ZPT?

2007-07-30 Thread Charlie Clark

Am 30.07.2007, 18:55 Uhr, schrieb Richard Flaaten [EMAIL PROTECTED]:


Dear list,
I have a ZPT that lists results from a Z SQL Method. It has one argument:
dropdown-department. Everything works fine, except I cannot find a way
to include the passed SQL argument as a string in the ZPT document!



To explain it in another way, a user selects a value from a drop-down
list. This value is passed to a Z SQL Method. My ZPT displays these
results, and I need to include the passed value (DTML-sqlvar) in a  
heading

in the ZPT.


Neither explanation is particularly helpful but it sound like you're  
trying to do something you shouldn't!


You if you are wishing to call a ZSQL method and pass in a parameter from  
your template this is done using a Python expression:


tal:content=python: mySQLMethod(SQLvar=ZPTvar)...

You can pass variables into a PageTemplate using the options dictionary.

You might want to look at my presentation (with sample code) which touches  
on Zope and RDBMS.


http://www.egenix.com/library/presentations/EuroPython2007-Zope-and-RDBMS/

Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Reference DTML-sqlvar in ZPT?

2007-07-30 Thread Charlie Clark

Am 30.07.2007, 19:18 Uhr, schrieb Richard Flaaten [EMAIL PROTECTED]:

Richard,

although this is actually a ZPT issue and nothing specific to do with  
RDBMS.



All I want to do is use the dtml-sqlvar argument as a string in my ZPT.

  

My ZPT is simply a report containing the results of the SQL query; I  
need to

use the argument as a title for the page. I am not passing any arguments

 ^

in the ZPT.


Your explanation is self-contradictory: you seem to want to use an  
argument within ZPT without passing it or defining it? Please provide a  
code snippet.


Charlie
--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


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

2007-06-16 Thread Charlie Clark

Am 17.06.2007, 00:14 Uhr, schrieb Ken Winter [EMAIL PROTECTED]:


dtml-comment
  title: Method to delete one Person by id
  connection_id: dhatabase
  arguments:
person_id
/dtml-comment
delete from person
where person_id = dtml-var person_id

When I tried to delete a couple of People using this I got the error
message:

ProgrammingError: column none does not exist


You should be using dtml-sqlvar person_id type=int here but in any  
case no argument is being passed in: the error is coming from the DTML  
rendering of a missing key argument.


I don't know about your file system product for this as all my ZSQL's live  
in the ZODB but I assume all the meta-data is contained in the  
dtml-comment section. Any chance you can test your stuff on a standard  
Zope (non-filesystem) setup? I think that's where the problem is. FWIW you  
might want to call the query or execute methods directly on the DA  
connection object if they are supported.


Charlie
--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Unified DA for Zope 2 using SQLAlchemy?

2007-03-26 Thread Charlie Clark

Am 26.03.2007, 22:31 Uhr, schrieb Andreas Jung [EMAIL PROTECTED]:


That's *exactly* what I am talking about - an *additional* generic DA
on top of SA  where we don't have to care about the different RDBMS
flavours - at least not the ones directly supported through SA.


I'm all for an SQLAlchemy DA (does SQLAlchemy support anything other than  
PostgreSQL?) and this would help people move from Zope 2 to Zope 3 but it  
*cannot* replace the other DA's because of the imperfect nature of SQL and  
the even less perfect nature of RDBMs. :-/


Furthermore, there are many occasions where you want the kind of direct  
access to a relation you get with the existing DA's.


Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 



   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Please help me about driver adapter

2007-02-17 Thread Charlie Clark
Am 17.02.2007, 13:52 Uhr, schrieb Robert-Reinder Nederhoed  
[EMAIL PROTECTED]:



Dear Nguyen,
For as far as I know, mxODBC is free to use in a non-commercial  
environment.
So you can freely use it for your research or graduation project. Once  
your

school adopts your application, they can licence mxODBC.


This is not correct. Only the Python mxODBC driver which is part of the  
mxCommercial package is free for non-commerical use. However, due to  
persistent abuse (we sell less than one licence for every thousand  
downloads) we are reviewing this policy for future releases.



So for you, it seems to be legally free after all


No (but then neither is MS SQL), but we have issued Minh Quang with an  
evaluation licence and are prepared to extend evaluation periods providing  
we are given full details.


BTW. a lot of people seem to be using mxODBC together with Oracle and  
Oracle's Instant Client driver. Unfortunately if our support requests are  
anything to go by the Instant Client driver seems to crash a lot.


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


[Zope-DB] Re: [egenix-support] DSN

2007-01-29 Thread Charlie Clark

Am 29.01.2007, 12:05 Uhr, schrieb Sven Plage [EMAIL PROTECTED]:


Sehr geehrte Damen und Herren,
ich habe in Zope eine mxODBC Database Connection angelegt und dort  
auch einen entsprechenden Database Connection String  
(DSN=testDB;DATABASE=testDB;UID=root;PWD=)  angelegt. Nun möchte ich  
aus meinem py Script darauf zugreifen, ohne User und Password übergeben  
zu müssen. Wie ist das möglich?

 conn = mx.ODBC.iODBC.DriverConnect('DSN=testDB')


Sehr geehrter Herr Plage, Dear Mr. Plage,

ich leite die Antwort auf diese Frage auch an die Zope-DB Mailing-Liste  
weiter, da es hierbei um Zope handelt. Wenn Sie ein Connection Object  
angelegt haben, erledigt dieser die Verbindung an die Datenbank für Sie.  
Abfragen werden normalerweise mit ZSQL-Methoden gemacht, die immer mit  
einem bestimmten Connection verbunden sind. Legen so eine Methode names  
myquery an. Sie können diese dann von einem PythonScript aus aufrufen:


results = context.myquery()

Mehr über ZSQL-Methoden können Sie im Zope-Buch nachlesen. Das Buch gibt  
es auch Deutsch.


answer forwarded to Zope-DB mailing list.

Once you have created a Connection Object in Zope this is responsible for  
managing the communication between Zope and the database. Queries are  
usually managed by ZSQL Methods which use specific connections. If you  
create a ZSQL Method called myquery you can call it from a PythonScript  
like this:


results = context.myquery()

More informaton about ZSQL can be found in the Zope Book.

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


Re: [Zope-DB] modifications on a query

2007-01-26 Thread Charlie Clark
Am 26.01.2007, 08:37 Uhr, schrieb Graziella Toutoungis  
[EMAIL PROTECTED]:




Hello,
I use zope2.9.4 with postgresql8.1, in my database i have some tables  
are the result  of a query on other tables.

exe: table1 is the result of table2 with table3
My
user can connect to the database and he can modify the  table1, this
modification should done on the orginals tables table2 and table3
 my
problem is how  i can  specify the origin of the column in table for
verifing that table2 and table3 may this modifications?


I am not exactly sure what you wish to do: is table1 simply a view based  
on a query of table2 and table3? It certainly sounds like it should be.  
But I am not sure if you update views in PostgreSQL that the original  
tables get updated.


You might wish to ask your question again in French as some of us will at  
least understand it like that.


Anway if you wish to update tables based on the results of queries in Zope  
you are probably best using a PythonScript to link the appropriate queries  
if this is not directly possible in SQL.


ie.

results = context.SQL.someQuery()
for result in results:
context.SQL.anotherQuery(result) # you probably wish to pass a  
dictionary based on the first query in


Charlie

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


[Zope-DB] Re: Zope hungs: mxODBC + Progress ODBC on Windows

2007-01-22 Thread Charlie Clark

Am 22.01.2007, 11:54 Uhr, schrieb Pawel Lewicki [EMAIL PROTECTED]:


Charlie Clark napisał(a):
Am 22.01.2007, 11:24 Uhr, schrieb Pawel Lewicki [EMAIL PROTECTED]:
 Hi,
I'm using a configuration from the subject. It's quite an old Zope 2.7  
instance without prospects of upgrade because of dependencies.
Problem is with ODBC broker timeouts. When query takes too much time  
the connection breaks and Zope hangs. I suspect that ODBC client hangs  
and binds mxODBC binaries.
I have the same problem when ODBC client is badly configured and I  
restart Zope with open connection.
What would be the best option to free Zope from hung process?  
Additional layer like ODBC-ODBC bridge if available?


Can you provide more detailed information about your setup? ie. which   
combination of driver and bridge on which platforms you're using?


 Progress 9.1 + OpenLink ODBC broker(5.1) on Solaris 32 Bit Sun Sparc  
Openlink ODBC client + Zope2.7 on Windows XP


That is an interesting combination! Have you been in touch with Openlink  
at all? The mxODBC Zope DA is pretty resilient but will, of course, have  
problems if the driver it is talking to times out or freezes. How many  
connections have you got running? mxODBC should be able to open an  
additional connection if necessary and possible. I think it is essential  
to find out what is causing the queries to timeout.


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


[Zope-DB] Re: Zope hungs: mxODBC + Progress ODBC on Windows

2007-01-22 Thread Charlie Clark

Am 22.01.2007, 13:00 Uhr, schrieb Pawel Lewicki [EMAIL PROTECTED]:


 I know what's causing timeouts  I can't help it now.


It would still be useful to others: is it a database, network or driver  
issue.


Increasing connection number doesn't help. I don't blame mxODBC as it is  
a great product.


Thanks

I just wonder if anyone had similar problems with any ODBC client. Maybe  
there is a way to bind mxODBC another way or use additional non-breaking  
layer.


What's the best to resolve it manually? Close and reopen the connection?

Charlie

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


Re: RE : [Zope-DB] How lunch SQL request from python script ?

2007-01-19 Thread Charlie Clark
Am 19.01.2007, 13:27 Uhr, schrieb Maciej Wisniowski  
[EMAIL PROTECTED]:



Please, stay on the list
First, isn't Charlie Clark solution good for you? It seems to be
reasonable.


Thanks! ;-)

I have try to use external method but without success... (I have read  
some post as you suggested it)



Create database connection object called 'myconnection' in ZMI and
connect it to your database.
Create external method like:
def callSQL(self, statement):
 conn = self.myconnection()
 return conn.query(statement)


The only thing that's missing for me is using this idiom with existing  
ZSQL methods and that's because I've forgotten how to get them to render  
the query rather than execute it. Anyone care to enlighten me! ;-)


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


Re: [Zope-DB]found reason: sql query works in database connector but not in ZSQL method

2007-01-19 Thread Charlie Clark

Am 19.01.2007, 17:50 Uhr, schrieb robert rottermann [EMAIL PROTECTED]:


it in deed seems not to work.
however I do not understand why.


If you use callproc() we could probably help you.


This is now academical as I resolved to not to use stored procedures
that return a record set (tough its a pain in the back).
what I do (did):



1. write data (in a ZSQL connction), did commit it, did flush the table.
(reading from plain mysql shows the data)
2. in a python modoul I
 - flush the tables (to force a reread)
 - read the data
 - send it to plone to display
unfortunately I get stale data.
As we need to go online next week, I resolved to not to use Stored
Procedure to retrieve the data.
However I really like to know why I cant.


Don't forget that Zope will also cache results from the database as indeed  
the ODBC driver may. You should really try this using a single connection  
object.

call the procedure + get the results if possible
if not call the results with an additional query
run the query that uses the results of stored procedure.

You can do all this in a single ExternalMethod.

Charlie

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


Re: [Zope-DB] How lunch SQL request from python script ?

2007-01-18 Thread Charlie Clark

Am 18.01.2007, 11:52 Uhr, schrieb CERETTO Thierry [EMAIL PROTECTED]:


select distinct c.id_risque, c.libelle_risque, c.id_fiche, c.id_portee,
c.url_info
from (mots a join amotrisque b on a.id_mot = b.id_mot )
join risques c on b.id_risque = c.id_risque
where a.mot_MAJ like '%@@CRITERE1@@%'
union
select distinct c.id_risque, c.libelle_risque, c.id_fiche, c.id_portee,
c.url_info
from (mots a join amotrisque b on a.id_mot = b.id_mot )
join risques c on b.id_risque = c.id_risque
where a.mot_MAJ like '%@@CRITERE2@@%'
union

***
where  %@@CRITERE1@@' , %@@CRITERE2@@, ...,  are words filled in
textfield (separate by a space).



If you are simply adding results of the same query but different results  
then do not use UNION!!!
Run the same query three times with different parameters and simply add  
the results together in a script.


Your ZSQL should look something like this

select distinct c.id_risque, c.libelle_risque, c.id_fiche, c.id_portee,
c.url_info

from (mots a join amotrisque b on a.id_mot = b.id_mot )

 join risques c on b.id_risque = c.id_risque

where a.mot_MAJ like dtml-sqlvar '%@@' + CRITERE + '@@%' # or use  
dtml-sqltest if you prefer


call this from a PythonScript

criteria = ['n'import quoi', 'depardieu', 'segolene', 'sarko']

results = []
for c in criteria:
 results = context.ZSQLMethod(CRITERE=c)

This will work for fairly simple SQL but if you want to create your SQL  
dynamically (and I don't think this is such a good idea) then you should  
use a different template than ZSQL. With our mxODBC Zope DA you can pass  
your SQL directly into the execute method of a DA connection object.


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


Re: [Zope-DB]found reason: sql query works in database connector but not in ZSQL method

2007-01-18 Thread Charlie Clark

Am 18.01.2007, 17:58 Uhr, schrieb robert rottermann [EMAIL PROTECTED]:


I think I found the reason, for my problems with stored procedures.
it seems that on can not call a stored MySQL 5.0x procedure from zope
that returns a data set.


If you use the mxODBC Zope DA callproc() method then you can read the last  
result set returned by a procedure.



when I call the body of the stored procedure everything works fine.
what I now do as an interim solution, I call the read only procedures
directly from python.
procedures that alter data i call from a zope connector.
I would be glad to here of any reason not to do this.


Yes, if you really do something outside of Zope then you are compromising  
your transactional integrity.


Charlie


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


Re: [Zope-DB] sql query works in database connector but not in ZSQL method

2007-01-17 Thread Charlie Clark

Am 17.01.2007, 15:42 Uhr, schrieb robert rottermann [EMAIL PROTECTED]:


Hi there,
I try the following statement:
CALL selectVertexProperties(1, @error2)
when I execute this directly in the test window of the database
connection, it works fine.
when i execute the same line in the test window of a ZSQL Method
then I get an error:
Error, Products.mxODBCZopeDA.ZopeDA.ReplayTransaction: OperationalError
on : ('HYT00', 2014, [unixODBC][MySQL][ODBC 3.51
Driver][mysqld-5.0.26]Commands out of sync; you can't run this command
now, 6113) SQL used:


Robert,

you might have to call this using the callproc() method of the DA in an  
ExternalMethod.


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


Re: [Zope-DB] sql query works in database connector but not in ZSQL method

2007-01-17 Thread Charlie Clark

Am 17.01.2007, 17:14 Uhr, schrieb robert rottermann [EMAIL PROTECTED]:


If tried that, but somehow I did not get it rigth:
questions:
- - the first parameter is an integer, how do I force that?


int(para) ?


- - the second parameter is an out parameter, how do I specify that ?


You don't, I think we don't support them currently.

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


Re: [Zope-DB] [Zope] ZSQL Methods and transaction control

2007-01-10 Thread Charlie Clark

Am 10.01.2007, 13:00 Uhr, schrieb robert rottermann [EMAIL PROTECTED]:


I understand that there is a way to handle transaction control in the
ZMySQL methods. However I find no documentation at all on how to use it.


This is incorrect. ZSQL methods are called within Zope transactions so you  
need to look at the transaction manager.


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


Re: [Zope-DB] Basic tsql example using MxODBC Zope DA adaptor?

2007-01-07 Thread Charlie Clark
Am 04.01.2007, 18:47 Uhr, schrieb [EMAIL PROTECTED]  
[EMAIL PROTECTED]:



Hello Everyone,
I am relatively new to Zope/Plone, as well as the MxODBC Zope DA  
adaptor.  I am wondering if someone could point me to a basic example  
that would illustrate how to use the MxODBC Zope DA adaptor outside of a  
ZSQL method, using the Python API.  I am using a script to build  
transact-sql statements, and it doesn't appear to be possible to pass  
t-sql into a ZSQL method.


You can use the mxODBC ZopeDA to pass in all kinds of SQL, ie. if you wish  
to generate your SQL dynamically or to make use of bound parameters. This  
is done using an ExternalMethod as detailed below. However, this will  
still be within Zope's transacational management and is, thus, not  
suitable if you wish to manage transactions yourself. If you wish to do  
this then you should first of all read up on Zope's transactional  
management to see how to use this. If you wish to use this for something  
like a batch function then you are probably better of without using Zope  
at all.



ZSQL and ZopeDAs are severely limited and contain antiquated code.
This makes it particularly difficult to generate dynamic SQL as often
required. It also means that parameters get quoted by the DA which can
be messy. An alternative is to use ExternalMethods to call the
.execute() method of an mxODBCZopeDA and pass it statements
and parameters.

Create a file in ~/Extensions, say ODBC_SQL.py

This is essentially needs only one function:

from Shared.DC.ZRDB import Results

def callSQL(connObj, SQL=SELECT value FROM content):
results = connObj.execute(SQL)
return Results.Results(results)

Create a Zope External Method say SQL which points to callSQL in
ODBC_SQL.

You can then call this method from any PythonScript and simply pass it
the connection and statement you want to execute.

In your case the PythonScript needs only to be modified slightly,
depending on what you want to.

statement = select [Building ID] from [Buildings] \
where [Building Name] = ?
results = context.SQL(mymxODBCZopeDA(), statement)

return results

The results returned are the same as would be returned by a ZSQL-method.

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


Re: [Zope-DB] How do I use my archetypes-generated form to insert data into a mysql table?

2006-10-16 Thread Charlie Clark

Am 16.10.2006, 14:13 Uhr, schrieb Anna Falkowska [EMAIL PROTECTED]:


I made a form using ArchGenXML and want to use it to populate a table
in a mysql database. So far I have not come across a good tutorial on
how to do this. Someone suggested I use ZSQL methods. I understand how
to create them, but how exactly would I call a ZSQL method with the
information from my form?


Hi,

check the section on ZSQL in the Zope Book to understand how ZSQL works  
but I suggest you proceed as follows.

Pass your form into a PythonScript to run checks pretty much like this:

request = context.REQUEST

for item in request.form.keys():
validate(item)

if no_errors:
context.SQL.someZSQLMethod(dictionary_of_items)
return context.thank_you_page()

else:
return context.error_page()

Charlie
--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

Try mxODBC.Zope.DA for Windows, Mac OS, Linux, Solaris, FreeBSD for free!
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Pitfall: mxODBCZopeDA and test runner in 2.9+

2006-10-16 Thread Charlie Clark

Am 16.10.2006, 15:10 Uhr, schrieb Chris Withers [EMAIL PROTECTED]:


Charlie Clark wrote:
Technically you should actually use $INSTANCE_HOME/modules at least for   
Never heard of 'modules' before, where did you read about this?


My bad - I'm sure I saw it on one of the more recent Zope versions but  
you're right ../lib/python is the right target for packages.


 newer versions of Zope and I think this is also the way to go in the  
future. We've stuck with $INSTANCE_HOME/lib as this works with so many  
different versions of Zope which we try and support - helping users  
install mxODBC correctly is the number one support issue.
 Then give them a normal source install  (and it's  
$INSTANCE_HOME/lib/python ...)


Sorry, but that wouldn't help the users I'm talking about!

Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

Try mxODBC.Zope.DA for Windows, Mac OS, Linux, Solaris, FreeBSD for free!
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Error in Shared.ZRDB.Connection.__setstate__ in 2.9.4

2006-10-16 Thread Charlie Clark

Am 16.10.2006, 16:52 Uhr, schrieb Chris Withers [EMAIL PROTECTED]:

While I couldn't find any trace in the collector, I did see that this  
has already been corrected in Zope 2.10.0

 Is it still worth submitting the error?
 def __setstate__(self, state):
Globals.Persistent.__setstate__(self, state)
if self.connection_string:
try: self.connect(self.connection_string)
except:
logger.error('Error connecting to relational database.',
 exc_info=exc_info())
 And this is STILL wrong... FFS...
 How hard is exc_info=True to grasp as a concept?


Don't shoot the messenger! I've hardly touched the logging module so I'll  
plead ignorance (as well as stupidity ;-). But for 2.10 it is a big error  
if zLog is officially being deprecated. I'll submit a bug.


Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

Try mxODBC.Zope.DA for Windows, Mac OS, Linux, Solaris, FreeBSD for free!
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Error in Shared.ZRDB.Connection.__setstate__ in 2.9.4

2006-10-16 Thread Charlie Clark

Am 16.10.2006, 17:30 Uhr, schrieb Chris Withers [EMAIL PROTECTED]:

Don't worry, that wasn't aimed at you  I've hardly touched the logging  
module so I'll plead ignorance (as well as stupidity ;-). But for 2.10  
it is a big error if zLog is officially being deprecated. I'll submit a  
bug.
 zLOG is gone, this shouldn't have been a big deal, but it would have  
been nice had whoever did the global search'n'replace to use the logging  
module instead of the zLOG module had bothered to rtfm first.
 It would have been even nicer had whoever fixed the original bug  
bothered to rtfm as well...


Oops, I submitted a duplicate bug (I did try looking beforehand) which has  
been rejected as already fixed - it certainly isn't in the 2.10 which  
can be downloaded. Will this automatically get the change which _has_ been  
made to trunk?


Charlie
--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

Try mxODBC.Zope.DA for Windows, Mac OS, Linux, Solaris, FreeBSD for free!
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Pitfall: mxODBCZopeDA and test runner in 2.9+

2006-10-12 Thread Charlie Clark

Am 10.10.2006, 23:35 Uhr, schrieb Paul Winkler [EMAIL PROTECTED]:


If you have mxODBCZopeDA and are using it with zope 2.9 or higher,
a word of warning:
You *must* use the -k option to the test runner when running
 tests in your INSTANCE_HOME.
 Example:
 ./bin/zopectl test -k
If you fail to use -k, the zope test runner will delete bytecode for all
your products - including mxODBCZopeDA, which has no .py files to fall
back on.  Ouch. I'll investigate further - there might be a bug to file
against zope.testing.


For development purposes of this nature you might drop mxODBCZopeDA in  
your SOFTWARE_HOME rather than INSTANCE_HOME which should protect.

Charlie

--
Charlie Clark
eGenix.com
Tel: +49-211-600-3657
GSM: +49-178-782-6226

Professional Python Services directly from the Source
___
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 Charlie Clark

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.


Charlie
--
Charlie Clark
eGenix.com
Tel: +49-211-600-3657
GSM: +49-178-782-6226

Professional Python Services directly from the Source
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Getting a cursor?

2006-09-27 Thread Charlie Clark

Am 27.09.2006, 23:44 Uhr, schrieb Paul Winkler [EMAIL PROTECTED]:


Any suggestions?
p.s. I'll be asking egenix too, we'll see if they reply to help requests
without a purchased license... but then, if I can't get this to work
there's no point in purchasing one :-]


Why shouldn't we answer support requests? You can access most of the  
mxODBC API on a ZopeDA object through an ExternalMethod. This is indeed  
above and beyond the ZopeDA API which predates the Python one as far as I  
know.


Call an mxODBC Zope DA object and pass it to your ExternalMethod which can  
then call it as you would in Python.


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


Re: [Zope-DB] Working with ZPsycopgDA (or any DA) - commiting

2006-08-11 Thread Charlie Clark

Am 11.08.2006, 16:56 Uhr, schrieb [EMAIL PROTECTED]:


Hi
I'm working with a Postgresql database which I have to insert a lot of  
data to... I'm using the ZPsycopgDA database adapter, and ZSQL methods.
I have noticed that though I am calling the zsql method no data gets  
really commited to the database. It all gets entered to database at the  
very end.
This behavior seems reasonable for keeping database consistent, but in  
my situation it is really not so good - I have couple houndreds  
megabytes of data and as I believe it all gets stored in memory before  
being sent to the database causing serious system lags. I could be wrong  
though - this is only my observation... What could be another reason for  
slooow inserts?
Either way, it would be far better for me if every INSERT would be  
commited immediatelly or better yet if I could force a commit within  
my code. Is there some way I can do it?


Maciej,

if you want transactional integrity then be prepared to pay the price: do  
not adjust Zope's transaction settings. As Andreas says you can make some  
adjustments on the server to speed up the process but please note that  
Zope is infamously slow for SQL statements although this usually does not  
play an important part. If you are doing a one off import then you are  
better working directly with Python. If you do need to work within Zope  
then note that using bound parameters should give you an additional  
performance boost over anything you can set on the server.


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


Re: [Zope-DB] ZPsycopgDA connection failing

2006-06-07 Thread Charlie Clark

On 2006-06-07 at 16:17:13 [+0200], Davis Mr MR [EMAIL PROTECTED] 
wrote:
 Hi,
 
 My connection to Postgres keeps failing every couple of hours. I did
 read that there was a problem with some versions of this. I'm using
 2.0b6 at the moment.
 
 Does anyone have a version number that I can try that will re-establish
 a connection on failure.

Michael,

if you look at the DA (db.py) source you will see that it actually tries to 
reconnect if no connection is available so the problem must be somewhere 
else. PostgreSQL connections themselves don't timeout but if the database 
is on a network and the connection is dropped then the DA may well think it 
is connected when it isn't. This is difficult to solve in the DA and you 
need to know why the connection is being dropped first.

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


Re: [Zope-DB] mysql / zope db connection issue

2006-04-06 Thread Charlie Clark

On 2006-04-06 at 16:34:01 [+0200], Jamie O'Keefe [EMAIL PROTECTED] 
wrote:
 On 4/6/06, Charlie Clark [EMAIL PROTECTED] wrote:
  This still should not be causing this problem. Jamie, you should be 
  talking
  to the DBA or looking at the DB side of things.
 
 Well it is a volunteer operation, so we don't specifically have a dba,
 but will talk with the person who set up the db.
 
  Is the DB running on the
  same machine as Zope or on the network?
 
 Yes.
 
  What are connection times set to?
 
 Do you mean the connection timeout time?

Yes. The default for these are very high which often causes problems for 
applications that don't implement connection pooling. However, as I 
previously said this is unlikely to be the source of the problem.

  It might simply be that MySQL is running out of connections although this
  usually means that the whole machine runs slow.
 
 We upped the # of connections and I have seen 51 connections open at
 one time.  Not sure the rate at which people are accessing the form
 and submitting it, but I believe it may be 25-50 a day.

At that rate there is no reason on the Zope side for the connection being 
dropped. There could be a problem with the underlying Python driver and thus 
the ZopeDA so you might want to install the latest version of both:

http://sourceforge.net/project/showfiles.php?group_id=22307

MySQL 3.2 is still supported.

But you should also run Zope in debug mode and see what gets written to the 
error log.

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


Re: [Zope-DB] mysql / zope db connection issue

2006-04-06 Thread Charlie Clark

On 2006-04-06 at 20:46:36 [+0200], Jamie O'Keefe [EMAIL PROTECTED] 
wrote:
 Hi Dieter,
 
  We switched to Postgres, MySQL is used only for legacy components.
 
 Isn't postgres linux only?  We use FreeBSD.

PostgreSQL was developed at the University of California, Berkeley and runs 
on a huge range of problems. I prefer it over MySQL but I am not convinced 
that switching to PostgreSQL will solve your problems and, of course, will 
involve all the work of migration.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] ZSQL + MySQL + sqltest + list

2006-04-05 Thread Charlie Clark

On 2006-04-05 at 10:39:11 [+0200], Matthew Fairclough 
[EMAIL PROTECTED] wrote:
 Chris,
 
 Thanks for your help.
 
 Basically I just want to limit the result to a number of entries based on 
 Id.
 
 As there are several Id's I'm trying for ... where catId IN (x, y, z).
 
 I could just use a variable that is a list (through REQUEST) but I would 
 like to
 ensure the argument is an integer, hence sqltest.

This is one of the reasons why I'm no great fan of dtml-sqltest.

You can easily do your checking for an integer in a PythonScript and pass 
the result into your ZSQL as a standard DTML variable.

catID = [int(i) for i in catIDs]

Cleaner and quicker than playing the dtml-sqltest.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] my query:I am having one database, I want to retrieve the data as and when loged on

2006-03-22 Thread Charlie Clark

On 2006-03-22 at 12:22:24 [+0100], Shiv [EMAIL PROTECTED] wrote:
 I am having the data in data.fs file,iI want to retrive the data on my html
 page when I type the URL and get the first page.I am not getting the data at
 first time,getting after the refrsh of the page.Give me the code for that

What an incredibly rude e-mail!

The answer is: read some documentation and also learn how to write to e-mails!
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] TAL and empty sql-list

2006-03-21 Thread Charlie Clark

On 2006-03-21 at 15:21:29 [+0100], Jimmy small [EMAIL PROTECTED] wrote:
 sorry for the double post --
 A python script would be your best bet.  You would be able to use that
 in other areas of your site in that case.

At least as long as TALES doesn't support this directly.

In a PythonScript you can use the .names() method of your results object to 
create an empty tuple for your results.

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


Re: [Zope-DB] News Item properties

2006-02-28 Thread Charlie Clark

On 2006-02-27 at 17:31:09 [+0100], [EMAIL PROTECTED] wrote:
 Ciao,
 
 sto cercando di visualizzare su un page template zope (che tra l'altro e'
 l'home page index_html) l'ultima news inserita via plone.

Ciao,

scrive al'inglese per favore.

Charlie Clark
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] News Item properties

2006-02-28 Thread Charlie Clark

On 2006-02-28 at 09:40:29 [+0100], [EMAIL PROTECTED] wrote:
 the fact is that I should have also the first 500 characters of the news (an
 abstract to put in the home page with a link of the entirely news)
 I tryed with:
 
 span tal:replace=python:test(obj.Dcoument,
 obj.Dcoument, obj.getId) Extended Calendar Product /span
 span tal:replace=python:test(obj.Text,
 obj.Text, obj.getId) Extended Calendar Product /span
 span tal:replace=python:test(obj.Content,
 obj.Content, obj.getId) Extended Calendar Product /span
 span tal:replace=python:test(obj.Body,
 obj.Body, obj.getId) Extended Calendar Product /span
 
 
 but I cannot show out the content... I have looked on references, on google
 and on zope 'doc' tab but nothing at all...

Please redirect your question to the Plone list. This list is for questions 
about Zope and relational databases and the ZODB.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] How I can connect MySQL database?

2006-02-09 Thread Charlie Clark
On Thu, 09 Feb 2006 08:03:49 +0100, Andreas Jung [EMAIL PROTECTED]  
wrote:


And btw. _learn_ how to post. Sending a three line posting as a 44 KB  
large mail containing html and lots of
images is only _disgusting_. If you do expect help from community then  
stick to their basic rules.


The original e-mail got stuck in three different spam filters so had no  
chance of getting answered here.


Charlie

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


Re: [Zope-DB] external ZODB from Zope interface

2006-02-02 Thread Charlie Clark

On Thu, 02 Feb 2006 16:25:09 +0100, gyro funch [EMAIL PROTECTED] wrote:


Thanks for the very useful reference.
However, I don't see anything in there about accessing a ZODB. I may  
have missed something, but I don't see a suitable
ZODB adapter that I can add in the Zope interface (similar to what is  
apparently possible for Gadfly, MySQL,

PostgreSQL, and other DBs).
Any other ideas about how to access 'external' ZODBs and make them part  
of the Zope project?


Interesting question. I don't think is a common request. You might want to  
look at how to use standalone ZODB's in Python, although it sounds as if  
you're already competent with that. It may indeed be that you do need an  
ExternalMethod for what you want to do - shouldn't be much trouble, I  
would think. Why do you need several databases? Is it something to do with  
the size of your data?


Other than that I'm sure the Timbot will notice the post!

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


Re: [Zope-DB] Warnings from mxODBC in 2.8.5

2006-01-23 Thread Charlie Clark
On Mon, 23 Jan 2006 10:24:04 +0100, Chris Withers [EMAIL PROTECTED]  
wrote:



Charlie Clark wrote:
Hi Chris,
 are you using Zope 2.8.5 or Zope 2.9.0 or are they the same thing?
 2.8.5.
 I find the fact that you ask if 2.8.5 and 2.9.0 are the same thing  
quite scary...


You shouldn't worry too much! I'd just installed the FreeBSD port for  
2.9.0 which was actually 2.8.5!


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


Re: [Zope-DB] Warnings from mxODBC in 2.8.5

2006-01-23 Thread Charlie Clark
On Mon, 23 Jan 2006 11:53:41 +0100, Chris Withers [EMAIL PROTECTED]  
wrote:



Charlie Clark wrote:
 You shouldn't worry too much! I'd just installed the FreeBSD port for   
2.9.0 which was actually 2.8.5!

 Haha... okay, that just makes me even more scared of FreeBSD...


Oh, it shouldn't! FreeBSD's ports are excellent and really easy to use. It  
was my mistake as I should have read the package information. I have  
reported the mislabelling to the maintainer.


The current breakneck pace of Zope releases doesn't make it easy for  
companies like us providing Zope add-ons. The last couple of releases have  
all had minor changes in the architecture which have required changes to  
the mxODBCZopeDA for compatability. We are still waiting for the Windows  
binary version of Zope 2.9 before we release anything for it.


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


Re: [Zope-DB] Warnings from mxODBC in 2.8.5

2006-01-23 Thread Charlie Clark
On Fri, 20 Jan 2006 08:27:25 +0100, Chris Withers [EMAIL PROTECTED]  
wrote:



DeprecationWarning: __init__.py of Products.mxODBCZopeDA has a long
deprecated 'methods' attribute. 'methods' will be ignored by  
install_product

in Zope 2.10. Please use registerClass instead.
  DeprecationWarning)


FWIW this also effects ZpsycopgDA (at least using 1.1.21)

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



Re: [Zope-DB] I need urgent help !!!

2006-01-17 Thread Charlie Clark

On 2006-01-16 at 13:59:49 [+0100], [EMAIL PROTECTED] wrote:
 HEllo my name is Gustavo I am from chile(southamerica), my english is not
 so good, sorry for that, well my cuestion is the next, i need do a web
 single sign-on whit my plone (ZOPE) web sites, i have a apache2.0 server
 too, i need help whit these item because my job depend of taht, any answer
 send me to my mail adress [EMAIL PROTECTED], thank you very much, and i
 hope for your help, bye bye...

Gustavo,

whether your English is good or not, your question is too vague. It is 
possible to integrate Zope's authentication system with others for a single 
sign-on but you need to provide more information about the system you wish 
to integrate with. If you search zope.org for UserFolder then you will see 
some of the solutions available.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] database connection

2006-01-10 Thread Charlie Clark

On 2006-01-10 at 12:50:41 [+0100], Martin Krallinger [EMAIL PROTECTED] 
wrote:
 Hi all,
 
 
 I am using zope to connect to my postgres database using psycopg.
 Everything works fine, I can connect to the db and do queries, the first
 20 results are displayed correctly, but when I want to display the
 '(Next 20 results)' I get the following error:

This is a standard error in ZSQL's test pages and is due to the fact that the 
query parameters are not included in the link for the next 20 results.

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


Re: [Zope-DB] database connection

2006-01-10 Thread Charlie Clark

On 2006-01-10 at 13:06:30 [+0100], Martin Krallinger [EMAIL PROTECTED] 
wrote:
 Thanks Charlie,
 
 so, how could I solve this problem in my case?

Please keep replies like this on the mailing list.

Well, you can fix the DTML of the page in question so that the parameters 
are carried or simply write a report page with your own batching mechanism 
to pass the parameters through. I think this has been fixed in versions of 
Zope  2.7

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] User Authentication

2006-01-09 Thread Charlie Clark

On 2006-01-07 at 03:21:06 [+0100], Laurentiu Traineanu [EMAIL PROTECTED] 
wrote:
 When I change on the Security tab of the index_html method, the View 
 permission from Acquire to Authenticated I do receive the Login 
 Required page from domains/mydomain/acl_users and the Contents tab, DTML 
 method called docLogin (Login Page).
 
 If I enter the user name as caladmin and its password schi and click 
 the OK button ... the login page comes back over and over again. No error 
 messages are displayed.
 
 What am I doing wrong and how can I make it work? Please help.

It sounds like you are using XUF so you might want to direct your question 
there. XUF is configured to present you with the login page if you give the 
wrong details. You should check the error log for full details.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Z SQL equivelant of MySQL's SQL_CALC_FOUND_ROWS?

2005-12-06 Thread Charlie Clark

On 2005-12-06 at 10:48:29 [+0100], Chris Withers [EMAIL PROTECTED] 
wrote:
 Charlie Clark wrote:
 I wonder how the two methods compare efficiency-wise?
 
 Yes, well, we're talking about MySQL specifically ;-)
  
  Well, with reference to Zope we shouldn't be...
 
 Huh? the original poster was talking about MySQL, why should he care
 about any other rdb?

Well, he was talking about using ZSQL and cited by MySQL and MS SQL 
statements. ie., he was interested in a generic approach. At least that's 
how I read it.

 Not so. Think of batches:
 
 Now showing Results 5 - 10 of 25
 
 But why not just return all the rows and only show 5 of them?
 
 Now showing Results 5 - 10 of 25
  
  Yes, let's talk about batches - ZSQL doesn't implement batching so it
  collects the whole set of results available so len() is available.
 
 How would you implement batching in a way that's agnostic of the rdb used?

Currently I do this with a script but the LCD solution would be to use a 
LIMITs based on parameters passed in. Essentially, however, the RDBMS has 
to support the feature and the Python DB API should be cover it. Having had 
to work with both MySQL and SQLite recently the compromises required to 
support lesser systems can be really annoying.
 
  Result sets aren't supported directly
 
 by what?

By ZopeDA's and ZSQL
 
  so unless the DA provides a method to
  query on the connection or cursor you will also have to run a separate 
  query
  with count().
 
 *sigh*

I've not discovered this to be a real problem yet although my result sets 
are rarely more than several thousand items long when ZPTs rendering speed 
becomes the problem. One could imagine RDBMs support in Zope3 being so much 
better if only anyone could be really bothered about it ;-)

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


Re: [Zope-DB] Z SQL equivelant of MySQL's SQL_CALC_FOUND_ROWS?

2005-12-05 Thread Charlie Clark

On 2005-12-05 at 08:42:09 [+0100], Chris Withers [EMAIL PROTECTED] 
wrote:
 Charlie Clark wrote:
 SELECT count(attribute) FROM relatiin WHERE condition
 
 Ah, okay, now I gotcha...
 
 only returns 1 result so it's independent of LIMIT and result sets.
 
 I wonder how the two methods compare efficiency-wise?
 
 Yes, well, we're talking about MySQL specifically ;-)

Well, with reference to Zope we shouldn't be...

  Maybe although I sometimes why MySQL does anything: the documentation 
  seems
  to imply that many decisions were sort of let's do it like this: cf.
  particularly the recommendations for writing queries with JOINs. 
  Personally I
  do not see it as valid SQL to predicate a query on what was just asked.
 
 Sorry, not a lot of this paragraph made sense :-S

It still does to me. Have you had your morning tea? It's not that important.
 
  Regarding the original question: if I know I am working with LIMITs or 
  result
  sets then this implies I don't want to know the total size of the results
  beyound len(results).
 
 Not so. Think of batches:
 
 Now showing Results 5 - 10 of 25
 
 But why not just return all the rows and only show 5 of them?
 
 Now showing Results 5 - 10 of 25

Yes, let's talk about batches - ZSQL doesn't implement batching so it 
collects the whole set of results available so len() is available. I agree 
that this is likely to be inefficient for large results but it doesn't 
require any additional calls. Or you do as Dieter suggested an run two calls 
- first one simply counts and the second one effectively does batching. 
Result sets aren't supported directly so unless the DA provides a method to 
query on the connection or cursor you will also have to run a separate query 
with count().

Which means: it would be nice if ZSQL supported batching, preferably by 
result sets and this means the DAs have to expose more of the underlying 
functionality and getting more information from the Python driver.

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


Re: [Zope-DB] Z SQL equivelant of MySQL's SQL_CALC_FOUND_ROWS?

2005-12-02 Thread Charlie Clark

On 2005-12-02 at 10:33:34 [+0100], Chris Withers [EMAIL PROTECTED] 
wrote:
 Charlie Clark wrote:
 That doesn't work if you use offsets and limits to only return part of a
 result set...
  
  SELECT count(attribute) FROM relatiin WHERE condition
 
 Ah, okay, now I gotcha...
 
  only returns 1 result so it's independent of LIMIT and result sets.
 
 I wonder how the two methods compare efficiency-wise?

ah, that might well be in the realms of db-tuning and magic but one might 
expect a count() operation to be slightly faster as it requires less data to 
be packaged. The implementation of LIMITs and result sets might vary 
significantly from system to system.

  Of course, ZopeDAs such as our mxODBCZopeDA can be extended to support
  additional commands on the connection but that is not part of the ZSQL
  specification and will vary from RDBMS to RDBMS as the initial mail noted.
 
 Well, that's why MySQL does it as an SQL statement, no? ;-)

Maybe although I sometimes why MySQL does anything: the documentation seems 
to imply that many decisions were sort of let's do it like this: cf. 
particularly the recommendations for writing queries with JOINs. Personally I 
do not see it as valid SQL to predicate a query on what was just asked. 

Regarding the original question: if I know I am working with LIMITs or result 
sets then this implies I don't want to know the total size of the results 
beyound len(results). Of course, it can be a right Tony Blair rewriting a 
complex SQL query just to add a count in there as opposed to calling a method 
on a cursor object. And this is where ZopeDA connections could do with 
improved support beyond the current it's good enough as it is situation so 
that database functions can be called directly more easily where required. 
But as we all know, so far no one has come forward to champion new generation 
ZSQLs and ZopeDAs to do this.

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


Re: [Zope-DB] Z SQL equivelant of MySQL's SQL_CALC_FOUND_ROWS?

2005-11-29 Thread Charlie Clark

On 2005-11-29 at 20:20:10 [+0100], Kevin Monceaux [EMAIL PROTECTED] 
wrote:
 Zope Enthusiasts,
 
 I'm new to Zope so forgive me if the answer to this question is obvious.  If
 one performs a select with a limit clause is it possible to determine how
 many results would have been returned if there was no limit?  For example,
 if I wanted to select the first picture in a photo album but wanted to know
 the total number of pictures in the album, how would I do that via Z SQL?
 With MySQL it can be done this way:
 
 SELECT SQL_CALC_FOUND_ROWS, * from Pictures where AlbumID = 25 LIMIT 1;
 
 SELECT FOUND_ROWS() as Count;
 
 According to the Z SQL Methods User's Manual multiple SQL statements can
 be included in a Z SQL method but that no more than one select statement can
 be included.  The above MySQL technique requires two select statements.

You can use dtml-var sqldelimiter - search the archives for that.
But that is wrong. If you want to count the number of records, use count()

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] insert failing without raising exception: postgresql, psycopg

2005-11-22 Thread Charlie Clark

On 2005-11-22 at 12:27:42 [+0100], [EMAIL PROTECTED] wrote:
 
 Though the insert is failing, a sequence column in the target table is
 apparently being incremented by the failing insert.  (I deduce this
 from the fact that subsequent Z SQL test inserts show sequence gap
 of 12 after each failed insert attempt, while no gap occurs when I
 call the Z SQL method repeatedly via Zope's test tab.)
 
 I will appreciate any suggestions as to how I might troubleshoot this.

You should probably compile psycopg to give debug information and I would 
suggest updating to the most recent build in the 1 series. In addition you 
might want to try using our mxODBCZopeDA to see if the error is with the 
DA/driver or in Zope itself.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2005-10-17: Released mxODBC.Zope.DA 1.0.9http://zope.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] dumb INSERT Question

2005-05-02 Thread Charlie Clark

On 2005-05-02 at 02:29:53 [+0200], Michael Schwartz [EMAIL PROTECTED] wrote:
 Arguments: userId, roleId
 
 INSERT INTO UserRoles
  (Id_User,
   Id_Role)
 VALUES
  (dtml-sqlvar userId type=int,
   dtml-sqlvar roleId type=int)
 
 I test the method:
   UserId  14
   RoleId  12
 
 I get back:
 
 Error, exceptions.ValueError: Missing input variable, userId
 -
 SQL used:   Could not render the query template!
 
 This is a form generated by Zope... how could it be missing the userId
 field?
 
 What am I doing wrong? Does it have something to do with the int
 data type? I am comparing it vs. a working INSERT, and everything
 looks the same.
 
 TIA!!! I'm going crazy looking at for errors!

UserID != userId

variables in Python are case sensitive.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


RE: [Zope-DB] ZPTs and database accesses

2005-04-28 Thread Charlie Clark

On 2005-04-28 at 20:26:47 [+0200], Ken Winter [EMAIL PROTECTED] wrote:
 Andreas -
 
 Thanks for your answer.  I'm relieved to know that the ZPT-ZSQL combination
 will suffice for database accesses.  As a Zope neophyte, though, I still
 need an example or tutorial showing me how to get data from page to database
 via ZPTs and ZSQL objects.  Can you point me to such a reference?

Yes, the Zope book is the place to look.

You create a ZSQL method with the SQL code

You then call this method through your ZPT or better in the case of posting 
from page to database a PythonScript which in turn calls the ZSQL method and 
passes the parameters.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Null characters booleans

2005-04-08 Thread Charlie Clark

On 2005-04-08 at 10:44:59 [+0200], Andrew Veitch 
[EMAIL PROTECTED] wrote:
 We'd be willing to provide patches for both these issues if there's
 interest and agreement it's a sensible way to go.

The most sensible thing is if the DA does not have to do the quoting at all 
and that this is either done by the underlying Python driver or better 
still by the database. This is significantly faster and safer.

If you use our mxODBCZopeDA as an ExternalMethod you can use bound 
parameters  (have your cake and eat it).

We started some work on a replacement last year after EuroPython and you 
can check the archives for our progress. My cycling accident interrupted 
work :-/ but I'm starting to look at using SimpleTemplates in conjunction 
with a considerably simplified DB.py which will do little more than call 
the .execute() on the connection.

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


Re: [Zope-DB] Creating a hyperlink using results from query

2005-04-08 Thread Charlie Clark

On 2005-04-08 at 11:44:17 [+0200], Martin Jennings [EMAIL PROTECTED] 
wrote:
 Firstly, thank you to those who answered by query on the empty result set,
 it set me on the way to finding a solution.
 
 Not sure if this is the right list to ask on, but here is the question.
 
 I have got information from a ZSQL request in a result set and I want to
 use one of the values as a parameter in a hyperlink, how do I do this?
 
 I.e. a href=htmlPage?parameter=ZSQLValuemy linka
 
 How do I write the code for this?
 
 Thank you in advance, and once again, sorry if this is not the correct list.

Hi Martin,

read up on doing this with PageTemplates. You need to use the TALES keyword 
attributes

Something similar to

block tal:repeat=result myQuery
a tal:attributes=href result/link tal:content=result/value/a
/block

is what you want.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
  Python/Zope Consulting and Support ...http://www.egenix.com/
  mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
  mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! 
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db