×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    2

    Big Question - Big Issue

    Hi,

    I want to write a little app in python for the s60 platform that will prompt the user for some simple information, store it in a file and make it easy to retrieve, update, delete the data at any time.

    I have not used python before but I do know a bit of php/html and am familiar with databases concepts and so on. I have read some great python tutorials for the s60 and seem some example code and have a few rough ideas about how to progress (although I am not sure how good my ideas are at the moment because I am new to python).

    I particularly liked the tab feature on the user interface which I think makes fantastic use of small screens. It is also a simple and natural way to organise and present the data input screens for the user.

    Problem is, I don’t know how to implement this with a form (or maybe if I am using several tabs for the data input I would need one form for each tab - I just don’t know enough python yet).

    Anyway, just to make sure I am not missing something obvious and trying to reinvent a very well developed wheel I would like to ask a simple question.

    Is there an existing CRUD framework for python that is running on the s60 platform?

    I need to be able to (C)reate, (R)etrieve, (U)pdate, (D)elete records in a simple database on the s60 platform using an attractive user interface. I know there is a database module in python on the s60 platform but I haven’t seen a well worked out, attractive, generic CRUD user interface for it.

    For my purposes I need to create the records on the mobile phone and then when it is convenient for the user give him/her the functionality to upload the data to a mysql db on a web server for some additional post processing.

    I could just write some xhtml forms that update the db and put them on the web server and the user would just access them from his/her wap mobile device but if I do that then the user misses out on the native python user interface on the mobile which looks pretty nifty. Also - saving the records first on the mobile prior to uploading them to the web server is a much more solid model.

    Has anyone implemented an attractive user interface for storing and updating a little database on the s60 platform? It doesn’t have to use the database module – a simple flat ASCII file database would be fine. If so - could they post the code.

    Obviously - this type of script done well will have massive interest and applicability.

    Thanks in advance for any info received.

    JP.

  2. #2
    Regular Contributor
    Join Date
    Jan 2005
    Location
    Bangkok, Thailand
    Posts
    148

    Re: Big Question - Big Issue

    I can't find any CRUD framework on pys60 either.
    I have been thinking of writing one based on sqlobject.
    It's not finished yet, though.
    sqlobject uses too much magic, making its code difficult to read.
    When it's finished I will share it here.

    Do you see any other good CRUD framework apart from sqlobject?

  3. #3
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: Big Question - Big Issue

    I can't find any CRUD framework on pys60 either.
    I have been thinking of writing one based on sqlobject.
    It's not finished yet, though.
    sqlobject uses too much magic, making its code difficult to read.
    When it's finished I will share it here.
    Thanks to you :-)
    Do you see any other good CRUD framework apart from sqlobject?
    Yes PyDO2 and SQLAlchemy look at http://spyced.blogspot.com/2006/02/w...elongs-in.html

  4. #4
    Regular Contributor
    Join Date
    Jan 2005
    Location
    Bangkok, Thailand
    Posts
    148

    Re: Big Question - Big Issue

    Here's my first(0.1) version of an ORM for pys60.
    http://bigbold.com/snippets/posts/show/1675

    I have actually made a 0.2 version with support for one_to_many
    and many_to_many. I will publish them if there are interests.
    Adding an automatic form-generation won't be difficult.
    You can access YourClass.mapping.__dict__ and use them.

  5. #5
    Regular Contributor
    Join Date
    Jan 2005
    Location
    Bangkok, Thailand
    Posts
    148

    Re: Big Question - Big Issue

    Sample usage
    Code:
    class Person(Mapper):
        class mapping:
            # id = column(Integer) # generate automatically
            name = column(String)
            age = column(Integer)
    You have to create the table manually first
    Code:
    db.execute(u'CREATE TABLE person (id COUNTER, name VARCHAR, age INTEGER)')
    But then you can INSERT, SELECT, UPDATE, DELETE easily
    Code:
    # insert
    p1 = Person(name='korakot', age=29)
    
    # select one using id, doesn't create new
    p2 = Person(2) 
    
    # select more
    people = Person.select('age>20', orderby='age DESC')
    
    # select an attribute
    p1.name
    # select all attributes, return as a dict
    p1.dict()
    
    # update an attribute
    p1.name = 'morning_glory'
    # update many attributes
    p1.set(name='morning_glory', age=22)
    
    # delete
    p1.delete()
    Python's __getitem__ is so powerful. I am amazed how easy
    I implement ForeignKey, one_to_many and many_to_many. (in 0.2)

    PS. Also see my sql snippets.

Similar Threads

  1. big jar file size problem b/c satellite and roadmaps are needed
    By sukotheruler in forum Mobile Java General
    Replies: 1
    Last Post: 2006-06-16, 11:54
  2. a question about command and a question about s60
    By t4kesting in forum Mobile Java General
    Replies: 0
    Last Post: 2006-01-24, 08:21
  3. Replies: 2
    Last Post: 2004-01-08, 18:36
  4. Sending data using iAcceptedSocket (Urgent question)
    By okegame in forum Bluetooth Technology
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •