Code Monkey home page Code Monkey logo

livecode-dblib's Introduction

DB Lib

Introduction

I've wanted to build this library since forever. After using similar libraries with PHP and Ruby, I decided that we really needed some easy library for database access but I always postponed creating one.

After Ralf released RevIgniter (http://www.revigniter.com) I became spoiled by his database implementation. It was perfect but it worked only on the server side. Now with my mobile developments, I needed something that worked locally with SQLite. So I decided to build this library.

Documentation

Check the PDF that is bundled with this download, really, please!!!! Also check out the docs generated by RevDoc that are inside the docs folder. Look into the code of the little demo stack that is bundled and read the source code from DB Lib itself.

This library is pretty small but it is clever. It will take very little time to read the code and understand everything. As always my libraries are unlocked and the best documentation is the source code.

Have I told you that the PDF is 30+ pages?

The API Docs have more information than the PDF, don't miss it. The guide is more pleasant but it is no substitute for the auto-generated docs

Support Forum

Use the issues at this repository to ask for help or email me at [email protected]

What you are allowed to do?

You can use this library and its source code or parts of it in your own free or commercial products but please don't resell it as your own work. LiveCode community is small, we all know each other so I trust you guys with all the source code because I know there is no way to maintain software with locked stacks.

Version History

  • 1.0: Initial Beta Release
  • 1.1: Changes to dbWhere and dbLike.
    • added new concatenation to dbWhere and dbLike to make possible to do OR. Check API docs.
  • 1.2: Fixed a bug in both dbWhere and dbLike where issuing multiple dbWhere for the same column would cause problems.
  • 1.3: Bug fixing.
  • 1.4: Changes to documentation and links to forum.
  • 1.9: Bug fixing regarding database connection ids.
  • 1.10: Added null and not null options to dbWhere.
  • 1.11: New build system. (built on: Tue, 11 Sep 2012 12:55:55 -0300)
  • DataStorage Lib 0.3 BETA: Bug fix in dsGet() due to missing key. (built on: Tue, 18 Sep 2012 02:19:38 -0300)
  • DB Lib 1.12: Improvements to build system. New DS version. (built on: Tue, 18 Sep 2012 02:20:35 -0300)
  • DB Lib 1.13: Adding optional parenthesis to where clauses (built on: Fri, 26 Oct 2012 18:12:11 -0200)
  • DB Lib 1.14: Adding support for RevIgniter (built on: Fri, 26 Oct 2012 18:25:50 -0200)
  • DB Lib 1.15: Added dbLastSQL, dbIn and dbNotIn handlers (built on: Fri, 9 Nov 2012 15:00:17 -0200)
  • DB Lib 1.17: Added GPLv3 dual licensing. (built on: Tue, 21 May 2013 13:08:55 -0300)

livecode-dblib's People

Contributors

soapdog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

livecode-dblib's Issues

dbIn only works if issued first for a given column

The dbIn function will only work if it is the first where function called on that column. The term placeholder(pValue) will always be null since there is no variable pValue in the function call parameter list. dbA["where columns"][pColumn] isn't used anywhere else, but gets set with each where call. I've submitted a pull request with code that addresses this issue.

Documents and support of LC version >7

Since LiveCode has deprecated functions such as uniCode/uniDecode since version 7, I suggest updating such parts to become aware of newer versions of LC. The same needs to be updated in the documentation

dbOpenParenthesis does not add "AND/OR" to SQL string

The current function implementation for dbOpenParenthesis will not add the necessary "AND" / "OR" to the SQL string. Also, it should be permitted for the WHERE clause to start with "(" and not require something else first.

Here's a suggested function implementation (included in the pull request):

on dbOpenParenthesis pConcatenationOperator
   if pConcatenationOperator is empty then
      put "AND" into pConcatenationOperator
   end if
   
   -- BWM - properly handle concatenation operator when parenthesis used
   if the last word of dbA["where"] = "(" then
      put empty into pConcatenationOperator
   end if
   
   if dbA["where"] is not empty then
      put " " & pConcatenationOperator && "(" after dbA["where"]
   else
      put "WHERE (" before dbA["where"]
   end if
   
   -- BWM - count opening parenthesis so they can be automatically closed
   if dbA["parenLevel"] is empty  then
      put 1  into dbA["parenLevel"]
   else
      add 1 to dbA["parenLevel"]
   end if
end dbOpenParenthesis

Here is the corresponding code for close:

on dbCloseParenthesis
   --BWM - use open parenthesis level to check if call is valid
   if dbA["parenLevel"] > 0 then
      put " ) " after dbA["where"]
      subtract 1 from dbA["parenLevel"]
   end if
end dbCloseParenthesis

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.