Package com.datastax.driver.core

Examples of com.datastax.driver.core.BoundStatement.bind()


                PreparedStatement statement = session.prepare("INSERT INTO " + keys + "." + table + "(id, colname, colvalue) VALUES (?, ?, ?)");
                BoundStatement boundStatement = new BoundStatement(statement);
                String colName = StandardConverters.convertToString(c.getName());
                checkIfRowExsits(table, rowkey, colName);
                if (c.getValue() != null && c.getValue().length != 0) {
                    session.execute(boundStatement.bind(ByteBuffer.wrap(rowkey), colName, ByteBuffer.wrap(c.getValue())));
                } else {
                    session.execute(boundStatement.bind(ByteBuffer.wrap(rowkey), colName, ByteBuffer.wrap(new byte[0])));
                }

            } catch (Exception e) {
View Full Code Here


                String colName = StandardConverters.convertToString(c.getName());
                checkIfRowExsits(table, rowkey, colName);
                if (c.getValue() != null && c.getValue().length != 0) {
                    session.execute(boundStatement.bind(ByteBuffer.wrap(rowkey), colName, ByteBuffer.wrap(c.getValue())));
                } else {
                    session.execute(boundStatement.bind(ByteBuffer.wrap(rowkey), colName, ByteBuffer.wrap(new byte[0])));
                }

            } catch (Exception e) {
                System.out.println(c.getValue() + "Exception:" + e.getMessage());
            }
View Full Code Here

                } else if (indexCfName.equalsIgnoreCase("IntegerIndice")) {
                    keyObject = StandardConverters.convertFromBytes(Long.class, key);
                } else if (indexCfName.equalsIgnoreCase("DecimalIndice")) {
                    keyObject = StandardConverters.convertFromBytes(Float.class, key);
                }
                session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowKey), keyObject, ByteBuffer.wrap(value)));
            } else {
                PreparedStatement statement = session.prepare("INSERT INTO " + keys + "." + table + "(id, colname, colvalue) VALUES (?, ?, ?)");
                BoundStatement boundStatement = new BoundStatement(statement);
                if (indexCfName.equalsIgnoreCase("IntegerIndice")) {
                    boundStatement.setString("id", StandardConverters.convertFromBytes(String.class, rowKey));
View Full Code Here

                    boundStatement.setString("id", StandardConverters.convertFromBytes(String.class, rowKey));
                    boundStatement.setBytesUnsafe("colname", ByteBuffer.wrap(new byte[0]));
                    boundStatement.setBytes("colvalue", ByteBuffer.wrap(value));
                    session.execute(boundStatement);
                } else
                    session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowKey), "", ByteBuffer.wrap(value)));
          }
        } catch (Exception e) {
            System.out.println(indexCfName + " Exception:" + e.getMessage());
        }
View Full Code Here

            try {
                String colValue = StandardConverters.convertFromBytes(String.class, c.getValue());
                PreparedStatement statement = session.prepare("INSERT INTO " + keys + "." + table + "(id, colname, colvalue) VALUES (?, ?, ?)");
                BoundStatement boundStatement = new BoundStatement(statement);
                if (colValue != null) {
                    session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowkey),
                            StandardConverters.convertFromBytes(String.class, c.getName()),
                            ByteBuffer.wrap(c.getValue())));
                } else {
                    session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowkey),
                            StandardConverters.convertFromBytes(String.class, c.getName()), ByteBuffer.wrap(nullArray)));
View Full Code Here

                if (colValue != null) {
                    session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowkey),
                            StandardConverters.convertFromBytes(String.class, c.getName()),
                            ByteBuffer.wrap(c.getValue())));
                } else {
                    session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowkey),
                            StandardConverters.convertFromBytes(String.class, c.getName()), ByteBuffer.wrap(nullArray)));
                }

            } catch (Exception e) {
                System.out.println(c.getValue() + "Exception:" + e.getMessage());
View Full Code Here

                } else if (indexCfName.equalsIgnoreCase("IntegerIndice")) {
                    keyObject = StandardConverters.convertFromBytes(Long.class, key);
                } else if (indexCfName.equalsIgnoreCase("DecimalIndice")) {
                    keyObject = StandardConverters.convertFromBytes(Float.class, key);
                }
                session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowKey), keyObject, ByteBuffer.wrap(value)));
            } else {
                PreparedStatement statement = session.prepare("INSERT INTO " + keys + "." + table + "(id, colname, colvalue) VALUES (?, ?, ?)");
                BoundStatement boundStatement = new BoundStatement(statement);
                if (indexCfName.equalsIgnoreCase("IntegerIndice")) {
                    boundStatement.setString("id", StandardConverters.convertFromBytes(String.class, rowKey));
View Full Code Here

                    boundStatement.setString("id", StandardConverters.convertFromBytes(String.class, rowKey));
                    boundStatement.setBytesUnsafe("colname", ByteBuffer.wrap(new byte[0]));
                    boundStatement.setBytes("colvalue", ByteBuffer.wrap(value));
                    session.execute(boundStatement);
                } else
                    session.execute(boundStatement.bind(StandardConverters.convertFromBytes(String.class, rowKey), "", ByteBuffer.wrap(value)));
          }
        } catch (Exception e) {
            System.out.println(indexCfName + " Exception:" + e.getMessage());
        }
View Full Code Here

            if (!markAsUnused) {
                // store content as used
                String stmt = "INSERT INTO modeshape.binary (cid, payload, usage) VALUES (?,?,1)";
                PreparedStatement preparedStatement = session.prepare(stmt);
                BoundStatement statement = new BoundStatement(preparedStatement);
                session.execute(statement.bind(key.toString(), buffer(stream)));
            } else {
                // store content as un-used
                String stmt = "INSERT INTO modeshape.binary (cid, usage_time, payload, usage) VALUES (?,?,?,0)";
                PreparedStatement preparedStatement = session.prepare(stmt);
                BoundStatement statement = new BoundStatement(preparedStatement);
View Full Code Here

            } else {
                // store content as un-used
                String stmt = "INSERT INTO modeshape.binary (cid, usage_time, payload, usage) VALUES (?,?,?,0)";
                PreparedStatement preparedStatement = session.prepare(stmt);
                BoundStatement statement = new BoundStatement(preparedStatement);
                session.execute(statement.bind(key.toString(), new Date(), buffer(stream)));
            }
            return new StoredBinaryValue(this, key, temp.getSize());
        } catch (BinaryStoreException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.