Code Monkey home page Code Monkey logo

itemdb's People

Contributors

almarklein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rayleyva

itemdb's Issues

sqlite3.OperationalError: database is locked

    db = itemdb.ItemDB(dbname)
    db.ensure_table("all","!videoid","status")
s_thread_fastlane
    db.ensure_table("all","!videoid","status")  
  File "D:\Program Files\anaconda3\lib\site-packages\itemdb.py", line 211, in ensure_table      
    self._ensure_table_helper1(table_name, indices, missing_indices)
  File "D:\Program Files\anaconda3\lib\site-packages\itemdb.py", line 217, in _ensure_table_helper1
    self._ensure_table_helper2(table_name, indices)
  File "D:\Program Files\anaconda3\lib\site-packages\itemdb.py", line 251, in _ensure_table_helper2
    cur.execute(text)
sqlite3.OperationalError: near "all": syntax error

all seem to be keyword change to others fixed that

SQLite Compatability Issues

Hey there @almarklein ๐Ÿ‘‹๐Ÿผ
When testing out timetagger on my workstation, which has an old version of SQLite3 (3.7.17 2013-05-20 00:56:22), it's failing to ensure the user table is created due to that version not supporting the WITHOUT ROWID command found in the "get_unsafe_webtoken" method call.

Just filing this issue to either get a fix in software or a list of minimum versions required for itemdb. The fix was just to update to a newer version of SQLite3.

Thanks!

only index column supported?

same db and table with 6 records in it ,post_id is index post_link is not ,

    db=context['db']
    tables=db.get_table_names()
    print('current operating db:',tables)

    for t in tables:
        list = db.select_all(t)  # -> list of 2 items
        # print('------',t,'---------',list)
        if t=='scrape':
            for i in list:
                if i['post_link']==post_link:

                    print('-------------','table',t,'has record\n',i['post_id'])

print is all the result expected

option2

    tablename ="scrape"    
    # print('check link exist',post_link,db.select(tablename, "post_link==?",post_link))
    try:
        count = len(db.select(tablename, "post_link==?",post_link))
        if count>0:
            print('found exising record',count,'--,',post_link)
            records=db.select(tablename, "post_link==?",post_link)
            for r in records:
                print('!!!!!!!!!',r['post_id'])
            return True
        else:
            return False
    except:
        return False

constanly say False.
am i mistaken?
what if i need to know by whether the same post_link is there

Force using safe queries

Although #10 should make users much more aware of SQL injections, here's another idea to help users prevent bad practice.

The most likely route for unsafe data to enter a database command, is via the query arg of e.g. select or delete. We could parse this argument and check that it only consists of simple names, logical operators ("AND" and "OR") and question marks, and perhaps some other syntax that I'm overlooking now.

We could then show a warning or even raise an exception (when a flag is certain set?) when things look unsafe.

This is just an idea for now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.