Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Database > Database APIs

    TecUtils 0.4.0

    Download button

    No screenshots available
    Downloads: 280  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Gabriel Martin del Campo y Eternod | More programs
    Other/Proprietary Li... / FREE
    August 5th, 2012, 21:27 GMT
    ROOT / Database / Database APIs

     Read user reviews (0)  Refer to a friend  Subscribe

    TecUtils description

    Various utilities for database and config files use

    TecUtils is a software that provides various utilities to accelerate development of programs design to use MySQL as a database and substitute the use of global variables.

    TecUtils contains the following modules:

    - mydb
    - envvar

    mydb:

    Requires:
        mysql-python

    Provides:
        There are three functions that take care the database interaction:

        - GetRecordset(sHost,sUser,sPwd,sDB,sSQL)
        - GetData(sHost,sUser,sPwd,sDB,sSQL)
        - ExecuteSQL(sHost,sUser,sPwd,sDB,sSQL)

    ::
    import TecUtils.mydb

    myHost = "localhost"
    myUser = "root"
    myPwd = "password"
    myDB = "test"


    TecUtils.mydb.ExecuteSQL(myHost, myUser, myPwd, myDB, "INSERT INTO animal (name, category) VALUES " + \
        ('snake', 'reptile'), ('frog', 'amphibian'), ('tuna', 'fish'), ('racoon', 'mammal'), ('lizard', 'reptile')")

    sql="SELECT name FROM animal WHERE category='reptile'"
    TecUtils.mydb.GetRecordset(myHost, myUser, myPwd, myDB,sql)

    thistype='fish'
    sql="SELECT name FROM animal WHERE category='%s'" % thistype
    TecUtils.mydb.GetData(myHost, myUser, myPwd, myDB,sql)
    ::


    envvar:

    Provides:
        Reads a file containing = and loads in a container, so you can use container.var

        getVarFromFile(filename,container)

    Use:

    ::
    db = getVarFromFile('config/db.cfg','db')
    ::


    Examples:

    If use the two modules provides a way to use a configuration file to access de database:

    ::

    # this is the config file:
    # db.cfg
    HOST = 'localhost'
    USER = 'root'
    PWD = 'ahivoy'
    DB = 'facturae'

    ::


    and use it in a program:

    ::
    import TecUtils


    TecUtils.envvar.getVarFromFile('db.cfg',db)

    data = TecUtils.mydb.GetRecordset(db.HOST,db.USER,db.PWD,db.DB,"SELECT * FROM animal")
    for animal in data:
        print animal[0]

    ::



    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    database utilities | database configuration | database | utilities | configuration

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM