DBD-libsql

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


## Prepared Statement Example

    use DBI;
    
    my $dbh = DBI->connect($dsn, '', $token, { RaiseError => 1 });
    
    # Prepare statement once
    my $sth = $dbh->prepare(q{
        INSERT INTO log_entries (level, message, timestamp) 
        VALUES (?, ?, CURRENT_TIMESTAMP)
    });
    
    # Execute multiple times with different data
    my @log_data = (
        ['INFO', 'Application started'],
        ['DEBUG', 'Database connection established'],
        ['WARN', 'Configuration file not found'],
        ['ERROR', 'Failed to process request'],
    );
    
    for my $entry (@log_data) {
        $sth->execute(@$entry);
    }
    
    $sth->finish();
    print "Inserted " . scalar(@log_data) . " log entries\n";
    
    $dbh->disconnect();

# COMPATIBILITY

## libsql Server Versions

This driver is compatible with:

- libsql server v0.21.0 and later
- Turso managed databases
- sqld (libsql server daemon)

## Perl Versions

Requires Perl 5.18 or later.

## DBI Compliance

Implements DBI specification 1.631+ with the following notes:

- All standard DBI methods are supported
- Some DBD-specific attributes (like last\_insert\_id) may have limitations
- Prepared statements use Hrana protocol parameter binding

# DEPENDENCIES

This module requires the following Perl modules:

- DBI (1.631 or later)
- LWP::UserAgent (6.00 or later)
- HTTP::Request (6.00 or later)
- JSON (4.00 or later)
- IO::Socket::SSL (2.00 or later) - for HTTPS connections

# AUTHOR

ytnobody <ytnobody@gmail.com>

# LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

# SEE ALSO

## Related Perl Modules

- [DBI](https://metacpan.org/pod/DBI) - Database independent interface for Perl
- [DBD::SQLite](https://metacpan.org/pod/DBD%3A%3ASQLite) - SQLite driver for DBI (local file databases)
- [DBD::Pg](https://metacpan.org/pod/DBD%3A%3APg) - PostgreSQL driver for DBI
- [DBD::mysql](https://metacpan.org/pod/DBD%3A%3Amysql) - MySQL driver for DBI

## libsql and Turso Documentation

- [https://docs.turso.tech/](https://docs.turso.tech/) - Turso cloud database documentation
- [https://github.com/tursodatabase/libsql](https://github.com/tursodatabase/libsql) - libsql GitHub repository
- [https://docs.turso.tech/reference/libsql-urls](https://docs.turso.tech/reference/libsql-urls) - libsql URL format specification
- [https://docs.turso.tech/sdk/http/reference](https://docs.turso.tech/sdk/http/reference) - Hrana protocol documentation

## Development Tools

- [https://docs.turso.tech/reference/turso-cli](https://docs.turso.tech/reference/turso-cli) - Turso CLI for database management
- [https://github.com/tursodatabase/turso-cli](https://github.com/tursodatabase/turso-cli) - Turso CLI source code

## Alternative Solutions

- libsql official SDKs for other languages
- Direct HTTP API access using LWP::UserAgent
- SQLite with replication solutions



( run in 0.719 second using v1.01-cache-2.11-cpan-39bf76dae61 )