Welcome
Welcome to <strong>txtSQL</strong>.

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>!

SQL generator classes

General chit chatter can go in here

SQL generator classes

Postby e.entropy on Mon May 07, 2007 9:37 pm

What if (i've considered developing this for awhile now...) the engine supported SQL via generation through classes.

Ideal SuperClass:
Query
Subclasses:
SelectQuery,
InsertQuery,
UpdateQuery,
SubQuery (may not be necessary),
DeleteQuery,
CreateQuery,
ExplainQuery (may be synonymous with DescribeQuery)

anyone else interested in this?
basically, all that would be needed then is to create an object of the appropriate query type needed, and bind some fields, choose a table or two, specify where conditions, and the query would be returned via GetQuery();
e.entropy
 
Posts: 3
Joined: Mon May 07, 2007 8:44 pm

Postby FarazAli on Wed May 09, 2007 7:52 pm

i dont really get what you mean... your plans are a bit obscure...
Latest txtSQL Stable Release: txtSQL 2.2 Final

Track 4.0 Development

Image
FarazAli
Site Admin
 
Posts: 73
Joined: Sun Mar 25, 2007 1:08 pm
Location: New Jersey, NJ

Postby e.entropy on Sat May 12, 2007 11:39 am

the idea behind this is to utilize object oriented programming to generate dynamic SQL queries with little to no knowledge of actual sequel.

The Query class would have a few public methods, which would be overridden by the subclasses SelectQuery, InsertQuery ... and so on.

This way, your queries are always well-formed, optimized, AND injection free.
e.entropy
 
Posts: 3
Joined: Mon May 07, 2007 8:44 pm

Postby FarazAli on Sat May 12, 2007 10:52 pm

how is this method any different from the one already implemented in 2.2 final?

maybe I don't really understand what you're saying.
Latest txtSQL Stable Release: txtSQL 2.2 Final

Track 4.0 Development

Image
FarazAli
Site Admin
 
Posts: 73
Joined: Sun Mar 25, 2007 1:08 pm
Location: New Jersey, NJ

Postby e.entropy on Sun May 13, 2007 2:03 am

from what i gather about the current sql generation in txtsql, the queries are simply imploded arrays.
while this implementation is KISS, it appears to be prone to syntax and typographical errors.

maybe i need to read the documentation more in depth when i have more time on my hands
e.entropy
 
Posts: 3
Joined: Mon May 07, 2007 8:44 pm

Postby FarazAli on Sun May 13, 2007 10:47 am

current SQL generation in what version? there is none in versions < 2.2 final (4.0 is being worked on)...

when you say the queries are just imploded arrays... where are you pointing to?
Latest txtSQL Stable Release: txtSQL 2.2 Final

Track 4.0 Development

Image
FarazAli
Site Admin
 
Posts: 73
Joined: Sun Mar 25, 2007 1:08 pm
Location: New Jersey, NJ

Re: SQL generator classes

Postby zzw08 on Tue Jul 14, 2009 5:42 am

http://www.fashion-products.com [url=http://www.fashion-products.com ]is a sell air force one,
air jordan,bape,kicks,nike,Jerseys,Shoes,Clothing,Bag,Glasses,Caps&Hats,sneakers,sunglasses,
watches,Jewelry,Electronics,NBA,NFL,NHL,MLB[/url]
shoes
clothing
Handbags Wallets
Hat
Sunglasses
Belts
Watches
Jewelry
zzw08
 
Posts: 53
Joined: Tue Jul 14, 2009 5:15 am

Re: SQL generator classes

Postby clarke on Sat Aug 22, 2009 12:49 am

The OQL-SQL mapping generator for HSQLDB generates illegal SQL statements which
refer to aliases that are not declared. This takes place particularly when
table joins are performed.

I've tracked the root of the problem being method addTables in
HsqlQueryExpression class:

private void addTables(StringBuffer buffer, Hashtable tables, boolean first).

This method adds table names to the SQL statement being generated. Although,
unlike its JDBC corresponding code, it never makes use of aliases in the
provided HashMap:

Enumeration enum = tables.elements();
while ( enum.hasMoreElements() )
{ if ( first ) first = false; else buffer.append( JDBCSyntax.TableSeparator ); buffer.append( _factory.quoteName( (String) enum.nextElement() ) ); }

}

I do not know the internals of SQL generation in Castor well enough to
contribute a full patch+test case bundle. Although I have locally replaced the
above method with the related code from JDBC SQL generation class and it passed
all of my project's test cases (these test cases have been designed to work
with MySQL and HSQLDB). Therefore I believe this patch should solve the bug. I
would suggest the person knowledgeable in HSQLDB generation engine takes a look
at the code before it is incorporated in the CVS, however.

Regards,
clarke
 
Posts: 1
Joined: Wed Aug 19, 2009 10:59 pm


Return to Chit Chat

Who is online

Users browsing this forum: No registered users and 0 guests

cron