fjenett / sql-library-processing Goto Github PK
View Code? Open in Web Editor NEWSQLibrary – a SQL database library for Processing incl. MySQL, SQLite and PostgreSQL
Home Page: http://fjenett.github.com/sql-library-processing/
SQLibrary – a SQL database library for Processing incl. MySQL, SQLite and PostgreSQL
Home Page: http://fjenett.github.com/sql-library-processing/
Hi, i wanted to use a String to change my request to my DB.
Means i use a String called "search" for example.
So i could go search= "search1";
( "SELECT * FROM table WHERE x="search" ");
But it doesnt works.
However, if i put my request directly on my
("SELECT * FROM table WHERE x="search1"")
It works, indeed.
So i dont understand how to use a String (that i could change) to do my request to my DB.
Thanks for your help !
=> Sorry for my bad english, if you know what i mean :)
Create a class inspector that will generate SQL code that is needed to store class in a DB:
mydb.execute( mydb.tableFor( MyFunkyClass.class ) );
Mainly for SQLite, add method to generate db.sqlite at given path or in sketch folder:
mySqlDb.createDatabase("name.sqlite");
mySqlDb.createDatabase("/full/path/to/my/folder/name.sqlite");
Smarter queries:
db.query( String )
db.query( String, Object ... args ) {
db.query( String.format( String, args ) )
}
or just use a [PreparedStatement](http://docs.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html PreparedStatement) which seems to bring in
select("table_name").all()
select("table_name").where("name",Object).groupBy("foo")
Hello,
I wish to populate an array with the query result, and the normal way is with resultSet rs = pgsql.query(query); however I get the message 'cannot convert from void to resultset' even when importing additional libraries.
import de.bezier.data.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
String user = "postgres";
String pass = "a";
String database = "wordnet30";
ArrayList <String[]> result = new ArrayList<String[]>();
PostgreSQL pgsql;
pgsql = new PostgreSQL( this, "localhost:5432", "wordnet30", "postgres", "a" );
if ( pgsql.connect() )
{
//Statement st = conn.createStatement();
ResultSet rs = pgsql.query("SELECT * FROM ra");
int columnCount = rs.getMetaData().getColumnCount();
while(pgsql.next())
{
String[] row = new String[columnCount];
for (int i = 0; i < columnCount; i++)
{
row[i] = rs.getString(i+1);
}
result.add(row);
}
}
else
{
}
Print(result);
Is there a way around this? Is it feasible to use the JDBC directly in Processing, and avoiding 'public static void main' ?
Best regards,
Nicholas Bloom
Hi,
I posted this to The Processing Forum, Can you have a look ? I explain the problem.
http://forum.processing.org/two/discussion/comment/45968#Comment_45968
Can you help ?
Thank you for your library. It helps me a lot.
Fabrice
Attempting to use the library in Processing 3 gives the following error:
NoSuchMethodError: You may be using a library that's incompatible with this version of Processing.
Your library has been a critical part of my workflow and it would be tragic for it to not be updated to work with P3.
thanks!
Was ist das in PostgreSQL, das geht nicht.
public String[] getTableNames ()
{
if ( tableNames == null )
{
tableNames = new ArrayList<String>();
query( "SELECT relname AS 'table_name' FROM pg_stat_user_tables WHERE schemaname='public'" );
while ( next() ) {
tableNames.add( getObject("table_name").toString() );
}
}
return tableNames.toArray(new String[0]);
}
}
The library zip file should have the folder structure described in the library guidelines
documentation
should be reference
source
should be src
Make sure this is taken account for:
http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-charsets.html
... there have been complaints about characters not showing up correct in Processing sketches. Review these and make tests to ensure it's not on our side.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.